Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 2346 → Rev 2347

/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,7 → 970,7
<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">
<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"/>
/MKLiveView/v1.0/Source/MainWindow.xaml.cs
543,11 → 543,11
}
private void btnSetHP_Click(object sender, RoutedEventArgs e)
{
setHomePos();
_setHomePos();
}
private void btnClearHP_Click(object sender, RoutedEventArgs e)
{
clearHomePos();
_clearHomePos();
}
private void btnGotoHP_Click(object sender, RoutedEventArgs e)
{
682,7 → 682,7
MainMap.Markers.Add(copter);
copter.Position = MainMap.Position;
}
void setHomePos()
void _setHomePos()
{
pHome = MainMap.Position;
if (!MainMap.Markers.Contains(home))
696,8 → 696,24
home.Position = MainMap.Position;
((CustomMarkerHome)(home.Shape)).setText(MainMap.Position.Lat.ToString("0.#######°") + System.Environment.NewLine + MainMap.Position.Lng.ToString("0.#######°"));
}
void clearHomePos()
void _setActiveWP(int iIndex)
{
if (wpActiveMarker == null || !MainMap.Markers.Contains(wpActiveMarker))
{
Dispatcher.Invoke(() =>
{
wpActiveMarker = new GMapMarker(wpList[iIndex]);
wpActiveMarker.Shape = new CustomMarkerWPActive(this, wpActiveMarker, "wpActive", 0);
wpActiveMarker.Offset = new Point(-17.5, -17.5);
MainMap.Markers.Add(wpActiveMarker);
});
}
else
Dispatcher.Invoke(() => wpActiveMarker.Position = wpList[iIndex]);
 
}
void _clearHomePos()
{
MainMap.Markers.Remove(home);
}
void _clearMapMarkers(Type markerType)
1629,7 → 1645,7
else
{
_bFirstSatFix = true;
Dispatcher.Invoke(() => setHomePos());
Dispatcher.Invoke(() => _setHomePos());
}
}
if (stbSatFixLostAnim != null && _bAnimSatFixActive)
1695,16 → 1711,17
Dispatcher.Invoke((Action)(() => tbHP.Text = ((double)iVal / (double)10).ToString("0.0 m"))); //Distance to HP set by GPS on
 
Dispatcher.Invoke((Action)(() => tbWPIndex.Text = data[48].ToString())); //Waypoint index
if(_wpIndex != data[48] && wpList.Count > 0)
if(data[48] > 0 && _wpIndex != data[48] -1 && wpList.Count > 0)
{
if (wpActiveMarker != null)
MainMap.Markers.Remove((GMapMarker)wpActiveMarker);
wpActiveMarker = new GMapMarker(wpList[data[48]]);
wpActiveMarker.Shape = new CustomMarkerWPActive(this, wpActiveMarker, "wpActive",0);
MainMap.Markers.Add(wpActiveMarker);
_setActiveWP(data[48]-1);
_wpIndex = data[48]-1;
}
else
{
if ((data[48] == 0 || wpList.Count == 0) & MainMap.Markers.Contains(wpActiveMarker))
Dispatcher.Invoke(() => MainMap.Markers.Remove(wpActiveMarker));
}
 
_wpIndex = data[48];
if(wpList.Count > 0 && ((data[67] & 2) == 2))
{
// Dispatcher.Invoke(() =>
3080,11 → 3097,12
private void btnClearWPList_Click(object sender, RoutedEventArgs e)
{
_clearMapMarkers(typeof(CustomMarkerWP));
_clearMapMarkers(typeof(CustomMarkerWPActive));
wpList.Clear();
if (mRouteWP != null)
MainMap.Markers.Remove(mRouteWP);
if (wpActiveMarker != null)
MainMap.Markers.Remove(wpActiveMarker);
//if (wpActiveMarker != null)
// MainMap.Markers.Remove(wpActiveMarker);
dtWaypoints.Rows.Clear();
Dispatcher.Invoke(() => dgvWP.Items.Refresh());
Dispatcher.Invoke(() => lblWPIndex.Content = 0);