Subversion Repositories Projects

Compare Revisions

Regard whitespace Rev 2327 → Rev 2328

/MKLiveView/v1.0/Source/MainWindow.xaml
664,7 → 664,7
</TabItem>
</TabControl>
</Grid>
<Grid x:Name="GridSettings" Background="#7B000000" HorizontalAlignment="Left" Width="233" Margin="23,36,0,0">
<Grid x:Name="GridSettings" Background="#7B000000" HorizontalAlignment="Left" Width="233" Margin="23,36,0,0" Visibility="Collapsed">
<TabControl x:Name="tabControlSettings" HorizontalAlignment="Left" Width="229" Background="{x:Null}" Margin="2,0,0,0">
<TabItem Header="General" Margin="0,0,-0.237,0">
<Grid x:Name="TabGridGeneral">
970,9 → 970,9
<Button x:Name="btnOSDEnter" Content="" HorizontalAlignment="Left" Height="34" Margin="87,90,0,0" VerticalAlignment="Top" Width="52" Click="btnOSDEnter_Click"/>
<Button x:Name="btnOSDLeave" Content="" HorizontalAlignment="Left" Height="34" Margin="144,90,0,0" VerticalAlignment="Top" Width="52" Click="btnOSDLeave_Click"/>
</Grid>
<Grid x:Name="GridWP" Margin="23,36,25,0" Background="#7F000000" Height="500" VerticalAlignment="Top" Visibility="Collapsed">
<Label x:Name="label4" Content="Items" HorizontalAlignment="Right" Margin="0,356,5,0" VerticalAlignment="Top" Width="62" Foreground="White"/>
<Label x:Name="lblWPCount" Content="##" HorizontalAlignment="Right" Margin="0,357,5,0" VerticalAlignment="Top" Width="28" Foreground="White"/>
<Grid x:Name="GridWP" Margin="23,36,25,0" Background="#7F000000" Height="500" VerticalAlignment="Top">
<Label x:Name="label4" Content="points" HorizontalAlignment="Right" Margin="0,376,41,0" VerticalAlignment="Top" Width="53" Foreground="White" Height="26" HorizontalContentAlignment="Right"/>
<Label x:Name="lblWPCount" Content="##" HorizontalAlignment="Right" Margin="0,382,5,0" VerticalAlignment="Top" Width="38" Foreground="White" HorizontalContentAlignment="Right" Padding="0" Height="16"/>
<Label x:Name="label4_Copy" Content="WP Index" HorizontalAlignment="Left" Margin="94,194,0,0" VerticalAlignment="Top" Width="80" Foreground="White" Visibility="Hidden"/>
<Label x:Name="lblWPIndex" Content="##" HorizontalAlignment="Left" Margin="170,194,0,0" VerticalAlignment="Top" Width="28" Foreground="White" Visibility="Hidden"/>
<Border Margin="10,370,0,3" BorderBrush="White" BorderThickness="0.5" CornerRadius="5" HorizontalAlignment="Left" Width="214">
1048,9 → 1048,9
<DataGridTextColumn Header="Out1Timer" Binding="{Binding Path=Out1Timer}"/>
</DataGrid.Columns>
</DataGrid>
<Border Margin="0,432,3,4" BorderBrush="White" BorderThickness="0.5" CornerRadius="5" HorizontalAlignment="Right" Width="421">
<Border Margin="0,432,10,4" BorderBrush="White" BorderThickness="0.5" CornerRadius="5" HorizontalAlignment="Right" Width="528">
<Grid Margin="9.5,-2.5,-9.5,3.5">
<ComboBox x:Name="comboBoxWPColor" Height="33" Margin="0,0,217,2" VerticalAlignment="Bottom" SelectedIndex="2" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="16" DropDownClosed="comboBoxWPColor_DropDownClosed" HorizontalAlignment="Right" Width="95">
<ComboBox x:Name="comboBoxWPColor" Height="33" Margin="0,0,324,2" VerticalAlignment="Bottom" SelectedIndex="2" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="16" DropDownClosed="comboBoxWPColor_DropDownClosed" HorizontalAlignment="Right" Width="95">
<ComboBoxItem Content="red"/>
<ComboBoxItem Content="green"/>
<ComboBoxItem Content="blue"/>
1057,8 → 1057,8
<ComboBoxItem Content="yellow"/>
<ComboBoxItem Content="pink"/>
</ComboBox>
<Label x:Name="label4_Copy1" Content="WP color" HorizontalAlignment="Right" Margin="0,0,232,33" VerticalAlignment="Bottom" Width="80" Foreground="White"/>
<ComboBox x:Name="comboBoxPOIColor" Margin="0,0,117,2" SelectedIndex="4" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="16" DropDownClosed="comboBoxPOIColor_DropDownClosed" HorizontalAlignment="Right" Width="95" Height="33" VerticalAlignment="Bottom">
<Label x:Name="label4_Copy1" Content="WP color" HorizontalAlignment="Right" Margin="0,0,339,33" VerticalAlignment="Bottom" Width="80" Foreground="White"/>
<ComboBox x:Name="comboBoxPOIColor" Margin="0,0,224,2" SelectedIndex="4" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="16" DropDownClosed="comboBoxPOIColor_DropDownClosed" HorizontalAlignment="Right" Width="95" Height="33" VerticalAlignment="Bottom">
<ComboBoxItem Content="red"/>
<ComboBoxItem Content="green"/>
<ComboBoxItem Content="blue"/>
1065,8 → 1065,8
<ComboBoxItem Content="yellow"/>
<ComboBoxItem Content="pink"/>
</ComboBox>
<Label x:Name="label4_Copy2" Content="POI color" HorizontalAlignment="Right" Margin="0,0,133,33" VerticalAlignment="Bottom" Width="80" Foreground="White"/>
<ComboBox x:Name="comboBoxFSColor" Height="33" VerticalAlignment="Bottom" SelectedIndex="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="16" DropDownClosed="comboBoxFSColor_DropDownClosed" HorizontalAlignment="Right" Width="95" Margin="0,0,17,2">
<Label x:Name="label4_Copy2" Content="POI color" HorizontalAlignment="Right" Margin="0,0,240,33" VerticalAlignment="Bottom" Width="80" Foreground="White"/>
<ComboBox x:Name="comboBoxFSColor" Height="33" VerticalAlignment="Bottom" SelectedIndex="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="16" DropDownClosed="comboBoxFSColor_DropDownClosed" HorizontalAlignment="Right" Width="95" Margin="0,0,124,2">
<ComboBoxItem Content="red"/>
<ComboBoxItem Content="green"/>
<ComboBoxItem Content="blue"/>
1073,8 → 1073,8
<ComboBoxItem Content="yellow"/>
<ComboBoxItem Content="pink"/>
</ComboBox>
<Label x:Name="label4_Copy3" Content="Failsave color" HorizontalAlignment="Right" Margin="0,0,34,33" VerticalAlignment="Bottom" Width="80" Foreground="White"/>
<ComboBox x:Name="comboBoxCopterColor" Margin="0,0,322,2" SelectedIndex="4" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="16" HorizontalAlignment="Right" Width="95" Height="33" VerticalAlignment="Bottom" DropDownClosed="comboBoxCopterColor_DropDownClosed">
<Label x:Name="label4_Copy3" Content="Failsave color" HorizontalAlignment="Right" Margin="0,0,141,33" VerticalAlignment="Bottom" Width="80" Foreground="White"/>
<ComboBox x:Name="comboBoxCopterColor" Margin="0,0,430,2" SelectedIndex="4" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="16" HorizontalAlignment="Right" Width="95" Height="33" VerticalAlignment="Bottom" DropDownClosed="comboBoxCopterColor_DropDownClosed">
<ComboBoxItem Content="red"/>
<ComboBoxItem Content="green"/>
<ComboBoxItem Content="blue"/>
1081,9 → 1081,20
<ComboBoxItem Content="yellow"/>
<ComboBoxItem Content="pink"/>
</ComboBox>
<Label x:Name="label4_Copy4" Content="Copter color" HorizontalAlignment="Right" Margin="0,0,337,33" VerticalAlignment="Bottom" Width="80" Foreground="White"/>
<Label x:Name="label4_Copy4" Content="Copter color" HorizontalAlignment="Right" Margin="0,0,445,33" VerticalAlignment="Bottom" Width="80" Foreground="White"/>
<ComboBox x:Name="comboBoxRouteColor" Height="33" VerticalAlignment="Bottom" SelectedIndex="4" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="16" HorizontalAlignment="Right" Width="95" Margin="0,0,19,2" DropDownClosed="comboBoxRouteColor_DropDownClosed">
<ComboBoxItem Content="red"/>
<ComboBoxItem Content="green"/>
<ComboBoxItem Content="blue"/>
<ComboBoxItem Content="yellow"/>
<ComboBoxItem Content="pink"/>
</ComboBox>
<Label x:Name="label4_Copy10" Content="route color" HorizontalAlignment="Right" Margin="0,0,36,33" VerticalAlignment="Bottom" Width="80" Foreground="White"/>
</Grid>
</Border>
<CheckBox x:Name="checkBoxShowWPRoute" Content="show route" HorizontalAlignment="Right" Height="22" Margin="0,410,0,0" VerticalAlignment="Top" Width="84" Foreground="#FFFFFEFE" Click="checkBoxShowWPRoute_Click"/>
<Label x:Name="label4_Copy9" Content="distance" HorizontalAlignment="Right" Margin="0,359,37,0" VerticalAlignment="Top" Width="57" Foreground="White"/>
<Label x:Name="lblWPRouteDistance" Content="0 m" HorizontalAlignment="Right" Margin="0,364,5,0" VerticalAlignment="Top" Width="38" Foreground="White" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" Padding="0"/>
</Grid>
<Grid x:Name="GridSideBarR" Background="#66000000" Margin="0,36,0,0" HorizontalAlignment="Right" Width="23">
<Label x:Name="labelMotordata" Content="Motors" Padding="0" RenderTransformOrigin="0.5,0.5" Margin="-25,233,-26,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Stretch" MouseDown="labelMotorData_MouseDown" FontSize="14" HorizontalAlignment="Left" Width="74" Height="22" VerticalAlignment="Top">
/MKLiveView/v1.0/Source/MainWindow.xaml.cs
44,7 → 44,8
PointLatLng start;
PointLatLng end;
PointLatLng pHome;
 
GMapRoute mRouteWP;
List<PointLatLng> wpList = new List<PointLatLng>();
#region NC-Errors
String[] NC_Error = new string[44]
{
271,6 → 272,7
static volatile int _iWPIndex = -1;
int _iWPTimeout = 1000;
bool _bGetWP = false;
bool _bShowWPRoute = false;
static volatile bool _bGetWPCount = false;
DataTable dtGPX = new DataTable();
DataRow drGPX;
348,6 → 350,7
checkBoxAutoSetHP.IsChecked = _bAutoHome;
checkBoxFollowCopter.IsChecked = _bFollowCopter;
checkBoxGPXLog.IsChecked = _bGPXLog;
checkBoxShowWPRoute.IsChecked = _bShowWPRoute;
 
}
/// <summary>
1806,6 → 1809,11
{
if (data[1] == 1)
{
wpList.Clear();
if(mRouteWP != null)
MainMap.Markers.Remove(mRouteWP);
Dispatcher.Invoke(() => lblWPRouteDistance.Content = "0 m");
dtWaypoints.Rows.Clear();
Dispatcher.Invoke(() => {
for (int k = 0; k < MainMap.Markers.Count;)
1829,14 → 1837,31
});
Dispatcher.Invoke(() => dgvWP.Items.Refresh());
Dispatcher.Invoke(() => _iWPIndex = data[1]);
wpList.Add(new PointLatLng((double)dr[3], (double)dr[4]));
if (data[1] == data[0])
{
_bGetWP = false;
Dispatcher.Invoke(() => dgvWP.Items.Refresh());
 
Dispatcher.Invoke(() =>
{
if (comboBoxRouteColor.SelectionBoxItem != null)
{
string s = comboBoxRouteColor.SelectionBoxItem.ToString();
mRouteWP = new GMapRoute(wpList, _getBrush(s));
}
else
mRouteWP = new GMapRoute(wpList, null);
 
if (_bShowWPRoute)
MainMap.Markers.Add(mRouteWP);
});
MapRoute mr = new MapRoute(wpList, "WPList");
Dispatcher.Invoke(() => lblWPRouteDistance.Content = (mr.Distance / 1000).ToString("0 m"));
}
 
}
}
else
{
Dispatcher.Invoke(() => lblWPIndex.Content = 0);
2527,6 → 2552,10
if(sVal != "") comboBoxFSColor.SelectedIndex = Convert.ToInt32(sVal);
sVal = ini.IniReadValue("waypoints", "coptercolor");
if(sVal != "") comboBoxCopterColor.SelectedIndex = Convert.ToInt32(sVal);
sVal = ini.IniReadValue("waypoints", "routecolor");
if(sVal != "") comboBoxRouteColor.SelectedIndex = Convert.ToInt32(sVal);
sVal = ini.IniReadValue("waypoints", "showWPRoute");
if(sVal != "") _bShowWPRoute = Convert.ToBoolean(sVal);
}
catch (Exception e)
{
2611,6 → 2640,8
ini.IniWriteValue("waypoints", "poicolor", comboBoxPOIColor.SelectedIndex.ToString());
ini.IniWriteValue("waypoints", "fscolor", comboBoxFSColor.SelectedIndex.ToString());
ini.IniWriteValue("waypoints", "coptercolor", comboBoxCopterColor.SelectedIndex.ToString());
ini.IniWriteValue("waypoints", "routecolor", comboBoxRouteColor.SelectedIndex.ToString());
ini.IniWriteValue("waypoints", "showWPRoute", _bShowWPRoute.ToString());
}
catch (Exception e)
{
2662,6 → 2693,11
// k++;
//}
_clearMapMarkers(typeof(CustomMarkerWP));
wpList.Clear();
if (mRouteWP != null)
MainMap.Markers.Remove(mRouteWP);
Dispatcher.Invoke(() => lblWPRouteDistance.Content = "0 m");
 
for (int k = 1; k <= wpnum; k++)
{
DataRow dr = dtWaypoints.NewRow();
2731,8 → 2767,12
dtWaypoints.Rows.Add(dr);
GMapMarker wpMarker = new GMapMarker(new PointLatLng((double)o[3], (double)o[4]));
wpMarker.Shape = new CustomMarkerWP(this, wpMarker, (string)dr[2], (int)o[1]);
wpMarker.Offset = new System.Windows.Point(-11.5, -11.5);
wpMarker.ZIndex = 100;
_setMarkerColor(wpMarker, (int)o[1]);
MainMap.Markers.Add(wpMarker);
if((int)o[1] == 0)
wpList.Add(new PointLatLng((double)o[3], (double)o[4]));
 
Dispatcher.Invoke(() => lblWPIndex.Content = k.ToString());
Dispatcher.Invoke(() => lblWPCount.Content = k.ToString());
2739,9 → 2779,26
Dispatcher.Invoke(() => dgvWP.Items.Refresh());
Thread.Sleep(10);
}
Dispatcher.Invoke(() =>
{
if (comboBoxRouteColor.SelectionBoxItem != null)
{
string s = comboBoxRouteColor.SelectionBoxItem.ToString();
mRouteWP = new GMapRoute(wpList, _getBrush(s));
}
else
mRouteWP = new GMapRoute(wpList, null);
 
if (_bShowWPRoute)
MainMap.Markers.Add(mRouteWP);
});
 
MapRoute mr = new MapRoute(wpList, "WPList");
Dispatcher.Invoke(() => lblWPRouteDistance.Content = (mr.Distance * 1000).ToString("0 m"));
 
}
}
}
 
}
catch (Exception e)
2752,6 → 2809,24
 
}
}
Brush _getBrush(string color)
{
switch (color)
{
case "red":
return Brushes.Red;
case "green":
return Brushes.Lime;
case "blue":
return Brushes.Aqua;
case "pink":
return Brushes.Magenta;
case "yellow":
return Brushes.Yellow;
default:
return Brushes.Magenta;
}
}
void _setMarkerColor(GMapMarker wpMarker,int iType)
{
Dispatcher.Invoke(() =>
2868,7 → 2943,34
((CustomMarkerCopter)(copter.Shape)).setColor("red");
});
}
 
private void comboBoxRouteColor_DropDownClosed(object sender, EventArgs e)
{
Dispatcher.Invoke(() =>
{
if (comboBoxRouteColor.SelectionBoxItem != null)
{
string s = comboBoxRouteColor.SelectionBoxItem.ToString();
MainMap.Markers.Remove(mRouteWP);
mRouteWP = new GMapRoute(wpList, _getBrush(s));
if (_bShowWPRoute)
MainMap.Markers.Add(mRouteWP);
}
});
}
private void checkBoxShowWPRoute_Click(object sender, RoutedEventArgs e)
{
_bShowWPRoute = (bool)checkBoxShowWPRoute.IsChecked;
if (_bShowWPRoute)
{
if (mRouteWP != null)
MainMap.Markers.Add(mRouteWP);
}
else
{
if (mRouteWP != null)
MainMap.Markers.Remove(mRouteWP);
}
}
private void btnLoadWPLFile_Click(object sender, RoutedEventArgs e)
{
_readWPLFile();
3021,9 → 3123,19
// k++;
//}
MapRoute mr = new MapRoute(wpl, "flying");
Dispatcher.Invoke(() =>
{
GMapRoute mRoute;
if (comboBoxRouteColor.SelectionBoxItem != null)
{
string s = comboBoxRouteColor.SelectionBoxItem.ToString();
mRoute = new GMapRoute(wpList, _getBrush(s));
}
else
mRoute = new GMapRoute(wpList, null);
 
GMapRoute mRoute = new GMapRoute(mr.Points);
MainMap.Markers.Add(mRoute);
});
}
 
}