Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 2368 → Rev 2369

/MKLiveView/v1.0/Source/MainWindow.xaml
1299,17 → 1299,17
</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"/>
<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" IsTabStop="False"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown" PreviewMouseLeftButtonDown="tbWPEdit_MouseDown" IsTabStop="False" IsReadOnly="True" />
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown" PreviewMouseLeftButtonDown="tbWPEdit_MouseDown" IsTabStop="False" IsReadOnly="True"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown" PreviewMouseLeftButtonDown="tbWPEdit_MouseDown" IsTabStop="False" IsReadOnly="True"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown" PreviewMouseLeftButtonDown="tbWPEdit_MouseDown" IsTabStop="False" IsReadOnly="True"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown" PreviewMouseLeftButtonDown="tbWPEdit_MouseDown" IsTabStop="False" IsReadOnly="True"/>
<ComboBox x:Name="cbWPEditSpeed" HorizontalAlignment="Left" Height="22" Margin="398,51,0,0" VerticalAlignment="Top" Width="65">
<ComboBoxItem Content="MAX"/>
<ComboBoxItem Content="m/s"/>
1328,19 → 1328,19
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown" PreviewMouseLeftButtonDown="tbWPEdit_MouseDown" IsTabStop="False" IsReadOnly="True"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown" PreviewMouseLeftButtonDown="tbWPEdit_MouseDown" IsTabStop="False" IsReadOnly="True"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown" PreviewMouseLeftButtonDown="tbWPEdit_MouseDown" IsTabStop="False" IsReadOnly="True"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown" PreviewMouseLeftButtonDown="tbWPEdit_MouseDown" IsTabStop="False" IsReadOnly="True"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown" PreviewMouseLeftButtonDown="tbWPEdit_MouseDown" IsTabStop="False" IsReadOnly="True"/>
<ComboBox x:Name="cbWPEditCamAngle" HorizontalAlignment="Left" Height="22" Margin="688,51,0,0" VerticalAlignment="Top" Width="69">
<ComboBoxItem Content=" - - - " HorizontalContentAlignment="Center"/>
<ComboBoxItem Content="AUTO"/>
1347,7 → 1347,7
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown"/>
<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" TouchDown="tbWPEdit_TouchDown" KeyDown="tbWPEdit_KeyDown" PreviewMouseLeftButtonDown="tbWPEdit_MouseDown" IsTabStop="False" IsReadOnly="True"/>
<Rectangle HorizontalAlignment="Left" Width="94" Stroke="#FFE4E4E4" StrokeThickness="0.5" Margin="12,0,0,-2" Height="40" VerticalAlignment="Bottom">
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
/MKLiveView/v1.0/Source/MainWindow.xaml.cs
729,34 → 729,41
}
 
}
void _clearWPMarker(String text)
 
GMapMarker _findWPMarker(string name)
{
for (int k = 0; k < MainMap.Markers.Count;)
{
GMapMarker p = MainMap.Markers[k];
if (p.GetType() == typeof(CustomMarkerWP) | (p.Shape != null && p.Shape.GetType() == typeof(CustomMarkerWP)))
if (((CustomMarkerWP)p.Shape).WPText == text)
{ MainMap.Markers.Remove(p); break; }
if (((CustomMarkerWP)p.Shape).WPText == name)
return p;
else
k++;
else
k++;
}
return null;
}
void _clearWPMarker(string name)
{
GMapMarker p = _findWPMarker(name);
if(p != null)
MainMap.Markers.Remove(p);
}
void _renameWPMarker(string s1, string s2)
{
for (int k = 0; k < MainMap.Markers.Count;)
{
GMapMarker p = MainMap.Markers[k];
if (p.GetType() == typeof(CustomMarkerWP) | (p.Shape != null && p.Shape.GetType() == typeof(CustomMarkerWP)))
if (((CustomMarkerWP)p.Shape).WPText == s1)
{ ((CustomMarkerWP)p.Shape).WPText = s2; break; }
else
k++;
else
k++;
}
GMapMarker p = _findWPMarker(s1);
if (p != null)
((CustomMarkerWP)p.Shape).WPText = s2;
}
void _repositionWPMarker(PointLatLng point, string name)
{
GMapMarker p = _findWPMarker(name);
if (p != null)
p.Position = point;
}
 
// access mode
private void comboBoxMode_DropDownClosed(object sender, EventArgs e)
{
3384,6 → 3391,7
}
void _setMarkerColor(GMapMarker wpMarker,int iType)
{
if(wpMarker != null)
Dispatcher.Invoke(() =>
{
switch (iType)
3707,10 → 3715,13
{
if(dgvWP.SelectedIndex > -1 && dgvWP.SelectedIndex < dtWaypoints.Rows.Count)
{
string oldName = (string)dtWaypoints.Rows[dgvWP.SelectedIndex][2];
int i = wpList.IndexOf(new PointLatLng((double)dtWaypoints.Rows[dgvWP.SelectedIndex][3], (double)dtWaypoints.Rows[dgvWP.SelectedIndex][4]));
dtWaypoints.Rows[dgvWP.SelectedIndex][1] = cbWPEditType.SelectedIndex;
dtWaypoints.Rows[dgvWP.SelectedIndex][2] = tbWPEditPrefix.Text + (dgvWP.SelectedIndex + 1).ToString();
dtWaypoints.Rows[dgvWP.SelectedIndex][3] = Convert.ToDouble(tbWPEditLat.Text.Replace('.', ','));
dtWaypoints.Rows[dgvWP.SelectedIndex][4] = Convert.ToDouble(tbWPEditLon.Text.Replace('.', ','));
wpList[i] = (new PointLatLng((double)dtWaypoints.Rows[dgvWP.SelectedIndex][3], (double)dtWaypoints.Rows[dgvWP.SelectedIndex][4]));
dtWaypoints.Rows[dgvWP.SelectedIndex][5] = tbWPEditAlt.Text;
switch (cbWPEditHeading.SelectedIndex)
{
3762,16 → 3773,19
}
dtWaypoints.Rows[dgvWP.SelectedIndex][14] = tbWPEditOut1.Text;
 
_clearMapMarkers(typeof(CustomMarkerWP));
// _clearMapMarkers(typeof(CustomMarkerWP));
_repositionWPMarker(new PointLatLng((double)dtWaypoints.Rows[dgvWP.SelectedIndex][3], (double)dtWaypoints.Rows[dgvWP.SelectedIndex][4]),oldName);
_renameWPMarker(oldName, (string)dtWaypoints.Rows[dgvWP.SelectedIndex][2]);
_clearMapMarkers(typeof(CustomMarkerWPActive));
wpList.Clear();
_setMarkerColor(_findWPMarker((string)dtWaypoints.Rows[dgvWP.SelectedIndex][2]), (int)dtWaypoints.Rows[dgvWP.SelectedIndex][1]);
// wpList.Clear();
if (mRouteWP != null)
MainMap.Markers.Remove(mRouteWP);
 
for (int k = 0; k < dtWaypoints.Rows.Count; k++)
{
_createWP(new PointLatLng((double)dtWaypoints.Rows[k][3], (double)dtWaypoints.Rows[k][4]), (string)dtWaypoints.Rows[k][2], (int)dtWaypoints.Rows[k][1]);
}
//for (int k = 0; k < dtWaypoints.Rows.Count; k++)
//{
// _createWP(new PointLatLng((double)dtWaypoints.Rows[k][3], (double)dtWaypoints.Rows[k][4]), (string)dtWaypoints.Rows[k][2], (int)dtWaypoints.Rows[k][1]);
//}
_routeUpdate();
dgvWP.Items.Refresh();
 
3795,6 → 3809,8
if ((int)dtWaypoints.Rows[index][1] == 0)
wpList.Remove(new PointLatLng((double)dtWaypoints.Rows[index][3], (double)dtWaypoints.Rows[index][4]));
_clearWPMarker((string)dtWaypoints.Rows[index][2]);
if (wpActiveMarker != null)
MainMap.Markers.Remove(wpActiveMarker);
dtWaypoints.Rows[index].Delete();
_wpIndex = -1;
_wpEdit = -1;
3823,9 → 3839,13
{
_wpWEdit(sender);
}
private void tbWPEdit_MouseDown(object sender, MouseButtonEventArgs e)
{
_wpWEdit(sender);
}
void _wpWEdit(object sender)
{
if (!((TextBox)sender).IsReadOnly)
// if (!((TextBox)sender).IsReadOnly)
{
KeyPad.Keypad k = new KeyPad.Keypad(this);
 
4050,6 → 4070,7
}
}
 
 
private void btnLoadGPXLog_Click(object sender, RoutedEventArgs e)
{
_loadGPXLog();