Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 2349 → Rev 2350

/MKLiveView/v1.0/Source/MainWindow.xaml.cs
2795,6 → 2795,7
MessageBox.Show("Error writing ini-file!" + Environment.NewLine + "Please make sure that the programm is in a location where it is allowed to write" + Environment.NewLine + e.Message, "Write ini-file", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
 
#region serial channels
/// <summary>
/// Sending the serial channel values
2818,8 → 2819,8
textBoxSerial1.Text = serChanTitle[0];
SerChan2ScaleSlider.Value = serChan[1];
textBoxSerial2.Text = serChanTitle[1];
//SerChan3ScaleSlider.Value = serChan[2];
//textBoxSerial3.Text = serChanTitle[2];
SerChan3ScaleSlider.Value = serChan[2];
textBoxSerial3.Text = serChanTitle[2];
//SerChan4ScaleSlider.Value = serChan[3];
//textBoxSerial4.Text = serChanTitle[3];
//trckbarSerial5.Value = serChan[4];
2837,9 → 2838,9
textBoxSerial2_val1.Text = serChan_sub[3].ToString();
textBoxSerial2_val2.Text = serChan_sub[4].ToString();
textBoxSerial2_val3.Text = serChan_sub[5].ToString();
//textBoxSerial3_val1.Text = serChan_sub[6].ToString();
//textBoxSerial3_val2.Text = serChan_sub[7].ToString();
//textBoxSerial3_val3.Text = serChan_sub[8].ToString();
textBoxSerial3_val1.Text = serChan_sub[6].ToString();
textBoxSerial3_val2.Text = serChan_sub[7].ToString();
textBoxSerial3_val3.Text = serChan_sub[8].ToString();
//textBoxSerial4_val1.Text = serChan_sub[9].ToString();
//textBoxSerial4_val2.Text = serChan_sub[10].ToString();
//textBoxSerial4_val3.Text = serChan_sub[11].ToString();
2983,6 → 2984,76
SerChan2ScaleSlider.Value = Convert.ToInt16(textBoxSerial2_val3.Text);
}
}
 
private void SerChan3ScaleSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (!_init)
{
serChan[2] = (int)SerChan3ScaleSlider.Value;
_sendSerialData();
}
}
private void textBoxSerial3_TextChanged(object sender, TextChangedEventArgs e)
{
if (!_init)
{
serChanTitle[2] = textBoxSerial3.Text;
}
}
private void textBoxSerial3_val1_TextChanged(object sender, TextChangedEventArgs e)
{
if (textBoxSerial3_val1.Text.Length > 0 & !_init)
{
serChan_sub[6] = Convert.ToInt16(textBoxSerial3_val1.Text);
}
}
private void textBoxSerial3_val2_TextChanged(object sender, TextChangedEventArgs e)
{
if (textBoxSerial3_val2.Text.Length > 0 & !_init)
{
serChan_sub[7] = Convert.ToInt16(textBoxSerial3_val2.Text);
}
}
private void textBoxSerial3_val3_TextChanged(object sender, TextChangedEventArgs e)
{
if (textBoxSerial3_val3.Text.Length > 0 & !_init)
{
serChan_sub[8] = Convert.ToInt16(textBoxSerial3_val3.Text);
}
}
private void btnSer3_0_Click(object sender, RoutedEventArgs e)
{
SerChan3ScaleSlider.Value = 0;
}
private void btnSer3_127_Click(object sender, RoutedEventArgs e)
{
SerChan3ScaleSlider.Value = 127;
}
private void btnSer3_254_Click(object sender, RoutedEventArgs e)
{
SerChan3ScaleSlider.Value = 254;
}
private void btnSer3_val1_Click(object sender, RoutedEventArgs e)
{
if (textBoxSerial3_val1.Text.Length > 0)
{
SerChan3ScaleSlider.Value = Convert.ToInt16(textBoxSerial3_val1.Text);
}
}
private void btnSer3_val2_Click(object sender, RoutedEventArgs e)
{
if (textBoxSerial3_val2.Text.Length > 0)
{
SerChan3ScaleSlider.Value = Convert.ToInt16(textBoxSerial3_val2.Text);
}
}
private void btnSer3_val3_Click(object sender, RoutedEventArgs e)
{
if (textBoxSerial3_val3.Text.Length > 0)
{
SerChan3ScaleSlider.Value = Convert.ToInt16(textBoxSerial3_val3.Text);
}
}
/// <summary>
/// checks the input of a textbox
/// for valid data
3111,7 → 3182,8
i++;
sVal = ini.IniReadValue(wp, "Prefix");
if (sVal != "")
o[i] = sVal == "0" ? "P" + k.ToString() : sVal + k.ToString();
o[i] = sVal + k.ToString();
// o[i] = sVal == "0" ? "!" + k.ToString() : sVal + k.ToString();
i++;
sVal = ini.IniReadValue(wp, "Latitude");
if (sVal != "")
3207,6 → 3279,59
 
}
}
void _saveWPLFile()
{
if (dtWaypoints.Rows.Count > 0)
{
Microsoft.Win32.SaveFileDialog fd = new Microsoft.Win32.SaveFileDialog();
fd.Filter = "Waypointlists | *.wpl";
fd.AddExtension = true;
if (fd.ShowDialog().Value)
{
string file = fd.SafeFileName;
IniFile ini = new IniFile(fd.SafeFileName);
ini.path = fd.FileName;
NumberFormatInfo nfi = new NumberFormatInfo();
nfi.NumberDecimalSeparator = ".";
 
try
{
ini.IniWriteValue("General", "FileVersion", "3");
ini.IniWriteValue("General", "NumberOfWaypoints", dtWaypoints.Rows.Count.ToString());
ini.IniWriteValue("General", "Mapfile", "");
for(int i = 1; i<=dtWaypoints.Rows.Count; i++)
{
ini.IniWriteValue("Point" + i.ToString(), "Latitude", ((double)(dtWaypoints.Rows[i-1][3])).ToString(nfi));
ini.IniWriteValue("Point" + i.ToString(), "Longitude", ((double)(dtWaypoints.Rows[i - 1][4])).ToString(nfi));
ini.IniWriteValue("Point" + i.ToString(), "Radius", dtWaypoints.Rows[i - 1][9].ToString());
ini.IniWriteValue("Point" + i.ToString(), "Altitude", dtWaypoints.Rows[i - 1][5].ToString());
ini.IniWriteValue("Point" + i.ToString(), "ClimbRate", dtWaypoints.Rows[i - 1][8].ToString());
ini.IniWriteValue("Point" + i.ToString(), "DelayTime", dtWaypoints.Rows[i - 1][10].ToString());
ini.IniWriteValue("Point" + i.ToString(), "WP_Event_Channel_Value", dtWaypoints.Rows[i - 1][14].ToString());
ini.IniWriteValue("Point" + i.ToString(), "Heading", dtWaypoints.Rows[i - 1][6].ToString());
ini.IniWriteValue("Point" + i.ToString(), "Speed", dtWaypoints.Rows[i - 1][7].ToString());
ini.IniWriteValue("Point" + i.ToString(), "CAM-Nick", dtWaypoints.Rows[i - 1][12].ToString());
ini.IniWriteValue("Point" + i.ToString(), "Type", ((int)dtWaypoints.Rows[i - 1][1]+1).ToString());
ini.IniWriteValue("Point" + i.ToString(), "Prefix", dtWaypoints.Rows[i - 1][2].ToString().Substring(0, 1)); // == "!" ? "0" : dtWaypoints.Rows[i - 1][2].ToString().Substring(0, 1));
ini.IniWriteValue("Point" + i.ToString(), "AutoTrigger", dtWaypoints.Rows[i - 1][11].ToString());
}
MessageBox.Show(dtWaypoints.Rows.Count.ToString() + " points saved to " + file, "Waypointlist saved", MessageBoxButton.OK, MessageBoxImage.Information);
}
catch { }
}
}
else
MessageBox.Show("Nothing to save...");
}
private void btnSaveWPLFile_Click(object sender, RoutedEventArgs e)
{
_saveWPLFile();
}
/// <summary>
/// set the selected color for the route
/// </summary>
/// <param name="color"></param>
/// <returns></returns>
Brush _getBrush(string color)
{
switch (color)
3405,7 → 3530,6
}
 
#endregion WP
 
#region GPX
private void checkBoxGPXLog_Click(object sender, RoutedEventArgs e)
{
3474,18 → 3598,14
}
}
}
 
private void btnLoadGPXLog_Click(object sender, RoutedEventArgs e)
{
_loadGPXLog();
}
 
private void btnClearRoute_Click(object sender, RoutedEventArgs e)
{
_clearMapMarkers(typeof(GMapRoute));
}
 
 
void _loadGPXLog()
{