Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 2348 → Rev 2349

/MKLiveView/v1.0/Source/MKLiveView.csproj
53,7 → 53,6
<ApplicationIcon>MK.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Windows.Shell, Version=3.5.41019.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
88,6 → 87,12
<Compile Include="GMapCustomMarkers\CustomMarkerCopter.xaml.cs">
<DependentUpon>CustomMarkerCopter.xaml</DependentUpon>
</Compile>
<Compile Include="GMapCustomMarkers\CustomMarkerWPActive.xaml.cs">
<DependentUpon>CustomMarkerWPActive.xaml</DependentUpon>
</Compile>
<Compile Include="GMapCustomMarkers\CustomMarkerWP.xaml.cs">
<DependentUpon>CustomMarkerWP.xaml</DependentUpon>
</Compile>
<Compile Include="SerialPortCtrl.xaml.cs">
<DependentUpon>SerialPortCtrl.xaml</DependentUpon>
</Compile>
104,6 → 109,14
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="GMapCustomMarkers\CustomMarkerWPActive.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="GMapCustomMarkers\CustomMarkerWP.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
162,9 → 175,6
<Resource Include="GMapCustomMarkers\home.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="GMapCustomMarkers\Copter1.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="ArtificialHorizon\horizon.png" />
<Resource Include="ArtificialHorizon\wings.png" />
</ItemGroup>
295,6 → 305,24
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\LoadFile.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\DeleteCopterList.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\DeleteList.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="GMapCustomMarkers\CopterRed.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
585,7 → 585,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>
662,6 → 662,114
 
</Grid>
</TabItem>
<TabItem Header="Serial" HorizontalAlignment="Left" Height="20" VerticalAlignment="Top" Width="54" Margin="-1,0,0,0">
<Grid>
<GroupBox x:Name="groupBox3" Header="Channel 1" HorizontalAlignment="Left" Height="206" VerticalAlignment="Top" Width="194" Foreground="White" BorderThickness="0.5" Margin="0,31,0,0">
<Grid Margin="0,0,-2,0.04">
<TextBox x:Name="textBoxSerial1" HorizontalAlignment="Left" Height="21" Margin="6,10,0,0" Text="SerialChannel1 description" VerticalAlignment="Top" Width="146" Background="{x:Null}" Foreground="White" UndoLimit="0" IsUndoEnabled="False" MaxLines="1" MaxLength="24" TextChanged="textBoxSerial1_TextChanged"/>
<Label x:Name="labelSerChan1" HorizontalAlignment="Left" Margin="157,12,0,0" VerticalAlignment="Top" Foreground="White" Padding="0" Width="24" Content="{Binding Value, ElementName=SerChan1ScaleSlider}">
<Label.Style>
<Style TargetType="{x:Type Label}">
<Style.Triggers>
<DataTrigger Binding="{Binding Value, ElementName=SerChan1ScaleSlider}">
<Setter Property="Content" Value="{Binding Value, ElementName=SerChan1ScaleSlider}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Label.Style>
</Label>
<Slider x:Name="SerChan1ScaleSlider" HorizontalAlignment="Left" Height="29" Margin="4,35,0,0" VerticalAlignment="Top" Width="177" Maximum="254" FontSize="20" Style="{DynamicResource TouchSliderStyle}" SmallChange="0.001" ValueChanged="SerChan1ScaleSlider_ValueChanged"/>
<Button x:Name="btnSer1_0" Content="0" HorizontalAlignment="Left" Height="35" Margin="2,69,0,0" VerticalAlignment="Top" Width="58" FontSize="14" Click="btnSer1_0_Click"/>
<Button x:Name="btnSer1_127" Content="127" HorizontalAlignment="Left" Height="35" Margin="62,69,0,0" VerticalAlignment="Top" Width="58" FontSize="14" Click="btnSer1_127_Click"/>
<Button x:Name="btnSer1_254" Content="254" HorizontalAlignment="Left" Height="35" Margin="122,69,0,0" VerticalAlignment="Top" Width="58" FontSize="14" Click="btnSer1_254_Click"/>
<TextBox x:Name="textBoxSerial1_val1" HorizontalAlignment="Left" Height="29" Margin="2,111,0,0" TextWrapping="Wrap" Text="0" VerticalAlignment="Top" Width="58" MaxLines="1" MaxLength="3" IsUndoEnabled="False" FontSize="14" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" KeyUp="textBox_serial_KeyPress" TextChanged="textBoxSerial1_val1_TextChanged"/>
<TextBox x:Name="textBoxSerial1_val2" HorizontalAlignment="Left" Height="29" Margin="62,111,0,0" TextWrapping="Wrap" Text="0" VerticalAlignment="Top" Width="58" MaxLines="1" MaxLength="3" IsUndoEnabled="False" FontSize="14" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" KeyUp="textBox_serial_KeyPress" TextChanged="textBoxSerial1_val2_TextChanged"/>
<TextBox x:Name="textBoxSerial1_val3" HorizontalAlignment="Left" Height="29" Margin="122,111,0,0" TextWrapping="Wrap" Text="0" VerticalAlignment="Top" Width="58" MaxLines="1" MaxLength="3" IsUndoEnabled="False" FontSize="14" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" KeyUp="textBox_serial_KeyPress" TextChanged="textBoxSerial1_val3_TextChanged"/>
<Button x:Name="btnSer1_val1" Content="{Binding Text, ElementName=textBoxSerial1_val1}" HorizontalAlignment="Left" Height="35" Margin="2,143,0,0" VerticalAlignment="Top" Width="58" FontSize="14" Click="btnSer1_val1_Click">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Binding="{Binding Text,ElementName=textBoxSerial1_val1}"></DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Button x:Name="btnSer1_val2" Content="{Binding Text, ElementName=textBoxSerial1_val2}" HorizontalAlignment="Left" Height="35" Margin="62,143,0,0" VerticalAlignment="Top" Width="58" FontSize="14" Click="btnSer1_val2_Click">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Binding="{Binding Text,ElementName=textBoxSerial1_val2}"></DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Button x:Name="btnSer1_val3" Content="{Binding Text, ElementName=textBoxSerial1_val3}" HorizontalAlignment="Left" Height="35" Margin="122,143,0,0" VerticalAlignment="Top" Width="58" FontSize="14" Click="btnSer1_val3_Click">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Binding="{Binding Text,ElementName=textBoxSerial1_val3}"></DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
 
</Grid>
</GroupBox>
<GroupBox x:Name="groupBoxSerchan2" Header="Channel 2" HorizontalAlignment="Left" Height="206" VerticalAlignment="Top" Width="194" Foreground="White" BorderThickness="0.5" Margin="0,277,0,0">
<Grid Margin="0,0,-2,0.04">
<TextBox x:Name="textBoxSerial2" HorizontalAlignment="Left" Height="21" Margin="6,10,0,0" Text="SerialChannel2 description" VerticalAlignment="Top" Width="146" Background="{x:Null}" Foreground="White" UndoLimit="0" IsUndoEnabled="False" MaxLines="1" MaxLength="24" TextChanged="textBoxSerial2_TextChanged"/>
<Label x:Name="labelSerChan2" HorizontalAlignment="Left" Margin="157,12,0,0" VerticalAlignment="Top" Foreground="White" Padding="0" Width="24" Content="{Binding Value, ElementName=SerChan2ScaleSlider}">
<Label.Style>
<Style TargetType="{x:Type Label}">
<Style.Triggers>
<DataTrigger Binding="{Binding Value, ElementName=SerChan2ScaleSlider}">
<Setter Property="Content" Value="{Binding Value, ElementName=SerChan2ScaleSlider}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Label.Style>
</Label>
<Slider x:Name="SerChan2ScaleSlider" HorizontalAlignment="Left" Height="29" Margin="4,35,0,0" VerticalAlignment="Top" Width="177" Maximum="254" FontSize="20" Style="{DynamicResource TouchSliderStyle}" SmallChange="0.001" ValueChanged="SerChan2ScaleSlider_ValueChanged"/>
<Button x:Name="btnSer2_0" Content="0" HorizontalAlignment="Left" Height="35" Margin="2,69,0,0" VerticalAlignment="Top" Width="58" FontSize="14" Click="btnSer2_0_Click"/>
<Button x:Name="btnSer2_127" Content="127" HorizontalAlignment="Left" Height="35" Margin="62,69,0,0" VerticalAlignment="Top" Width="58" FontSize="14" Click="btnSer2_127_Click"/>
<Button x:Name="btnSer2_254" Content="254" HorizontalAlignment="Left" Height="35" Margin="122,69,0,0" VerticalAlignment="Top" Width="58" FontSize="14" Click="btnSer2_254_Click"/>
<TextBox x:Name="textBoxSerial2_val1" HorizontalAlignment="Left" Height="29" Margin="2,111,0,0" TextWrapping="Wrap" Text="0" VerticalAlignment="Top" Width="58" MaxLines="1" MaxLength="3" IsUndoEnabled="False" FontSize="14" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" KeyUp="textBox_serial_KeyPress" TextChanged="textBoxSerial2_val1_TextChanged"/>
<TextBox x:Name="textBoxSerial2_val2" HorizontalAlignment="Left" Height="29" Margin="62,111,0,0" TextWrapping="Wrap" Text="0" VerticalAlignment="Top" Width="58" MaxLines="1" MaxLength="3" IsUndoEnabled="False" FontSize="14" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" KeyUp="textBox_serial_KeyPress" TextChanged="textBoxSerial2_val2_TextChanged"/>
<TextBox x:Name="textBoxSerial2_val3" HorizontalAlignment="Left" Height="29" Margin="122,111,0,0" TextWrapping="Wrap" Text="0" VerticalAlignment="Top" Width="58" MaxLines="1" MaxLength="3" IsUndoEnabled="False" FontSize="14" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" KeyUp="textBox_serial_KeyPress" TextChanged="textBoxSerial2_val3_TextChanged"/>
<Button x:Name="btnSer2_val1" Content="{Binding Text, ElementName=textBoxSerial2_val1}" HorizontalAlignment="Left" Height="35" Margin="2,143,0,0" VerticalAlignment="Top" Width="58" FontSize="14" Click="btnSer2_val1_Click">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Binding="{Binding Text,ElementName=textBoxSerial1_val1}"></DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Button x:Name="btnSer2_val2" Content="{Binding Text, ElementName=textBoxSerial2_val2}" HorizontalAlignment="Left" Height="35" Margin="62,143,0,0" VerticalAlignment="Top" Width="58" FontSize="14" Click="btnSer2_val2_Click">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Binding="{Binding Text,ElementName=textBoxSerial2_val2}"></DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Button x:Name="btnSer2_val3" Content="{Binding Text, ElementName=textBoxSerial2_val3}" HorizontalAlignment="Left" Height="35" Margin="122,143,0,0" VerticalAlignment="Top" Width="58" FontSize="14" Click="btnSer2_val3_Click">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Binding="{Binding Text,ElementName=textBoxSerial2_val3}"></DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
 
</Grid>
</GroupBox>
 
 
</Grid>
</TabItem>
</TabControl>
</Grid>
<Grid x:Name="GridSettings" Background="#7B000000" HorizontalAlignment="Left" Width="233" Margin="23,36,0,0" Visibility="Collapsed">
970,7 → 1078,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">
<Grid x:Name="GridWP" Margin="23,36,25,0" Background="#7F000000" Height="500" 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"/>
<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
355,6 → 355,7
checkBoxGPXLog.IsChecked = _bGPXLog;
checkBoxShowWPRoute.IsChecked = _bShowWPRoute;
 
_initSerialCtrl();
}
/// <summary>
/// initialize the datatables
2673,6 → 2674,23
if(sVal != "") comboBoxRouteColor.SelectedIndex = Convert.ToInt32(sVal);
sVal = ini.IniReadValue("waypoints", "showWPRoute");
if(sVal != "") _bShowWPRoute = Convert.ToBoolean(sVal);
 
for (int i = 0; i < 12; i++)
{
sVal = ini.IniReadValue("serial", "ch" + i.ToString() + "Val");
if (sVal != "")
serChan[i] = Convert.ToInt16(sVal);
sVal = ini.IniReadValue("serial", "ch" + i.ToString() + "Title");
if (sVal != "")
serChanTitle[i] = sVal;
for (int y = 0; i < 4 && y < 3; y++)
{
sVal = ini.IniReadValue("serial", "ch" + i.ToString() + "ValSub" + y.ToString());
if (sVal != "")
serChan_sub[(i * 3) + y] = Convert.ToInt16(sVal);
}
}
 
}
catch (Exception e)
{
2759,6 → 2777,17
ini.IniWriteValue("waypoints", "coptercolor", comboBoxCopterColor.SelectedIndex.ToString());
ini.IniWriteValue("waypoints", "routecolor", comboBoxRouteColor.SelectedIndex.ToString());
ini.IniWriteValue("waypoints", "showWPRoute", _bShowWPRoute.ToString());
 
for (int i = 0; i < 12; i++)
{
ini.IniWriteValue("serial", "ch" + i.ToString() + "Val", serChan[i].ToString());
ini.IniWriteValue("serial", "ch" + i.ToString() + "Title", serChanTitle[i]);
for (int y = 0; i < 4 && y < 3; y++)
{
ini.IniWriteValue("serial", "ch" + i.ToString() + "ValSub" + y.ToString(), serChan_sub[(i * 3) + y].ToString());
}
}
 
}
catch (Exception e)
{
2766,7 → 2795,257
MessageBox.Show("Error writing ini-file!" + Environment.NewLine + "Please make sure that the programm is in a location where it is allowed to write" + Environment.NewLine + e.Message, "Write ini-file", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
#region serial channels
/// <summary>
/// Sending the serial channel values
/// </summary>
void _sendSerialData()
{
byte[] serData = new byte[12];
for (int i = 0; i < 12; i++)
{
serData[i] = unchecked((byte)(serChan[i] - 127));
}
_sendControllerMessage('y', 1, serData);
}
/// <summary>
/// init the controls for displaying
/// and setting serial control channels
/// </summary>
void _initSerialCtrl()
{
SerChan1ScaleSlider.Value = serChan[0];
textBoxSerial1.Text = serChanTitle[0];
SerChan2ScaleSlider.Value = serChan[1];
textBoxSerial2.Text = serChanTitle[1];
//SerChan3ScaleSlider.Value = serChan[2];
//textBoxSerial3.Text = serChanTitle[2];
//SerChan4ScaleSlider.Value = serChan[3];
//textBoxSerial4.Text = serChanTitle[3];
//trckbarSerial5.Value = serChan[4];
//textBoxSerial5.Text = serChanTitle[4];
//trckbarSerial6.Value = serChan[5];
//textBoxSerial6.Text = serChanTitle[5];
//trckbarSerial7.Value = serChan[6];
//textBoxSerial7.Text = serChanTitle[6];
//trckbarSerial8.Value = serChan[7];
//textBoxSerial8.Text = serChanTitle[7];
 
textBoxSerial1_val1.Text = serChan_sub[0].ToString();
textBoxSerial1_val2.Text = serChan_sub[1].ToString();
textBoxSerial1_val3.Text = serChan_sub[2].ToString();
textBoxSerial2_val1.Text = serChan_sub[3].ToString();
textBoxSerial2_val2.Text = serChan_sub[4].ToString();
textBoxSerial2_val3.Text = serChan_sub[5].ToString();
//textBoxSerial3_val1.Text = serChan_sub[6].ToString();
//textBoxSerial3_val2.Text = serChan_sub[7].ToString();
//textBoxSerial3_val3.Text = serChan_sub[8].ToString();
//textBoxSerial4_val1.Text = serChan_sub[9].ToString();
//textBoxSerial4_val2.Text = serChan_sub[10].ToString();
//textBoxSerial4_val3.Text = serChan_sub[11].ToString();
}
private void SerChan1ScaleSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (!_init)
{
serChan[0] = (int)SerChan1ScaleSlider.Value;
_sendSerialData();
}
}
private void textBoxSerial1_TextChanged(object sender, TextChangedEventArgs e)
{
if (!_init)
{
serChanTitle[0] = textBoxSerial1.Text;
}
}
private void textBoxSerial1_val1_TextChanged(object sender, TextChangedEventArgs e)
{
if (textBoxSerial1_val1.Text.Length > 0 & !_init)
{
serChan_sub[0] = Convert.ToInt16(textBoxSerial1_val1.Text);
}
}
private void textBoxSerial1_val2_TextChanged(object sender, TextChangedEventArgs e)
{
if (textBoxSerial1_val2.Text.Length > 0 & !_init)
{
serChan_sub[1] = Convert.ToInt16(textBoxSerial1_val2.Text);
}
}
private void textBoxSerial1_val3_TextChanged(object sender, TextChangedEventArgs e)
{
if (textBoxSerial1_val3.Text.Length > 0 & !_init)
{
serChan_sub[2] = Convert.ToInt16(textBoxSerial1_val3.Text);
}
}
private void btnSer1_val1_Click(object sender, RoutedEventArgs e)
{
if (textBoxSerial1_val1.Text.Length > 0)
{
SerChan1ScaleSlider.Value = Convert.ToInt16(textBoxSerial1_val1.Text);
}
}
private void btnSer1_0_Click(object sender, RoutedEventArgs e)
{
SerChan1ScaleSlider.Value = 0;
}
private void btnSer1_127_Click(object sender, RoutedEventArgs e)
{
SerChan1ScaleSlider.Value = 127;
}
private void btnSer1_254_Click(object sender, RoutedEventArgs e)
{
SerChan1ScaleSlider.Value = 254;
}
private void btnSer1_val2_Click(object sender, RoutedEventArgs e)
{
if (textBoxSerial1_val2.Text.Length > 0)
{
SerChan1ScaleSlider.Value = Convert.ToInt16(textBoxSerial1_val2.Text);
}
}
private void btnSer1_val3_Click(object sender, RoutedEventArgs e)
{
if (textBoxSerial1_val3.Text.Length > 0)
{
SerChan1ScaleSlider.Value = Convert.ToInt16(textBoxSerial1_val3.Text);
}
}
 
private void SerChan2ScaleSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (!_init)
{
serChan[1] = (int)SerChan2ScaleSlider.Value;
_sendSerialData();
}
}
private void textBoxSerial2_TextChanged(object sender, TextChangedEventArgs e)
{
if (!_init)
{
serChanTitle[1] = textBoxSerial2.Text;
}
}
private void textBoxSerial2_val1_TextChanged(object sender, TextChangedEventArgs e)
{
if (textBoxSerial2_val1.Text.Length > 0 & !_init)
{
serChan_sub[3] = Convert.ToInt16(textBoxSerial2_val1.Text);
}
}
private void textBoxSerial2_val2_TextChanged(object sender, TextChangedEventArgs e)
{
if (textBoxSerial2_val2.Text.Length > 0 & !_init)
{
serChan_sub[4] = Convert.ToInt16(textBoxSerial2_val2.Text);
}
}
private void textBoxSerial2_val3_TextChanged(object sender, TextChangedEventArgs e)
{
if (textBoxSerial2_val3.Text.Length > 0 & !_init)
{
serChan_sub[5] = Convert.ToInt16(textBoxSerial2_val3.Text);
}
}
private void btnSer2_0_Click(object sender, RoutedEventArgs e)
{
SerChan2ScaleSlider.Value = 0;
}
private void btnSer2_127_Click(object sender, RoutedEventArgs e)
{
SerChan2ScaleSlider.Value = 127;
}
private void btnSer2_254_Click(object sender, RoutedEventArgs e)
{
SerChan2ScaleSlider.Value = 254;
}
private void btnSer2_val1_Click(object sender, RoutedEventArgs e)
{
if (textBoxSerial2_val1.Text.Length > 0)
{
SerChan2ScaleSlider.Value = Convert.ToInt16(textBoxSerial2_val1.Text);
}
}
private void btnSer2_val2_Click(object sender, RoutedEventArgs e)
{
if (textBoxSerial2_val2.Text.Length > 0)
{
SerChan2ScaleSlider.Value = Convert.ToInt16(textBoxSerial2_val2.Text);
}
}
private void btnSer2_val3_Click(object sender, RoutedEventArgs e)
{
if (textBoxSerial2_val3.Text.Length > 0)
{
SerChan2ScaleSlider.Value = Convert.ToInt16(textBoxSerial2_val3.Text);
}
}
/// <summary>
/// checks the input of a textbox
/// for valid data
/// in this case values 0-254
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void textBox_serial_KeyPress(object sender, KeyEventArgs e)
{
if ("1234567890,\b".IndexOf(e.Key.ToString()) < 0) //general check for valid chars(0-9) and backspace (\b)
e.Handled = true;
else
if ("\b".IndexOf(e.Key.ToString()) < 0)
if (Convert.ToInt16(((TextBox)sender).Text + e.Key) > 254) //if valid and not backspace, check for upper limit of the resulting number
e.Handled = true;
else
{
int i = -1;
switch (((TextBox)sender).Name)
{
case "textBoxSerial1_val1":
i = 0;
break;
case "textBoxSerial1_val2":
i = 1;
break;
case "textBoxSerial1_val3":
i = 2;
break;
case "textBoxSerial2_val1":
i = 3;
break;
case "textBoxSerial2_val2":
i = 4;
break;
case "textBoxSerial2_val3":
i = 5;
break;
case "textBoxSerial3_val1":
i = 6;
break;
case "textBoxSerial3_val2":
i = 7;
break;
case "textBoxSerial3_val3":
i = 8;
break;
case "textBoxSerial4_val1":
i = 9;
break;
case "textBoxSerial4_val2":
i = 10;
break;
case "textBoxSerial4_val3":
i = 11;
break;
}
if (i > -1)
serChan_sub[i] = Convert.ToInt16(((TextBox)sender).Text + e.Key.ToString());
}
}
 
#endregion serial channels
#region WP
void _readWPLFile()
{