Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 2323 → Rev 2324

/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" Visibility="Collapsed">
<Grid x:Name="GridSettings" Background="#7B000000" HorizontalAlignment="Left" Width="233" Margin="23,36,0,0">
<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">
796,8 → 796,8
</TabItem>
<TabItem Header="Map" Height="20" VerticalAlignment="Top" Margin="7.193,0,-17.257,0">
<Grid x:Name="GridMapData" Margin="0,0,-3,-1" HorizontalAlignment="Left" Width="226">
<CheckBox x:Name="checkBoxFollowCopter" Content="follow copter" HorizontalAlignment="Left" Margin="8,516,0,0" Width="107" RenderTransformOrigin="0.783,27.263" Foreground="White" Click="checkBoxFollowCopter_Click" FontSize="14" VerticalContentAlignment="Center" Height="20" VerticalAlignment="Top" ToolTip="the map follows the copter - the copter is always centered"/>
<CheckBox x:Name="checkBoxAutoSetHP" Content="auto set HP" HorizontalAlignment="Left" Margin="92,432,0,0" Width="107" RenderTransformOrigin="0.783,27.263" Foreground="White" FontSize="14" VerticalContentAlignment="Center" Height="20" VerticalAlignment="Top" ToolTip="set HP automatically with first satfix" Click="checkBoxAutoSetHP_Click"/>
<CheckBox x:Name="checkBoxFollowCopter" Content="follow copter" HorizontalAlignment="Left" Margin="7,533,0,0" Width="107" RenderTransformOrigin="0.783,27.263" Foreground="White" Click="checkBoxFollowCopter_Click" FontSize="14" VerticalContentAlignment="Center" Height="20" VerticalAlignment="Top" ToolTip="the map follows the copter - the copter is always centered"/>
<CheckBox x:Name="checkBoxAutoSetHP" Content="auto set HP" HorizontalAlignment="Left" Margin="92,422,0,0" Width="107" RenderTransformOrigin="0.783,27.263" Foreground="White" FontSize="14" VerticalContentAlignment="Center" Height="20" VerticalAlignment="Top" ToolTip="set HP automatically with first satfix" Click="checkBoxAutoSetHP_Click"/>
<TextBox Margin="6,24,10,0" x:Name="textBoxGeo" KeyUp="textBoxGeo_KeyUp" Foreground="Black" Height="22" VerticalAlignment="Top" VerticalContentAlignment="Center" Text="Landshut"/>
<Button x:Name="buttonGeoCoding" Content="Go To!" HorizontalAlignment="Left" Margin="6,47,0,0" VerticalAlignment="Top" Width="144" Height="26" Click="buttonGeoCoding_Click"/>
<Button Height="27" Margin="0,136,10,0" x:Name="buttonReloadMap" VerticalAlignment="Top" Click="ReloadMap_Click" HorizontalAlignment="Right" Width="71" Content="Reload"/>
814,17 → 814,35
<Label Height="32" HorizontalAlignment="Right" Margin="0,210,128,0" x:Name="label5" VerticalAlignment="Top" Width="91" Foreground="White" Content="Caching Mode"/>
<Button x:Name="buttonPrefetch" Content="Prefetch cache" HorizontalAlignment="Left" Margin="6,261,0,0" VerticalAlignment="Top" Width="144" Height="26" Click="buttonPrefetch_Click"/>
<Label HorizontalAlignment="Right" Margin="0,0,99,0" x:Name="label1_Copy" Width="120" Height="29" VerticalAlignment="Top" Foreground="White" Content="Geocoding location"/>
<TextBox Margin="6,373,36,0" x:Name="textBoxLat_currentPos" VerticalContentAlignment="Center" Height="23" VerticalAlignment="Top" />
<TextBox Margin="6,397,36,0" x:Name="textBoxLng_currentPos" VerticalContentAlignment="Center" Height="22" VerticalAlignment="Top" />
<Label Height="23" HorizontalAlignment="Right" Margin="0,373,4,0" x:Name="label2_Copy" VerticalAlignment="Top" Width="27" VerticalContentAlignment="Center" Foreground="White" Content="lat"/>
<Label Height="29" HorizontalAlignment="Right" Margin="0,394,4,0" x:Name="label3_Copy" VerticalAlignment="Top" VerticalContentAlignment="Center" Width="27" Foreground="White" Content="lng"/>
<Label HorizontalAlignment="Right" Margin="0,349,111,0" x:Name="label1_Copy1" Width="109" Foreground="White" Content="Current position" Height="28" VerticalAlignment="Top"/>
<TextBox Margin="6,368,36,0" x:Name="textBoxLat_currentPos" VerticalContentAlignment="Center" Height="23" VerticalAlignment="Top" />
<TextBox Margin="6,392,36,0" x:Name="textBoxLng_currentPos" VerticalContentAlignment="Center" Height="22" VerticalAlignment="Top" />
<Label Height="23" HorizontalAlignment="Right" Margin="0,368,4,0" x:Name="label2_Copy" VerticalAlignment="Top" Width="27" VerticalContentAlignment="Center" Foreground="White" Content="lat"/>
<Label Height="29" HorizontalAlignment="Right" Margin="0,389,4,0" x:Name="label3_Copy" VerticalAlignment="Top" VerticalContentAlignment="Center" Width="27" Foreground="White" Content="lng"/>
<Label HorizontalAlignment="Right" Margin="0,344,111,0" x:Name="label1_Copy1" Width="109" Foreground="White" Content="Current position" Height="28" VerticalAlignment="Top"/>
<Slider x:Name="sliderMapZoom" Style="{DynamicResource TouchSliderStyle}" HorizontalAlignment="Left" Margin="10,319,0,0" Width="206" Maximum="24" SmallChange="1" Value="0" IsSnapToTickEnabled="True" ValueChanged="sliderMapZoom_ValueChanged" Height="29" VerticalAlignment="Top"/>
<Label Height="23" HorizontalAlignment="Right" Margin="0,291,139,0" x:Name="label2_Copy1" VerticalAlignment="Top" Width="69" VerticalContentAlignment="Center" Foreground="White" Content="Zoomlevel"/>
<Label Height="23" HorizontalAlignment="Right" Margin="0,291,101,0" x:Name="labelZoom" VerticalAlignment="Top" Width="49" VerticalContentAlignment="Center" Foreground="White" Content="{Binding Value,ElementName=sliderMapZoom}" HorizontalContentAlignment="Center"/>
<Button x:Name="btnSetHP" Content="set Home" Margin="7,428,139,0" Click="btnSetHP_Click" Height="24" VerticalAlignment="Top"/>
<Button x:Name="btnClearHP" Content="clear Home" Margin="7,452,139,0" Click="btnClearHP_Click" Height="25" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.6"/>
<Button x:Name="btnGotoHP" Content="goto Home" Margin="7,477,139,0" Click="btnGotoHP_Click" Height="24" VerticalAlignment="Top"/>
<Button x:Name="btnSetHP" Content="set Home" Margin="7,420,139,0" Click="btnSetHP_Click" Height="24" VerticalAlignment="Top"/>
<Button x:Name="btnClearHP" Content="clear Home" Margin="7,444,139,0" Click="btnClearHP_Click" Height="25" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.6"/>
<Button x:Name="btnGotoHP" Content="goto Home" Margin="92,444,54,0" Click="btnGotoHP_Click" Height="25" VerticalAlignment="Top"/>
<CheckBox x:Name="checkBoxGPXLog" Content="GPX-Log" HorizontalAlignment="Left" Margin="8,487,0,0" Width="107" RenderTransformOrigin="0.783,27.263" Foreground="White" FontSize="14" VerticalContentAlignment="Center" Height="20" VerticalAlignment="Top" ToolTip="the map follows the copter - the copter is always centered" Click="checkBoxGPXLog_Click"/>
<Rectangle HorizontalAlignment="Left" Width="72" Stroke="#FFE4E4E4" StrokeThickness="0.5" Margin="128,477,0,0" Height="39" VerticalAlignment="Top">
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, ElementName=btnLoadGPXLog}" Value="True">
<Setter Property="Fill" Value="{DynamicResource PressedItemBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
<Button x:Name="btnLoadGPXLog" Content="" HorizontalAlignment="Left" Margin="131,478,0,0" Width="67" ToolTip="load GPX-log from file" BorderBrush="#FFBDBDBD" HorizontalContentAlignment="Center" Style="{DynamicResource ButtonWithoutEffectStyle}" Click="btnLoadGPXLog_Click" Height="36" VerticalAlignment="Top">
<Button.Background>
<ImageBrush ImageSource="Images/LoadFile.png" Stretch="Uniform"/>
</Button.Background>
</Button>
<Label x:Name="label4_Copy8" Content="load GPX-Log" HorizontalAlignment="Left" Margin="122,511,0,0" VerticalAlignment="Top" Width="86" Foreground="White"/>
</Grid>
</TabItem>
<TabItem Header="Thresholds" Height="20" VerticalAlignment="Top" Margin="13,0,-13,0" HorizontalAlignment="Left" Width="70">
951,27 → 969,67
<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="472" VerticalAlignment="Top">
<Button x:Name="btnGetWPList" Content="" HorizontalAlignment="Left" Height="39" Margin="10,362,0,0" VerticalAlignment="Top" Width="78" Click="btnGetWP_Click" ToolTip="Download WP-list from copter" BorderBrush="#FFBDBDBD">
<Button.Background>
<ImageBrush ImageSource="Images/FromCopterToPc.png" Stretch="Uniform"/>
</Button.Background>
</Button>
<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"/>
<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"/>
<Button x:Name="btnSendWPList" Content="" HorizontalAlignment="Left" Height="39" Margin="96,362,0,0" VerticalAlignment="Top" Width="78" ToolTip="Upload WP-list to copter" BorderBrush="#FFBDBDBD" Click="btnSendWPList_Click">
<Button.Background>
<ImageBrush ImageSource="Images/FromPcToCopter.png" Stretch="Uniform"/>
</Button.Background>
</Button>
<Button x:Name="btnLoadWPLFile" Content="" HorizontalAlignment="Left" Height="43" Margin="10,419,0,0" VerticalAlignment="Top" Width="42" ToolTip="load wp-list from file" BorderBrush="#FFBDBDBD" HorizontalContentAlignment="Center" Click="btnLoadWPLFile_Click">
<Button.Background>
<ImageBrush ImageSource="Images/LoadFile.png" Stretch="Uniform"/>
</Button.Background>
</Button>
<DataGrid x:Name="dgvWP" Height="352" Margin="10,5,10,0" VerticalAlignment="Top" Background="{x:Null}" ItemsSource="{Binding dtWaypoints1}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="14" HorizontalGridLinesBrush="#FF688CAF" VerticalGridLinesBrush="#FF688CAF" HeadersVisibility="Column" BorderBrush="{x:Null}" Padding="0" AutoGenerateColumns="False">
<Border Margin="10,370,0,3" BorderBrush="White" BorderThickness="0.5" CornerRadius="5" HorizontalAlignment="Left" Width="214">
<Grid Margin="-0.5,-3.5,-0.5,4.5">
<Rectangle HorizontalAlignment="Left" Width="94" Stroke="#FFE4E4E4" StrokeThickness="0.5" Margin="103,25,0,61">
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, ElementName=btnGetWPList}" Value="True">
<Setter Property="Fill" Value="{DynamicResource PressedItemBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
<Button x:Name="btnGetWPList" Content="" HorizontalAlignment="Left" Height="39" Margin="103,0,0,61" VerticalAlignment="Bottom" Width="94" Click="btnGetWP_Click" ToolTip="Download WP-list from copter" BorderBrush="#FFBDBDBD" Style="{DynamicResource ButtonWithoutEffectStyle}">
<Button.Background>
<ImageBrush ImageSource="Images/FromCopterToPc.png" Stretch="Uniform"/>
</Button.Background>
</Button>
<Rectangle HorizontalAlignment="Left" Width="94" Stroke="#FFE4E4E4" StrokeThickness="0.5" Margin="4,25,0,61">
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, ElementName=btnSendWPList}" Value="True">
<Setter Property="Fill" Value="{DynamicResource PressedItemBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
<Button x:Name="btnSendWPList" Content="" HorizontalAlignment="Left" Height="39" Margin="4,0,0,61" VerticalAlignment="Bottom" Width="94" ToolTip="Upload WP-list to copter" BorderBrush="#FFBDBDBD" Click="btnSendWPList_Click" Style="{DynamicResource ButtonWithoutEffectStyle}">
<Button.Background>
<ImageBrush ImageSource="Images/FromPcToCopter.png" Stretch="Uniform"/>
</Button.Background>
</Button>
<Rectangle HorizontalAlignment="Left" Width="94" Stroke="#FFE4E4E4" StrokeThickness="0.5" Margin="4,86,0,0">
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, ElementName=btnLoadWPLFile}" Value="True">
<Setter Property="Fill" Value="{DynamicResource PressedItemBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
<Button x:Name="btnLoadWPLFile" Content="" HorizontalAlignment="Left" Height="39" Margin="4,0,0,0" VerticalAlignment="Bottom" Width="94" ToolTip="load wp-list from file" BorderBrush="#FFBDBDBD" HorizontalContentAlignment="Center" Click="btnLoadWPLFile_Click" Style="{DynamicResource ButtonWithoutEffectStyle}">
<Button.Background>
<ImageBrush ImageSource="Images/LoadFile.png" Stretch="Uniform"/>
</Button.Background>
</Button>
<Label x:Name="label4_Copy5" Content="receive from copter" HorizontalAlignment="Left" Margin="98,0,0,98" VerticalAlignment="Bottom" Width="116" Foreground="White"/>
<Label x:Name="label4_Copy6" Content="send to copter" HorizontalAlignment="Left" Margin="1,0,0,98" VerticalAlignment="Bottom" Width="86" Foreground="White"/>
<Label x:Name="label4_Copy7" Content="load from file" HorizontalAlignment="Left" Margin="0,0,0,36" VerticalAlignment="Bottom" Width="86" Foreground="White"/>
</Grid>
</Border>
<DataGrid x:Name="dgvWP" Margin="10,5,10,143" Background="{x:Null}" ItemsSource="{Binding dtWaypoints1}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="14" HorizontalGridLinesBrush="#FF688CAF" VerticalGridLinesBrush="#FF688CAF" HeadersVisibility="Column" BorderBrush="{x:Null}" Padding="0" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="Index" Binding="{Binding Path=Index}"/>
<DataGridTextColumn Header="Type" Binding="{Binding Path=Type, Converter={StaticResource wpConvert}, ConverterParameter= Type}"/>
989,38 → 1047,42
<DataGridTextColumn Header="Out1Timer" Binding="{Binding Path=Out1Timer}"/>
</DataGrid.Columns>
</DataGrid>
<ComboBox x:Name="comboBoxWPColor" Height="40" Margin="0,0,210,6" 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"/>
<ComboBoxItem Content="yellow"/>
<ComboBoxItem Content="pink"/>
</ComboBox>
<Label x:Name="label4_Copy1" Content="WP color" HorizontalAlignment="Right" Margin="0,0,223,46" VerticalAlignment="Bottom" Width="80" Foreground="White"/>
<ComboBox x:Name="comboBoxPOIColor" Margin="0,0,110,6" SelectedIndex="4" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="16" DropDownClosed="comboBoxPOIColor_DropDownClosed" HorizontalAlignment="Right" Width="95" Height="40" VerticalAlignment="Bottom">
<ComboBoxItem Content="red"/>
<ComboBoxItem Content="green"/>
<ComboBoxItem Content="blue"/>
<ComboBoxItem Content="yellow"/>
<ComboBoxItem Content="pink"/>
</ComboBox>
<Label x:Name="label4_Copy2" Content="POI color" HorizontalAlignment="Right" Margin="0,0,123,46" VerticalAlignment="Bottom" Width="80" Foreground="White"/>
<ComboBox x:Name="comboBoxFSColor" Height="40" Margin="0,0,10,6" VerticalAlignment="Bottom" SelectedIndex="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="16" DropDownClosed="comboBoxFSColor_DropDownClosed" HorizontalAlignment="Right" Width="95">
<ComboBoxItem Content="red"/>
<ComboBoxItem Content="green"/>
<ComboBoxItem Content="blue"/>
<ComboBoxItem Content="yellow"/>
<ComboBoxItem Content="pink"/>
</ComboBox>
<Label x:Name="label4_Copy3" Content="failsave color" HorizontalAlignment="Right" Margin="0,0,23,46" VerticalAlignment="Bottom" Width="80" Foreground="White"/>
<ComboBox x:Name="comboBoxCopterColor" Margin="0,0,315,6" SelectedIndex="4" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="16" HorizontalAlignment="Right" Width="95" Height="40" VerticalAlignment="Bottom" DropDownClosed="comboBoxCopterColor_DropDownClosed">
<ComboBoxItem Content="red"/>
<ComboBoxItem Content="green"/>
<ComboBoxItem Content="blue"/>
<ComboBoxItem Content="yellow"/>
<ComboBoxItem Content="pink"/>
</ComboBox>
<Label x:Name="label4_Copy4" Content="Copter color" HorizontalAlignment="Right" Margin="0,0,328,46" VerticalAlignment="Bottom" Width="80" Foreground="White"/>
<Border Margin="0,432,3,4" BorderBrush="White" BorderThickness="0.5" CornerRadius="5" HorizontalAlignment="Right" Width="421">
<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">
<ComboBoxItem Content="red"/>
<ComboBoxItem Content="green"/>
<ComboBoxItem Content="blue"/>
<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">
<ComboBoxItem Content="red"/>
<ComboBoxItem Content="green"/>
<ComboBoxItem Content="blue"/>
<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">
<ComboBoxItem Content="red"/>
<ComboBoxItem Content="green"/>
<ComboBoxItem Content="blue"/>
<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">
<ComboBoxItem Content="red"/>
<ComboBoxItem Content="green"/>
<ComboBoxItem Content="blue"/>
<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"/>
</Grid>
</Border>
</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">
1086,6 → 1148,7
</Style>
</TextBox.Resources>
</TextBox>
<TextBox x:Name="tbSideBarGPXLog" Height="19" Margin="1,0,0,4" Text="GPX" Width="21" Background="Transparent" Foreground="#FFD3D2D2" AllowDrop="False" BorderThickness="0.6" ToolTip="GPX-Log active" IsUndoEnabled="False" MaxLines="1" BorderBrush="#FFD3D2D2" UndoLimit="0" FontSize="10" VerticalAlignment="Bottom" HorizontalAlignment="Left" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Center" Padding="-1.5,0,0,0"/>
</Grid>
<!--<Rectangle x:Name="rctConnection" Fill="#FFF4F4F5" Height="16" Margin="0,10,7,0" Stroke="Black" VerticalAlignment="Top" HorizontalAlignment="Right" Width="15"/>-->
</Grid>
/MKLiveView/v1.0/Source/MainWindow.xaml.cs
27,6 → 27,8
using System.Windows.Shapes;
using System.Windows.Threading;
using System.Globalization;
using System.Xml;
using System.Xml.Linq;
 
namespace MKLiveView
{
43,7 → 45,7
PointLatLng end;
PointLatLng pHome;
 
 
#region NC-Errors
String[] NC_Error = new string[44]
{
"No Error",
91,7 → 93,7
"ACC not calibr." + Environment.NewLine + "http://wiki.mikrokopter.de/ErrorCodes#A42_.22ACC_not_calibr..22",
"ERR:Parachute!" + Environment.NewLine + "http://wiki.mikrokopter.de/ErrorCodes#A43_.22ERR:Parachute.21.22"
};
 
#endregion NC-Errors
[FlagsAttribute]
enum NC_HWError0 : short
{
146,6 → 148,7
bool _bErrorLog = false;
bool _bConnErr = false;
bool _bFollowCopter = false;
bool _bGPXLog = false;
 
bool _bSaveWinStateNormal = true;
bool _bSaveWinStateFull = true;
233,6 → 236,7
 
string[] sAnalogLabel = new string[32];
string[] sAnalogData = new string[32];
int[] iAnalogData = new int[32];
 
int[] iTimings = new int[] {100,150,200,250,300,350,400,450,500,550,600,650,700,750,800,850,900,950,1000,1100,1200,1300,1400,1500,1600,1700,1800,1900,2000 };
int[] iMotors = new int[] {3,4,5,6,7,8,9,10,11,12 };
268,7 → 272,9
int _iWPTimeout = 1000;
bool _bGetWP = false;
static volatile bool _bGetWPCount = false;
 
DataTable dtGPX = new DataTable();
DataRow drGPX;
bool _bAirborne = false;
DispatcherTimer timer = new DispatcherTimer();
 
/// <summary>
341,8 → 347,8
cBoxTimingsOSD.SelectedItem = OSDInterval * 10;
checkBoxAutoSetHP.IsChecked = _bAutoHome;
checkBoxFollowCopter.IsChecked = _bFollowCopter;
checkBoxGPXLog.IsChecked = _bGPXLog;
 
 
}
/// <summary>
/// initialize the datatables
388,6 → 394,13
dgvWP.ColumnHeaderStyle = new Style();
dgvWP.ColumnHeaderStyle = style;
 
dtGPX.Columns.Add("Index",typeof(int));
dtGPX.Columns.Add("Latitude",typeof(double));
dtGPX.Columns.Add("Longitude",typeof(double));
dtGPX.Columns.Add("Elevation",typeof(int));
dtGPX.Columns.Add("Time",typeof(string));
dtGPX.PrimaryKey = new DataColumn[] { dtGPX.Columns["Index"] };
drGPX = dtGPX.NewRow();
 
}
/// <summary>
426,6 → 439,7
Dispatcher.Invoke(() => imageWiFi.Source = new BitmapImage(new Uri("Images/WiFi_W.png", UriKind.Relative)));
_readCont(false);
}
bool _bToggle = false;
void timerEvent(object sender, EventArgs e)
{
if (bReadContinously)
450,6 → 464,15
// Dispatcher.Invoke((Action)(() => rctConnection.Fill = Brushes.LightGreen));
_iLifeCounter = 0;
_bConnErr = false;
// if(_bAirborne && _bGPXLog)
{
drGPX[0] = dtGPX.Rows.Count;
dtGPX.Rows.Add(new object[] { drGPX[0], drGPX[1], drGPX[2], drGPX[3], drGPX[4] });
}
Dispatcher.Invoke((Action)(() => tbSideBarGPXLog.Background = (_bGPXLog && _bToggle) ? new SolidColorBrush(Colors.LightSeaGreen) : new SolidColorBrush(Colors.Transparent)));
Dispatcher.Invoke((Action)(() => tbSideBarGPXLog.Foreground = (_bGPXLog) ? new SolidColorBrush(Colors.White) : new SolidColorBrush(Color.FromArgb(255, 211, 210, 210))));
Dispatcher.Invoke((Action)(() => tbSideBarGPXLog.BorderBrush = (_bGPXLog) ? new SolidColorBrush(Colors.White) : new SolidColorBrush(Color.FromArgb(255, 211, 210, 210))));
_bToggle = !_bToggle;
}
else
{
595,6 → 618,8
private void Window_Closing(object sender, CancelEventArgs e)
{
_writeIni();
if(_bGPXLog && dtGPX.Rows.Count > 0)
_saveGPXLog();
}
#endregion events
 
1273,7 → 1298,7
{
if (data.Length == 66)
{
int[] iAnalogData = new int[32];
double v;
int index = 0;
Int16 i16 = 0;
1301,6 → 1326,7
case 4: //altitude
Dispatcher.Invoke(() => tbAlt.Text = ((double)iAnalogData[index] / (double)10).ToString("0.0 m"));
Dispatcher.Invoke(() => tbTopHeight.Text = ((double)iAnalogData[index] / (double)10).ToString("0.0 m"));
Dispatcher.Invoke(() => { drGPX[3] = (double)iAnalogData[index] / (double)10; });
break;
case 7: //Voltage
v = (double)iAnalogData[index] / (double)10;
1556,7 → 1582,8
iVal += i_32 << 8;
iVal += data[1];
d = (double)iVal / Math.Pow(10, 7);
Dispatcher.Invoke(() => { drGPX[2] = d; });
 
PointLatLng p = new PointLatLng();
 
p.Lng = d;
1571,6 → 1598,8
iVal += i_32 << 8;
iVal += data[5];
d = (double)iVal / Math.Pow(10, 7);
Dispatcher.Invoke(() => { drGPX[1] = d; });
Dispatcher.Invoke(() => { drGPX[4] = DateTime.UtcNow.ToString("u", System.Globalization.CultureInfo.InvariantCulture); }); //2011-01-14T01:59:01Z });
p.Lat = d;
if (data[50] > 4)//if more than 4 sats in use . otherwise the map would jump and scroll insane at beginning
{
1758,6 → 1787,7
Dispatcher.Invoke((Action)(() => tbSideBarStatusPH.Foreground = (((data[68] & 2) == 2)|((data[68] & 4) == 4)) ? new SolidColorBrush(Colors.White) : new SolidColorBrush(Color.FromArgb(255, 211, 210, 210))));// NC_FLAG_PH 0x02 / NC_FLAG_CH 0x04
Dispatcher.Invoke((Action)(() => tbSideBarStatusPH.BorderBrush = (((data[68] & 2) == 2)|((data[68] & 4) == 4)) ? new SolidColorBrush(Colors.White) : new SolidColorBrush(Color.FromArgb(255, 211, 210, 210))));// NC_FLAG_PH 0x02 / NC_FLAG_CH 0x04
 
_bAirborne = (data[67] & 2) == 2 ? true : false;
}
/// <summary>
/// Navi-Ctrl WP data struct 'X'
2463,6 → 2493,8
if (sVal != "") _bFollowCopter = Convert.ToBoolean(sVal);
sVal = ini.IniReadValue("map", "AutoSetHome");
if (sVal != "") _bAutoHome = Convert.ToBoolean(sVal);
sVal = ini.IniReadValue("map", "GPXLog");
if (sVal != "") _bGPXLog = Convert.ToBoolean(sVal);
 
sVal = ini.IniReadValue("threshold", "VoltageWarning");
if(sVal != "") _dThresholdVoltageWarn = Convert.ToDouble(sVal);
2531,6 → 2563,7
 
ini.IniWriteValue("map", "followMe", _bFollowCopter.ToString());
ini.IniWriteValue("map", "AutoSetHome", _bAutoHome.ToString());
ini.IniWriteValue("map", "GPXLog", _bGPXLog.ToString());
 
ini.IniWriteValue("topBar", "voltage", chkBoxTopBarShowVoltage.IsChecked.ToString());
ini.IniWriteValue("topBar", "capacity", chkBoxTopBarShowCapacity.IsChecked.ToString());
2834,12 → 2867,155
((CustomMarkerCopter)(copter.Shape)).setColor("red");
});
}
 
private void btnLoadWPLFile_Click(object sender, RoutedEventArgs e)
{
_readWPLFile();
}
#endregion WP
#region GPX
private void checkBoxGPXLog_Click(object sender, RoutedEventArgs e)
{
_bGPXLog = (bool)checkBoxGPXLog.IsChecked;
}
void _gpxAdd(double lat,double lon, int elevation)
{
DataRow dr = dtGPX.NewRow();
dr[0] = dtGPX.Rows.Count - 1;
dr[1] = lat;
dr[2] = lon;
dr[3] = elevation;
dr[4] = DateTime.UtcNow.ToString("s", System.Globalization.CultureInfo.InvariantCulture); //2011-01-14T01:59:01Z
dtGPX.Rows.Add(dr);
}
void _saveGPXLog()
{
if (!Directory.Exists("GPXLog"))
Directory.CreateDirectory("GPXLog");
string SaveFileName = "GPXLog\\" + DateTime.Now.ToString("yyyyMMdd_HHmm") + ".gpx";
XmlTextWriter myXmlTextWriter = null;
myXmlTextWriter = new XmlTextWriter(SaveFileName, null);
NumberFormatInfo nfi = new NumberFormatInfo();
nfi.NumberDecimalSeparator = ".";
 
try
{
myXmlTextWriter.Formatting = Formatting.Indented;
 
myXmlTextWriter.WriteStartDocument();
 
myXmlTextWriter.WriteStartElement("gpx");
 
myXmlTextWriter.WriteAttributeString("version", "1.0");
myXmlTextWriter.WriteAttributeString("creator", "MKLiveView v1.0");
myXmlTextWriter.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
myXmlTextWriter.WriteAttributeString("xmlns", "http://www.topografix.com/GPX/1/1");
myXmlTextWriter.WriteAttributeString("xsi:schemaLocation", "http://www.topografix.com/GPX/1/1/gpx.xsd");
 
myXmlTextWriter.WriteElementString("time", DateTime.UtcNow.ToString("u", System.Globalization.CultureInfo.InvariantCulture));
 
myXmlTextWriter.WriteStartElement("trk");
myXmlTextWriter.WriteStartElement("trkseg");
for(int i = 0; i< dtGPX.Rows.Count;i++)
{
myXmlTextWriter.WriteStartElement("trkpt");
myXmlTextWriter.WriteAttributeString("lat", dtGPX.Rows[i][1].ToString() != "" ? ((double)dtGPX.Rows[i][1]).ToString(nfi) : "");
myXmlTextWriter.WriteAttributeString("lon", dtGPX.Rows[i][2].ToString() != "" ? ((double)dtGPX.Rows[i][2]).ToString(nfi) : "");
myXmlTextWriter.WriteElementString("ele", dtGPX.Rows[i][3].ToString());
myXmlTextWriter.WriteElementString("time", dtGPX.Rows[i][4].ToString());
myXmlTextWriter.WriteEndElement();
}
myXmlTextWriter.WriteEndElement();
myXmlTextWriter.WriteEndElement();
myXmlTextWriter.WriteEndElement();
}
catch (Exception e)
{
Console.WriteLine("Exception: {0}", e.ToString());
}
finally
{
if (myXmlTextWriter != null)
{
myXmlTextWriter.Close();
}
}
}
 
private void btnLoadGPXLog_Click(object sender, RoutedEventArgs e)
{
_loadGPXLog();
}
 
void _loadGPXLog()
{
 
Microsoft.Win32.OpenFileDialog fd = new Microsoft.Win32.OpenFileDialog();
fd.Filter = "GPX-Logfile | *.gpx";
fd.Multiselect = false;
if (fd.ShowDialog().Value)
{
string file = fd.FileName;
try
{
XDocument gpxDoc = XDocument.Load(file);
XNamespace gpx = XNamespace.Get("http://www.topografix.com/GPX/1/1");
 
NumberFormatInfo nfi = new NumberFormatInfo();
nfi.NumberDecimalSeparator = ".";
 
var tracks = from track in gpxDoc.Descendants(gpx + "trk")
select new
{
Name = track.Element(gpx + "name") != null ? track.Element(gpx + "name").Value : null,
Segs = (
from trackpoint in track.Descendants(gpx + "trkpt")
select new
{
Latitude = trackpoint.Attribute("lat").Value,
Longitude = trackpoint.Attribute("lon").Value,
Elevation = trackpoint.Element(gpx + "ele") != null ?
trackpoint.Element(gpx + "ele").Value : null,
Time = trackpoint.Element(gpx + "time") != null ?
trackpoint.Element(gpx + "time").Value : null
}
)
};
 
List<PointLatLng> wpl = new List<PointLatLng>();
foreach(var trk in tracks)
{
foreach(var trkseg in trk.Segs)
{
if(trkseg.Latitude != "" && trkseg.Longitude !="")
wpl.Add(new PointLatLng(Convert.ToDouble(trkseg.Latitude, nfi), Convert.ToDouble(trkseg.Longitude, nfi)));
}
 
}
if(wpl.Count() > 0)
{
for (int k = 0; k < MainMap.Markers.Count;)
{
GMapMarker p = MainMap.Markers[k];
if (p.Shape.GetType() == typeof(GMapRoute))
MainMap.Markers.Remove(p);
else
k++;
}
MapRoute mr = new MapRoute(wpl, "flying");
 
GMapRoute mRoute = new GMapRoute(mr.Points);
MainMap.Markers.Add(mRoute);
}
 
}
catch (Exception e)
{
Console.WriteLine("Exception: {0}", e.ToString());
}
}
}
#endregion GPX
#endregion functions
}
/// <summary>