/MKLiveView/v1.0/Source/MKLiveView.csproj |
---|
58,6 → 58,7 |
<ApplicationIcon>MK.ico</ApplicationIcon> |
</PropertyGroup> |
<ItemGroup> |
<Reference Include="Microsoft.Expression.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> |
<Reference Include="Microsoft.Windows.Shell, Version=3.5.41019.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> |
<Reference Include="System" /> |
<Reference Include="System.Data" /> |
87,6 → 88,9 |
<Compile Include="ArtificialHorizon\ArtificialHorizon.xaml.cs"> |
<DependentUpon>ArtificialHorizon.xaml</DependentUpon> |
</Compile> |
<Compile Include="GMapCustomMarkers\Circle.xaml.cs"> |
<DependentUpon>Circle.xaml</DependentUpon> |
</Compile> |
<Compile Include="GMapCustomMarkers\CustomMarkerHome.xaml.cs"> |
<DependentUpon>CustomMarkerHome.xaml</DependentUpon> |
</Compile> |
105,6 → 109,10 |
<SubType>Designer</SubType> |
<Generator>MSBuild:Compile</Generator> |
</Page> |
<Page Include="GMapCustomMarkers\Circle.xaml"> |
<Generator>MSBuild:Compile</Generator> |
<SubType>Designer</SubType> |
</Page> |
<Page Include="GMapCustomMarkers\CustomMarkerHome.xaml"> |
<Generator>MSBuild:Compile</Generator> |
<SubType>Designer</SubType> |
170,18 → 178,9 |
<Resource Include="MK.ico" /> |
</ItemGroup> |
<ItemGroup> |
<Resource Include="GMapCustomMarkers\copter.png" /> |
</ItemGroup> |
<ItemGroup> |
<Resource Include="GMapCustomMarkers\Copter_Shadow.png" /> |
</ItemGroup> |
<ItemGroup> |
<Resource Include="GMapCustomMarkers\home.png" /> |
</ItemGroup> |
<ItemGroup> |
<Resource Include="GMapCustomMarkers\CopterRed.png" /> |
</ItemGroup> |
<ItemGroup> |
<Resource Include="ArtificialHorizon\horizon.png" /> |
<Resource Include="ArtificialHorizon\wings.png" /> |
</ItemGroup> |
320,12 → 319,6 |
<Resource Include="Images\LoadFile.png" /> |
</ItemGroup> |
<ItemGroup> |
<Resource Include="GMapCustomMarkers\CopterBlue.png" /> |
<Resource Include="GMapCustomMarkers\CopterGreen.png" /> |
<Resource Include="GMapCustomMarkers\CopterPink.png" /> |
<Resource Include="GMapCustomMarkers\CopterYellow.png" /> |
</ItemGroup> |
<ItemGroup> |
<Resource Include="Images\DeleteList.png" /> |
</ItemGroup> |
<ItemGroup> |
355,15 → 348,6 |
<SplashScreen Include="Images\Logo.png" /> |
</ItemGroup> |
<ItemGroup> |
<Resource Include="GMapCustomMarkers\CopterHeadingPink.png" /> |
</ItemGroup> |
<ItemGroup> |
<Resource Include="GMapCustomMarkers\CopterHeadingBlue.png" /> |
<Resource Include="GMapCustomMarkers\CopterHeadingGreen.png" /> |
<Resource Include="GMapCustomMarkers\CopterHeadingRed.png" /> |
<Resource Include="GMapCustomMarkers\CopterHeadingYellow.png" /> |
</ItemGroup> |
<ItemGroup> |
<Resource Include="Images\SendToCopter.png" /> |
</ItemGroup> |
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
/MKLiveView/v1.0/Source/MainWindow.xaml |
---|
594,7 → 594,7 |
</Label.Style> |
</Label> |
</Grid> |
<Grid x:Name="GridData" Background="#7F000000" HorizontalAlignment="Left" Width="204" Margin="23,36,0,0" Visibility="Collapsed" > |
<Grid x:Name="GridData" Background="#7F000000" HorizontalAlignment="Left" Width="204" Margin="23,36,0,0" > |
<TabControl x:Name="tabControl" HorizontalAlignment="Left" Height="619" VerticalAlignment="Top" Width="200" Background="{x:Null}" Margin="2,0,0,0"> |
<TabItem Header="Analog"> |
<Grid> |
642,12 → 642,14 |
<TextBox x:Name="tbI2C" Margin="78,0,35,41.04" TextWrapping="Wrap" Text="0" Padding="-9,0,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderBrush="{x:Null}" SelectionBrush="{x:Null}" Foreground="White" Background="{x:Null}" Height="21" VerticalAlignment="Bottom"/> |
<Label x:Name="label6_Copy18" Content="NC-Error" Margin="14,0,68,56.04" Background="{x:Null}" Foreground="White" Height="26" VerticalAlignment="Bottom"/> |
<TextBox x:Name="tbNCErr" Margin="78,0,35,57.04" TextWrapping="Wrap" Text="0" Padding="-9,0,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderBrush="{x:Null}" SelectionBrush="{x:Null}" Foreground="White" Background="{x:Null}" Height="21" VerticalAlignment="Bottom"/> |
<TextBlock x:Name="tbNCGrSpeed" HorizontalAlignment="Left" Height="23" Margin="110,376,0,0" TextWrapping="Wrap" Text="NA" VerticalAlignment="Top" Width="65" Foreground="White" FontSize="16"/> |
<Label x:Name="label6_Copy21" Content="Gr. speed (NC)" HorizontalAlignment="Left" Margin="6,372,0,0" VerticalAlignment="Top" Background="{x:Null}" Foreground="White" FontSize="14"/> |
<TextBlock x:Name="tbHeadingCompass" HorizontalAlignment="Left" Height="23" Margin="110,395,0,0" TextWrapping="Wrap" Text="NA" VerticalAlignment="Top" Width="65" Foreground="White" FontSize="16"/> |
<Label x:Name="label6_Copy22" Content="Heading (NC)" HorizontalAlignment="Left" Margin="6,391,0,0" VerticalAlignment="Top" Background="{x:Null}" Foreground="White" FontSize="14"/> |
<TextBlock x:Name="tbHeadingNorth" HorizontalAlignment="Left" Height="23" Margin="110,413,0,0" TextWrapping="Wrap" Text="NA" VerticalAlignment="Top" Width="65" Foreground="White" FontSize="16"/> |
<Label x:Name="label6_Copy23" Content="Heading north" HorizontalAlignment="Left" Margin="6,409,0,0" VerticalAlignment="Top" Background="{x:Null}" Foreground="White" FontSize="14"/> |
<TextBlock x:Name="tbNCGrSpeed" HorizontalAlignment="Left" Height="23" Margin="110,396,0,0" TextWrapping="Wrap" Text="NA" VerticalAlignment="Top" Width="65" Foreground="White" FontSize="16"/> |
<Label x:Name="label6_Copy21" Content="Gr. speed (NC)" HorizontalAlignment="Left" Margin="6,392,0,0" VerticalAlignment="Top" Background="{x:Null}" Foreground="White" FontSize="14"/> |
<TextBlock x:Name="tbHeadingCompass" HorizontalAlignment="Left" Height="23" Margin="110,415,0,0" TextWrapping="Wrap" Text="NA" VerticalAlignment="Top" Width="65" Foreground="White" FontSize="16"/> |
<Label x:Name="label6_Copy22" Content="Heading (NC)" HorizontalAlignment="Left" Margin="6,411,0,0" VerticalAlignment="Top" Background="{x:Null}" Foreground="White" FontSize="14"/> |
<TextBlock x:Name="tbHeadingNorth" HorizontalAlignment="Left" Height="23" Margin="110,433,0,0" TextWrapping="Wrap" Text="NA" VerticalAlignment="Top" Width="65" Foreground="White" FontSize="16"/> |
<Label x:Name="label6_Copy23" Content="Heading north" HorizontalAlignment="Left" Margin="6,429,0,0" VerticalAlignment="Top" Background="{x:Null}" Foreground="White" FontSize="14"/> |
<TextBlock x:Name="tbWPMaxRange" HorizontalAlignment="Left" Height="23" Margin="110,370,0,0" TextWrapping="Wrap" Text="NA" VerticalAlignment="Top" Width="65" Foreground="White" FontSize="16"/> |
<Label x:Name="label6_Copy24" Content="WP max range" HorizontalAlignment="Left" Margin="6,366,0,0" VerticalAlignment="Top" Background="{x:Null}" Foreground="White" FontSize="14"/> |
</Grid> |
</TabItem> |
838,7 → 840,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="4,0,0,0"> |
<TabItem Header="General" Margin="0,0,5.849,0"> |
<Grid x:Name="TabGridGeneral"> |
1476,7 → 1478,7 |
<DataGridTextColumn Header="Out1Timer" Binding="{Binding Out1Timer}"/> |
</DataGrid.Columns> |
</DataGrid> |
<CheckBox x:Name="checkBoxShowWPRoute" Content="show route" HorizontalAlignment="Right" Height="22" Margin="0,405,4,0" VerticalAlignment="Top" Width="99" Foreground="#FFFFFEFE" Click="checkBoxShowWPRoute_Click"/> |
<CheckBox x:Name="checkBoxShowWPRoute" Content="show route" HorizontalAlignment="Right" Height="22" Margin="0,396,0,0" VerticalAlignment="Top" Width="110" Foreground="#FFFFFEFE" Click="checkBoxShowWPRoute_Click"/> |
<Label x:Name="label4_Copy9" Content="total distance" HorizontalAlignment="Right" Margin="0,455,51,0" VerticalAlignment="Top" Width="99" Foreground="White" Padding="0" Height="18" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" FontSize="13"/> |
<Label x:Name="lblWPRouteDistance" Content="0 m" HorizontalAlignment="Right" Margin="0,455,4,0" VerticalAlignment="Top" Width="42" Foreground="White" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" Padding="0" FontSize="13"/> |
<Label x:Name="label4_Copy14" Content="/" HorizontalAlignment="Right" Margin="0,504,29,0" VerticalAlignment="Top" Width="7" Foreground="White" Height="20" HorizontalContentAlignment="Right" Padding="0" VerticalContentAlignment="Center" FontSize="13"/> |
1531,7 → 1533,8 |
<Label x:Name="lblWPRouteDistanceWP" Content="0 m" HorizontalAlignment="Right" Margin="0,472,4,0" VerticalAlignment="Top" Width="42" Foreground="White" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" Padding="0" FontSize="13"/> |
<Label x:Name="label4_Copy36" Content="hold time" HorizontalAlignment="Right" Margin="0,487,51,0" VerticalAlignment="Top" Width="118" Foreground="White" Height="21" HorizontalContentAlignment="Right" Padding="0" VerticalContentAlignment="Center" FontSize="13"/> |
<Label x:Name="lblWPHoldTime" Content="0 s" HorizontalAlignment="Right" Margin="0,489,10,0" VerticalAlignment="Top" Width="36" Foreground="White" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" Padding="0" FontSize="13"/> |
<CheckBox x:Name="checkBoxShowWPStatus" Content="show statusbar" HorizontalAlignment="Right" Height="22" Margin="0,428,4,0" VerticalAlignment="Top" Width="100" Foreground="#FFFFFEFE" Click="checkBoxShowWPStatus_Click"/> |
<CheckBox x:Name="checkBoxShowWPStatus" Content="show statusbar" HorizontalAlignment="Right" Height="22" Margin="0,414,-1,0" VerticalAlignment="Top" Width="111" Foreground="#FFFFFEFE" Click="checkBoxShowWPStatus_Click"/> |
<CheckBox x:Name="checkBoxShowWPMaxRange" Content="show max range" HorizontalAlignment="Right" Height="22" Margin="0,433,-1,0" VerticalAlignment="Top" Width="111" Foreground="#FFFFFEFE" Click="checkBoxShowWPMaxRange_click"/> |
</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 |
---|
38,6 → 38,8 |
public partial class MainWindow : Window |
{ |
#region declarations |
object lockObj = new Object(); |
MediaPlayer.MediaPlayer mediaPlayer = new MediaPlayer.MediaPlayer(); |
GMapMarker copter; |
GMapMarker home; |
47,6 → 49,9 |
GMapRoute mRouteWP; |
GMapMarker wpActiveMarker; |
List<PointLatLng> wpList = new List<PointLatLng>(); |
Circle cWPBound = new Circle(); |
double dWPMaxRange = 0; |
#region NC-Errors |
String[] NC_Error = new string[44] |
{ |
739,7 → 744,7 |
((CustomMarkerCopter)(copter.Shape)).setHeadingColor(s); |
} |
}); |
copter.Offset = new System.Windows.Point(-28, -28); |
copter.Offset = new System.Windows.Point(-26, -26); |
copter.ZIndex = int.MaxValue; |
MainMap.Markers.Add(copter); |
copter.Position = MainMap.Position; |
751,12 → 756,21 |
{ |
home = new GMapMarker(MainMap.Position); |
home.Shape = new CustomMarkerHome(this, home, MainMap.Position.Lat.ToString("0.#######°") + System.Environment.NewLine + MainMap.Position.Lng.ToString("0.#######°")); |
home.Offset = new System.Windows.Point(-18, -18); |
home.Offset = new System.Windows.Point(-16.5, -16.5); |
// home.ZIndex = int.MaxValue; |
MainMap.Markers.Add(home); |
} |
home.Position = MainMap.Position; |
((CustomMarkerHome)(home.Shape)).setText(MainMap.Position.Lat.ToString("0.#######°") + System.Environment.NewLine + MainMap.Position.Lng.ToString("0.#######°")); |
if (checkBoxShowWPMaxRange.IsChecked == true) |
{ |
if (cWPBound != null && cWPBound.Tag != null) |
MainMap.Markers.Remove(cWPBound.Tag as GMapMarker); |
createCircle(home.Position, dWPMaxRange); |
} |
} |
void _setActiveWP(int iIndex) |
{ |
778,6 → 792,8 |
void _clearHomePos() |
{ |
MainMap.Markers.Remove(home); |
if (cWPBound != null && cWPBound.Tag != null) |
MainMap.Markers.Remove(cWPBound.Tag as GMapMarker); |
} |
void _clearMapMarkers(Type markerType) |
{ |
832,6 → 848,36 |
p.Position = point; |
} |
void createCircle(PointLatLng center, double distance) |
{ |
GMapMarker it = new GMapMarker(center); |
it.ZIndex = -1; |
cWPBound.Center = center; |
cWPBound.Bound = GMap.NET.PureProjection.GetPointFromDistance(center, distance); |
cWPBound.Tag = it; |
cWPBound.IsHitTestVisible = false; |
UpdateCircle(cWPBound); |
it.Shape = cWPBound; |
MainMap.Markers.Add(it); |
} |
// calculates circle radius |
void UpdateCircle(Circle c) |
{ |
var pxCenter = MainMap.FromLatLngToLocal(c.Center); |
var pxBounds = MainMap.FromLatLngToLocal(c.Bound); |
double a = (double)(pxBounds.X - pxCenter.X); |
double b = (double)(pxBounds.Y - pxCenter.Y); |
var pxCircleRadius = Math.Sqrt(a * a + b * b); |
c.Width = c.Height = pxCircleRadius * 2; |
//c.Width = 55 + pxCircleRadius * 2; |
//c.Height = 55 + pxCircleRadius * 2; |
(c.Tag as GMapMarker).Offset = new System.Windows.Point(-c.Width / 2, -c.Height / 2); |
} |
// access mode |
private void comboBoxMode_DropDownClosed(object sender, EventArgs e) |
{ |
935,6 → 981,8 |
_setCopterData(MainMap.Position); |
if((int)sliderMapZoom.Value != MainMap.Zoom) |
sliderMapZoom.Value = MainMap.Zoom; |
if(cWPBound != null && cWPBound.Tag != null) |
UpdateCircle(cWPBound); |
} |
void _setCopterData(PointLatLng p) |
1819,10 → 1867,10 |
} |
if (_bVoiceSatFixPlay && !_bVoiceSatFixActive) |
{ |
_bVoiceSatFixActive = true; |
ThreadPool.QueueUserWorkItem(new WaitCallback(_mediaPlayer), "Voice\\SatFixLost.mp3"); |
//Thread th = new Thread(() => _mediaPlayer("Voice\\SatFixLost.mp3")); |
//th.Start(); |
_bVoiceSatFixActive = true; |
} |
_bSatFix = false; |
1961,15 → 2009,28 |
} |
if (_bVoiceRCLevelPlay && !_bVoiceRCLevelActive) |
{ |
_bVoiceRCLevelActive = true; |
ThreadPool.QueueUserWorkItem(new WaitCallback(_mediaPlayer), "Voice\\MagneticField.mp3"); |
//Thread th = new Thread(() => _mediaPlayer("Voice\\RCLevel.mp3")); |
//th.Start(); |
_bVoiceRCLevelActive = true; |
} |
_iRCLevelJitter++; |
} |
} |
//Waypoint max range (by license) |
if(dWPMaxRange != (double)data[70]) |
{ |
dWPMaxRange = (double)data[70]; |
if (home != null && checkBoxShowWPMaxRange.IsChecked == true) |
{ |
if (cWPBound != null && cWPBound.Tag != null) |
MainMap.Markers.Remove(cWPBound.Tag as GMapMarker); |
createCircle(home.Position, dWPMaxRange); |
} |
Dispatcher.Invoke((Action)(() => tbWPMaxRange.Text = data[70].ToString() + " m")); |
} |
//Target hold time |
Dispatcher.Invoke((Action)(() => lblWPHoldTime.Content = data[73].ToString()+ " s")); |
Dispatcher.Invoke((Action)(() => tbWPStatusHoldTime.Text = data[73].ToString()+ " s")); |
2594,12 → 2655,21 |
void _mediaPlayer(object file) |
{ |
if (File.Exists((string)file)) |
Monitor.TryEnter(lockObj); |
try |
{ |
MediaPlayer.MediaPlayer mp = new MediaPlayer.MediaPlayer(); |
mp.Open((string)file); |
mp.Play(); |
if (File.Exists((string)file)) |
{ |
mediaPlayer.Open((string)file); |
mediaPlayer.Play(); |
} |
} |
finally |
{ |
Monitor.Exit(lockObj); |
} |
} |
#region ui |
4233,7 → 4303,25 |
_dgvWPselectEditRow(); |
}); |
} |
private void checkBoxShowWPStatus_Click(object sender, RoutedEventArgs e) |
{ |
if (WPStatus.Visibility == Visibility.Visible) |
GridOSD.Margin = new Thickness(GridOSD.Margin.Left, 36 * UIScaleTopSlider.Value + 36, GridOSD.Margin.Right, GridOSD.Margin.Bottom); |
else |
GridOSD.Margin = new Thickness(GridOSD.Margin.Left, 36 * UIScaleTopSlider.Value, GridOSD.Margin.Right, GridOSD.Margin.Bottom); |
} |
private void checkBoxShowWPMaxRange_click(object sender, RoutedEventArgs e) |
{ |
if (home != null && checkBoxShowWPMaxRange.IsChecked == true && dWPMaxRange > 0) |
{ |
if (cWPBound != null && cWPBound.Tag != null) |
MainMap.Markers.Remove(cWPBound.Tag as GMapMarker); |
createCircle(home.Position, dWPMaxRange); |
} |
if (checkBoxShowWPMaxRange.IsChecked == false && (cWPBound != null && cWPBound.Tag != null)) |
MainMap.Markers.Remove(cWPBound.Tag as GMapMarker); |
} |
#endregion WP |
#region GPX |
private void checkBoxGPXLog_Click(object sender, RoutedEventArgs e) |
4304,13 → 4392,6 |
} |
} |
private void checkBoxShowWPStatus_Click(object sender, RoutedEventArgs e) |
{ |
if (WPStatus.Visibility == Visibility.Visible) |
GridOSD.Margin = new Thickness(GridOSD.Margin.Left, 36 * UIScaleTopSlider.Value + 36, GridOSD.Margin.Right, GridOSD.Margin.Bottom); |
else |
GridOSD.Margin = new Thickness(GridOSD.Margin.Left, 36 * UIScaleTopSlider.Value, GridOSD.Margin.Right, GridOSD.Margin.Bottom); |
} |
private void btnLoadGPXLog_Click(object sender, RoutedEventArgs e) |
{ |