Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 2354 → Rev 2355

/MKLiveView/v1.0/Source/MKLiveView.csproj
330,6 → 330,15
<ItemGroup>
<Resource Include="Images\SaveFile.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\WPToCopter.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\WPToCopter1.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\FromCopterToPc1.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
/MKLiveView/v1.0/Source/MainWindow.xaml
823,7 → 823,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">
1179,9 → 1179,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="526" VerticalAlignment="Top" Visibility="Collapsed">
<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"/>
<Grid x:Name="GridWP" Margin="23,36,25,0" Background="#7F000000" Height="526" VerticalAlignment="Top">
<Label x:Name="label4" Content="points" HorizontalAlignment="Left" Margin="872,480,0,0" VerticalAlignment="Top" Width="53" Foreground="White" Height="19" HorizontalContentAlignment="Right" Padding="0" VerticalContentAlignment="Center"/>
<Label x:Name="lblWPCount" Content="##" HorizontalAlignment="Right" Margin="0,482,4,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,456,0,3" BorderBrush="White" BorderThickness="0.5" CornerRadius="5" HorizontalAlignment="Left" Width="640">
1199,7 → 1199,7
</Rectangle>
<Button x:Name="btnGetWPList" Content="" HorizontalAlignment="Left" Height="36" Margin="112,0,0,0" VerticalAlignment="Bottom" Width="92" Click="btnGetWP_Click" ToolTip="Download WP-list from copter" BorderBrush="#FFBDBDBD" Style="{DynamicResource ButtonWithoutEffectStyle}">
<Button.Background>
<ImageBrush ImageSource="Images/FromCopterToPc.png" Stretch="Uniform"/>
<ImageBrush ImageSource="Images/FromCopterToPc1.png" Stretch="Uniform"/>
</Button.Background>
</Button>
<Rectangle HorizontalAlignment="Left" Width="94" Stroke="#FFE4E4E4" StrokeThickness="0.5" Margin="12,0,0,-1" Height="40" VerticalAlignment="Bottom">
1215,7 → 1215,7
</Rectangle>
<Button x:Name="btnSendWPList" Content="" HorizontalAlignment="Left" Height="36" Margin="13,0,0,0" VerticalAlignment="Bottom" Width="92" ToolTip="Upload WP-list to copter" BorderBrush="#FFBDBDBD" Click="btnSendWPList_Click" Style="{DynamicResource ButtonWithoutEffectStyle}">
<Button.Background>
<ImageBrush ImageSource="Images/FromPcToCopter.png" Stretch="Uniform"/>
<ImageBrush ImageSource="Images/WPToCopter1.png" Stretch="Uniform"/>
</Button.Background>
</Button>
<Rectangle HorizontalAlignment="Left" Width="94" Stroke="#FFE4E4E4" StrokeThickness="0.5" Margin="229,0,0,-1" Height="40" VerticalAlignment="Bottom">
1290,7 → 1290,84
<Label x:Name="label4_Copy13" Content="save to file (.wpl)" HorizontalAlignment="Left" Margin="324,0,0,35" VerticalAlignment="Bottom" Width="98" Foreground="White"/>
</Grid>
</Border>
<DataGrid x:Name="dgvWP" Margin="10,5,10,167" Background="{x:Null}" ItemsSource="{Binding}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="14" HorizontalGridLinesBrush="#FF688CAF" VerticalGridLinesBrush="#FF688CAF" HeadersVisibility="Column" BorderBrush="{x:Null}" Padding="0" AutoGenerateColumns="False" MouseUp="dgvWP_MouseUp" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False">
<Border Margin="10,343,0,75" BorderBrush="White" BorderThickness="0.5" CornerRadius="5" HorizontalAlignment="Left" Width="941">
<Grid Margin="-0.5,-0.5,-0.5,4.5">
<Rectangle HorizontalAlignment="Left" Width="94" Stroke="#FFE4E4E4" StrokeThickness="0.5" Margin="10,0,0,-1" Height="40" VerticalAlignment="Bottom">
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, ElementName=btnSendActiveWP}" Value="True">
<Setter Property="Fill" Value="{DynamicResource PressedItemBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
<Button x:Name="btnSendActiveWP" Content="" HorizontalAlignment="Left" Height="36" Margin="11,0,0,0" VerticalAlignment="Bottom" Width="93" ToolTip="Download WP-list from copter" BorderBrush="#FFBDBDBD" Style="{DynamicResource ButtonWithoutEffectStyle}" Click="btnSendActiveWP_Click">
<Button.Background>
<ImageBrush ImageSource="Images/WPToCopter.png" Stretch="Uniform"/>
</Button.Background>
</Button>
<ComboBox x:Name="cbWPEditType" HorizontalAlignment="Left" Height="22" Margin="10,24,0,0" VerticalAlignment="Top" Width="66">
<ComboBoxItem Content="WP"/>
<ComboBoxItem Content="POI"/>
<ComboBoxItem Content="Failsafe"/>
</ComboBox>
<Label x:Name="label4a" Content="Type" HorizontalAlignment="Left" Margin="11,6,0,0" Width="39" Foreground="White" Padding="0" Height="18" VerticalAlignment="Top"/>
<Label x:Name="label4b" Content="Prefix" HorizontalAlignment="Left" Margin="81,6,0,0" Width="35" Foreground="White" Padding="0" Height="18" VerticalAlignment="Top"/>
<TextBox x:Name="tbWPEditPrefix" HorizontalAlignment="Left" Height="22" Margin="81,24,0,0" VerticalAlignment="Top" Width="29" IsUndoEnabled="False" MaxLines="1" MaxLength="1" Foreground="White" Background="{x:Null}" VerticalContentAlignment="Center"/>
<Label x:Name="label4_Copy16" Content="Latitude" HorizontalAlignment="Left" Margin="115,6,0,0" Width="54" Foreground="White" Padding="0" Height="18" VerticalAlignment="Top"/>
<TextBox x:Name="tbWPEditLat" HorizontalAlignment="Left" Height="22" Margin="115,24,0,0" VerticalAlignment="Top" Width="76" IsUndoEnabled="False" MaxLines="1" MaxLength="10" Foreground="White" Background="{x:Null}" VerticalContentAlignment="Center"/>
<Label x:Name="label4_Copy17" Content="Longitude" HorizontalAlignment="Left" Margin="196,6,0,0" Width="54" Foreground="White" Padding="0" Height="18" VerticalAlignment="Top"/>
<TextBox x:Name="tbWPEditLon" HorizontalAlignment="Left" Height="22" Margin="196,24,0,0" VerticalAlignment="Top" Width="76" IsUndoEnabled="False" MaxLines="1" MaxLength="10" Foreground="White" Background="{x:Null}" VerticalContentAlignment="Center"/>
<Label x:Name="label4_Copy18" Content="Altitude" HorizontalAlignment="Left" Margin="277,6,0,0" Width="54" Foreground="White" Padding="0" Height="18" VerticalAlignment="Top"/>
<TextBox x:Name="tbWPEditAlt" HorizontalAlignment="Left" Height="22" Margin="277,24,0,0" VerticalAlignment="Top" Width="42" IsUndoEnabled="False" MaxLines="1" MaxLength="7" Foreground="White" Background="{x:Null}" VerticalContentAlignment="Center"/>
<Label x:Name="label4_Copy19" Content="Heading" HorizontalAlignment="Left" Margin="324,6,0,0" Width="54" Foreground="White" Padding="0" Height="18" VerticalAlignment="Top"/>
<TextBox x:Name="tbWPEditHeading" HorizontalAlignment="Left" Height="22" Margin="324,24,0,0" VerticalAlignment="Top" Width="69" IsUndoEnabled="False" MaxLines="1" MaxLength="7" Foreground="White" Background="{x:Null}" VerticalContentAlignment="Center"/>
<Label x:Name="label4_Copy20" Content="Speed" HorizontalAlignment="Left" Margin="398,6,0,0" Width="54" Foreground="White" Padding="0" Height="18" VerticalAlignment="Top"/>
<TextBox x:Name="tbWPEditSpeed" HorizontalAlignment="Left" Height="22" Margin="398,24,0,0" VerticalAlignment="Top" Width="65" IsUndoEnabled="False" MaxLines="1" MaxLength="6" Foreground="White" Background="{x:Null}" VerticalContentAlignment="Center"/>
<ComboBox x:Name="cbWPEditSpeed" HorizontalAlignment="Left" Height="22" Margin="398,51,0,0" VerticalAlignment="Top" Width="65">
<ComboBoxItem Content="MAX"/>
<ComboBoxItem Content="m/s"/>
<ComboBoxItem Content="Poti 1"/>
<ComboBoxItem Content="Poti 2"/>
<ComboBoxItem Content="Poti 3"/>
<ComboBoxItem Content="Poti 4"/>
<ComboBoxItem Content="Poti 5"/>
<ComboBoxItem Content="Poti 6"/>
<ComboBoxItem Content="Poti 7"/>
<ComboBoxItem Content="Poti 8"/>
</ComboBox>
<ComboBox x:Name="cbWPEditHeading" HorizontalAlignment="Left" Height="22" Margin="324,51,0,0" VerticalAlignment="Top" Width="69">
<ComboBoxItem Content=" - - - " HorizontalContentAlignment="Center"/>
<ComboBoxItem Content="WP/POI"/>
<ComboBoxItem Content="degree"/>
</ComboBox>
<Label x:Name="label4_Copy21" Content="Climbrate" HorizontalAlignment="Left" Margin="468,6,0,0" Width="54" Foreground="White" Padding="0" Height="18" VerticalAlignment="Top"/>
<TextBox x:Name="tbWPEditClimbrate" HorizontalAlignment="Left" Height="22" Margin="468,24,0,0" VerticalAlignment="Top" Width="61" IsUndoEnabled="False" MaxLines="1" MaxLength="4" Foreground="White" Background="{x:Null}" VerticalContentAlignment="Center"/>
<ComboBox x:Name="cbWPEditClimbrate" HorizontalAlignment="Left" Height="22" Margin="468,51,0,0" VerticalAlignment="Top" Width="61">
<ComboBoxItem Content="AUTO"/>
<ComboBoxItem Content="m/s"/>
</ComboBox>
<Label x:Name="label4_Copy22" Content="Radius" HorizontalAlignment="Left" Margin="534,6,0,0" Width="54" Foreground="White" Padding="0" Height="18" VerticalAlignment="Top"/>
<TextBox x:Name="tbWPEditRadius" HorizontalAlignment="Left" Height="22" Margin="534,24,0,0" VerticalAlignment="Top" Width="42" IsUndoEnabled="False" MaxLines="1" MaxLength="3" Foreground="White" Background="{x:Null}" VerticalContentAlignment="Center"/>
<Label x:Name="label4_Copy23" Content="Holdtime" HorizontalAlignment="Left" Margin="581,6,0,0" Width="54" Foreground="White" Padding="0" Height="18" VerticalAlignment="Top"/>
<TextBox x:Name="tbWPEditHoldtime" HorizontalAlignment="Left" Height="22" Margin="581,24,0,0" VerticalAlignment="Top" Width="42" IsUndoEnabled="False" MaxLines="1" MaxLength="2" Foreground="White" Background="{x:Null}" VerticalContentAlignment="Center"/>
<Label x:Name="label4_Copy24" Content="AutoTrig" HorizontalAlignment="Left" Margin="635,6,0,0" Width="54" Foreground="White" Padding="0" Height="18" VerticalAlignment="Top"/>
<TextBox x:Name="tbWPEditAutoTrigger" HorizontalAlignment="Left" Height="22" Margin="635,24,0,0" VerticalAlignment="Top" Width="42" IsUndoEnabled="False" MaxLines="1" MaxLength="2" Foreground="White" Background="{x:Null}" VerticalContentAlignment="Center"/>
<Label x:Name="label4_Copy25" Content="CamAngle" HorizontalAlignment="Left" Margin="688,6,0,0" Width="54" Foreground="White" Padding="0" Height="18" VerticalAlignment="Top"/>
<TextBox x:Name="tbWPEditCamAngle" HorizontalAlignment="Left" Height="22" Margin="688,24,0,0" VerticalAlignment="Top" Width="69" IsUndoEnabled="False" MaxLines="1" MaxLength="2" Foreground="White" Background="{x:Null}" VerticalContentAlignment="Center"/>
<ComboBox x:Name="cbWPEditCamAngle" HorizontalAlignment="Left" Height="22" Margin="688,51,0,0" VerticalAlignment="Top" Width="69">
<ComboBoxItem Content=" - - - " HorizontalContentAlignment="Center"/>
<ComboBoxItem Content="AUTO"/>
<ComboBoxItem Content="degree"/>
</ComboBox>
<Label x:Name="label4_Copy26" Content="Out1Timer" HorizontalAlignment="Left" Margin="762,6,0,0" Width="63" Foreground="White" Padding="0" Height="18" VerticalAlignment="Top"/>
<TextBox x:Name="tbWPEditOut1" HorizontalAlignment="Left" Height="22" Margin="762,24,0,0" VerticalAlignment="Top" Width="42" IsUndoEnabled="False" MaxLines="1" MaxLength="2" Foreground="White" Background="{x:Null}" VerticalContentAlignment="Center"/>
<Label x:Name="label4_Copy27" Content="set as active WP" HorizontalAlignment="Left" Margin="8,0,0,35" VerticalAlignment="Bottom" Width="96" Foreground="White" Height="26"/>
</Grid>
</Border>
<DataGrid x:Name="dgvWP" Margin="10,5,10,188" Background="{x:Null}" ItemsSource="{Binding}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="14" HorizontalGridLinesBrush="#FF688CAF" VerticalGridLinesBrush="#FF688CAF" HeadersVisibility="Column" BorderBrush="{x:Null}" Padding="0" AutoGenerateColumns="False" MouseUp="dgvWP_MouseUp" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False" MouseDoubleClick="dgvWP_MouseDoubleClick" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSortColumns="False" IsReadOnly="True">
<DataGrid.Columns>
<DataGridTextColumn Header="Index" Binding="{Binding Path=Index}"/>
<DataGridTextColumn Header="Type" Binding="{Binding Path=Type, Converter={StaticResource wpConvert}, ConverterParameter= Type}"/>
1309,8 → 1386,12
</DataGrid.Columns>
</DataGrid>
<CheckBox x:Name="checkBoxShowWPRoute" Content="show route" HorizontalAlignment="Right" Height="22" Margin="0,504,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"/>
<Label x:Name="label4_Copy9" Content="distance" HorizontalAlignment="Right" Margin="0,462,36,0" VerticalAlignment="Top" Width="57" Foreground="White" Padding="0" Height="18" HorizontalContentAlignment="Right" VerticalContentAlignment="Center"/>
<Label x:Name="lblWPRouteDistance" Content="0 m" HorizontalAlignment="Right" Margin="0,463,4,0" VerticalAlignment="Top" Width="38" Foreground="White" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" Padding="0"/>
<Label x:Name="label4_Copy14" Content="points NC (w/o POI)" HorizontalAlignment="Left" Margin="712,461,0,0" VerticalAlignment="Top" Width="111" Foreground="White" Height="20" HorizontalContentAlignment="Right" Padding="0" VerticalContentAlignment="Center"/>
<Label x:Name="lblWPCountNC" Content="##" HorizontalAlignment="Right" Margin="0,463,113,0" VerticalAlignment="Top" Width="38" Foreground="White" HorizontalContentAlignment="Right" Padding="0" Height="16"/>
<Label x:Name="label4_Copy15" Content="Index NC" HorizontalAlignment="Left" Margin="758,480,0,0" VerticalAlignment="Top" Width="65" Foreground="White" Height="21" HorizontalContentAlignment="Right" Padding="0" VerticalContentAlignment="Center"/>
<Label x:Name="lblWPIndexNC" Content="##" HorizontalAlignment="Right" Margin="0,482,113,0" VerticalAlignment="Top" Width="38" Foreground="White" HorizontalContentAlignment="Right" Padding="0" Height="16"/>
</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
278,7 → 278,7
DataTable dtGPX = new DataTable();
DataRow drGPX;
bool _bAirborne = false;
int _wpIndex = -1, _wpCount = 0;
int _wpIndex = -1, _wpCount = 0, _wpEdit = -1;
 
DispatcherTimer timer = new DispatcherTimer();
 
1712,15 → 1712,48
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
Dispatcher.Invoke((Action)(() => lblWPIndexNC.Content = data[48].ToString()));
if(data[48] > 0 && _wpIndex != data[48] -1 && wpList.Count > 0)
{
_setActiveWP(data[48]-1);
if((data[67] & 2) == 2)
Dispatcher.Invoke(() => {
DataGridRow row;
if (_wpIndex > -1)
{
row = (DataGridRow)dgvWP.ItemContainerGenerator.ContainerFromIndex(_wpIndex);
row.Background = new SolidColorBrush(Colors.Transparent);
row.BorderBrush = new SolidColorBrush(Colors.Transparent);
row.BorderThickness = new Thickness(0);
}
_wpIndex = data[48] - 1;
row = (DataGridRow)dgvWP.ItemContainerGenerator.ContainerFromIndex(_wpIndex);
row.Background = new SolidColorBrush(Color.FromArgb(80, 0, 100, 255));
row.BorderBrush = new SolidColorBrush(Colors.Aqua);
row.BorderThickness = new Thickness(2);
dgvWP.UpdateLayout();
});
_wpIndex = data[48]-1;
}
else
{
if ((data[48] == 0 || wpList.Count == 0) & MainMap.Markers.Contains(wpActiveMarker))
{
Dispatcher.Invoke(() => MainMap.Markers.Remove(wpActiveMarker));
Dispatcher.Invoke(() =>
{
DataGridRow row;
if (_wpIndex > -1 && data[48] == 0)
{
row = (DataGridRow)dgvWP.ItemContainerGenerator.ContainerFromIndex(_wpIndex);
row.Background = new SolidColorBrush(Colors.Transparent);
row.BorderBrush = new SolidColorBrush(Colors.Transparent);
row.BorderThickness = new Thickness(0);
_wpIndex = -1;
}
});
 
}
}
 
if(wpList.Count > 0 && ((data[67] & 2) == 2))
1756,6 → 1789,7
// });
}
Dispatcher.Invoke((Action)(() => tbWPCount.Text = data[49].ToString())); //Waypoints count
Dispatcher.Invoke((Action)(() => lblWPCountNC.Content = data[49].ToString())); //Waypoints count
_wpCount = data[49];
Dispatcher.Invoke((Action)(() => tbTopSats.Text = data[50].ToString())); //Satellites
 
3533,20 → 3567,15
Thread t = new Thread(new ThreadStart(clearCopterWPList));
t.Start();
}
private void dgvWP_MouseUp(object sender, MouseButtonEventArgs e)
private void btnSendActiveWP_Click(object sender, RoutedEventArgs e)
{
if (dgvWP.SelectedIndex > -1 && dgvWP.SelectedIndex < dtWaypoints.Rows.Count)
{
if(_wpCount > 0)
_sendWayPoint(dtWaypoints.Rows[dgvWP.SelectedIndex],-1);
if (_wpCount > 0)
_sendWayPoint(dtWaypoints.Rows[dgvWP.SelectedIndex], -1);
else
_sendWayPoint(dtWaypoints.Rows[dgvWP.SelectedIndex],1);
_sendWayPoint(dtWaypoints.Rows[dgvWP.SelectedIndex], 1);
 
// if (data[48] > 0)
// {
// row = (DataGridRow)dgvWP.ItemContainerGenerator.ContainerFromIndex(dgvWP.SelectedIndex);
// row.Background = new SolidColorBrush(Colors.Transparent);
// }
Dispatcher.Invoke(() => {
DataGridRow row;
if (_wpIndex > -1)
3561,11 → 3590,126
row.Background = new SolidColorBrush(Color.FromArgb(80, 0, 100, 255));
row.BorderBrush = new SolidColorBrush(Colors.Aqua);
row.BorderThickness = new Thickness(2);
dgvWP.UpdateLayout();
dgvWP.UpdateLayout();
});
}
}
private void dgvWP_MouseUp(object sender, MouseButtonEventArgs e)
{
if (dgvWP.SelectedIndex > -1 && dgvWP.SelectedIndex < dtWaypoints.Rows.Count)
{
Dispatcher.Invoke(() => {
DataGridRow row;
if (_wpEdit > -1)
{
row = (DataGridRow)dgvWP.ItemContainerGenerator.ContainerFromIndex(_wpEdit);
row.Background = new SolidColorBrush(Colors.Transparent);
row.BorderBrush = new SolidColorBrush(Colors.Transparent);
row.BorderThickness = new Thickness(0);
}
_wpEdit = dgvWP.SelectedIndex;
row = (DataGridRow)dgvWP.ItemContainerGenerator.ContainerFromIndex(_wpEdit);
row.Background = new SolidColorBrush(Color.FromArgb(80, 0, 100, 255));
row.BorderBrush = new SolidColorBrush(Colors.Aqua);
row.BorderThickness = new Thickness(2);
dgvWP.UpdateLayout();
 
_setWPEditFields(_wpEdit);
});
}
}
private void dgvWP_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
}
void _setWPEditFields(int index)
{
int iVal;
cbWPEditType.SelectedIndex = (int)dtWaypoints.Rows[index][1];
tbWPEditPrefix.Text = dtWaypoints.Rows[index][2].ToString().Substring(0,1);
tbWPEditLat.Text = dtWaypoints.Rows[index][3].ToString();
tbWPEditLon.Text = dtWaypoints.Rows[index][4].ToString();
tbWPEditAlt.Text = dtWaypoints.Rows[index][5].ToString();
iVal = Convert.ToInt16(dtWaypoints.Rows[index][6]);
if (iVal == 0)
{
cbWPEditHeading.SelectedIndex = 0;
tbWPEditHeading.Text = " - - -";
tbWPEditHeading.IsReadOnly = true;
}
if (iVal > 0 && iVal < 360)
{
cbWPEditHeading.SelectedIndex = 2;
tbWPEditHeading.Text = iVal.ToString();
tbWPEditHeading.IsReadOnly = false;
}
if (iVal < 0)
{
cbWPEditHeading.SelectedIndex = 1;
tbWPEditHeading.Text = (Math.Abs(iVal).ToString());
tbWPEditHeading.IsReadOnly = false;
}
iVal = Convert.ToInt16(dtWaypoints.Rows[index][7]);
if (iVal == 0)
{
cbWPEditSpeed.SelectedIndex = 0;
tbWPEditSpeed.Text = "MAX";
tbWPEditSpeed.IsReadOnly = true;
}
if (iVal > 0 && iVal < 248)
{
cbWPEditSpeed.SelectedIndex = 1;
tbWPEditSpeed.Text = ((double)iVal * 0.1).ToString();
tbWPEditSpeed.IsReadOnly = false;
}
if (iVal > 247)
{
cbWPEditSpeed.SelectedIndex = 256 - iVal + 1;
tbWPEditSpeed.Text = "";
tbWPEditSpeed.IsReadOnly = true;
}
iVal = Convert.ToInt16(dtWaypoints.Rows[index][8]);
if (iVal == 255)
{
cbWPEditClimbrate.SelectedIndex = 0;
tbWPEditClimbrate.Text = "AUTO";
tbWPEditClimbrate.IsReadOnly = true;
}
else
{
cbWPEditClimbrate.SelectedIndex = 1;
tbWPEditClimbrate.Text = (System.Convert.ToDouble(iVal) / 10).ToString("0.0");
tbWPEditClimbrate.IsReadOnly = false;
}
iVal = Convert.ToInt16(dtWaypoints.Rows[index][9]);
tbWPEditRadius.Text = iVal.ToString();
iVal = Convert.ToInt16(dtWaypoints.Rows[index][10]);
tbWPEditHoldtime.Text = iVal.ToString();
iVal = Convert.ToInt16(dtWaypoints.Rows[index][11]);
tbWPEditAutoTrigger.Text = iVal.ToString();
iVal = Convert.ToInt16(dtWaypoints.Rows[index][12]);
if (iVal == 0)
{
cbWPEditCamAngle.SelectedIndex = 0;
tbWPEditCamAngle.Text = " - - - ";
tbWPEditCamAngle.IsReadOnly = true;
}
if (iVal < 0 | iVal == 255)
{
cbWPEditCamAngle.SelectedIndex = 1;
tbWPEditCamAngle.Text = "AUTO";
tbWPEditCamAngle.IsReadOnly = true;
}
if (iVal > 0 & iVal < 255)
{
cbWPEditCamAngle.SelectedIndex = 2;
tbWPEditCamAngle.Text = iVal.ToString();
tbWPEditCamAngle.IsReadOnly = false;
}
iVal = Convert.ToInt16(dtWaypoints.Rows[index][14]);
tbWPEditOut1.Text = iVal.ToString();
 
}
 
#endregion WP
#region GPX
private void checkBoxGPXLog_Click(object sender, RoutedEventArgs e)
3759,7 → 3903,7
case "AutoTrigger":
return value.ToString() == "0" ? "- - -" : value.ToString() + " m";
case "Status":
return Waypoints.WPSpeed(System.Convert.ToInt16(value));
return (Waypoints.status)(System.Convert.ToInt16(value));
}
 
return value.ToString();