|
|
|
@ -0,0 +1,119 @@ |
|
|
|
|
|
|
|
<UserControl x:Class="MultiTerm.Wpf.View.ConsoleView" |
|
|
|
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|
|
|
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|
|
|
|
|
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|
|
|
|
|
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|
|
|
|
|
|
|
xmlns:sys="clr-namespace:System;assembly=mscorlib" |
|
|
|
|
|
|
|
xmlns:local="clr-namespace:MultiTerm.Wpf.View" |
|
|
|
|
|
|
|
xmlns:conv="clr-namespace:MultiTerm.Wpf.ValueConverters" |
|
|
|
|
|
|
|
xmlns:protocol_serial="clr-namespace:MultiTerm.Protocols.Serial;assembly=MultiTerm.Protocols" |
|
|
|
|
|
|
|
xmlns:protocol_usbhid="clr-namespace:MultiTerm.Protocols.UsbHid;assembly=MultiTerm.Protocols" |
|
|
|
|
|
|
|
xmlns:protocol_udp="clr-namespace:MultiTerm.Protocols.Udp;assembly=MultiTerm.Protocols" |
|
|
|
|
|
|
|
xmlns:protocol_tcp="clr-namespace:MultiTerm.Protocols.Tcp;assembly=MultiTerm.Protocols" |
|
|
|
|
|
|
|
xmlns:types="clr-namespace:MultiTerm.Core.Types;assembly=MultiTerm.Core" |
|
|
|
|
|
|
|
xmlns:settings_view="clr-namespace:MultiTerm.Wpf.View.SettingsView" |
|
|
|
|
|
|
|
mc:Ignorable="d" |
|
|
|
|
|
|
|
d:DesignHeight="450" d:DesignWidth="800" |
|
|
|
|
|
|
|
Loaded="UserControl_Loaded"> |
|
|
|
|
|
|
|
<UserControl.Resources> |
|
|
|
|
|
|
|
<!-- Value Converters --> |
|
|
|
|
|
|
|
<conv:EnumValueToEnumDescriptionConverter x:Key="EnumValToDescConverter"/> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Data Sources --> |
|
|
|
|
|
|
|
<ObjectDataProvider x:Key="NewlineSeparatorTypeValues" |
|
|
|
|
|
|
|
ObjectType="{x:Type sys:Enum}" |
|
|
|
|
|
|
|
MethodName="GetValues"> |
|
|
|
|
|
|
|
<ObjectDataProvider.MethodParameters> |
|
|
|
|
|
|
|
<x:Type TypeName="types:NewlineSeparatorType" /> |
|
|
|
|
|
|
|
</ObjectDataProvider.MethodParameters> |
|
|
|
|
|
|
|
</ObjectDataProvider> |
|
|
|
|
|
|
|
<ObjectDataProvider x:Key="EncodingTypeValues" |
|
|
|
|
|
|
|
ObjectType="{x:Type sys:Enum}" |
|
|
|
|
|
|
|
MethodName="GetValues"> |
|
|
|
|
|
|
|
<ObjectDataProvider.MethodParameters> |
|
|
|
|
|
|
|
<x:Type TypeName="types:EncodingType" /> |
|
|
|
|
|
|
|
</ObjectDataProvider.MethodParameters> |
|
|
|
|
|
|
|
</ObjectDataProvider> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Styling for all data items --> |
|
|
|
|
|
|
|
<Style x:Key="DataContainerFontStyle" TargetType="{x:Type Control}"> |
|
|
|
|
|
|
|
<Setter Property="FontFamily" Value="Consolas"/> |
|
|
|
|
|
|
|
<Setter Property="FontSize" Value="14"/> |
|
|
|
|
|
|
|
<Setter Property="FontWeight" Value="ExtraLight"/> |
|
|
|
|
|
|
|
</Style> |
|
|
|
|
|
|
|
</UserControl.Resources> |
|
|
|
|
|
|
|
<Grid> |
|
|
|
|
|
|
|
<Grid.ColumnDefinitions> |
|
|
|
|
|
|
|
<ColumnDefinition Width="*"/> |
|
|
|
|
|
|
|
</Grid.ColumnDefinitions> |
|
|
|
|
|
|
|
<Grid.RowDefinitions> |
|
|
|
|
|
|
|
<RowDefinition Height="Auto"/> |
|
|
|
|
|
|
|
<RowDefinition Height="Auto"/> |
|
|
|
|
|
|
|
<RowDefinition Height="*"/> |
|
|
|
|
|
|
|
<RowDefinition Height="Auto"/> |
|
|
|
|
|
|
|
</Grid.RowDefinitions> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Settings View Model --> |
|
|
|
|
|
|
|
<GroupBox Header="Protocol Settings" Grid.Row="0" Grid.Column="0" Padding="5 1"> |
|
|
|
|
|
|
|
<!-- Register additional Settings ViewModels here --> |
|
|
|
|
|
|
|
<ContentControl Content="{Binding ProtocolSettings}"> |
|
|
|
|
|
|
|
<ContentControl.Resources> |
|
|
|
|
|
|
|
<DataTemplate DataType="{x:Type protocol_serial:SerialProtocolSettingsViewModel}"> |
|
|
|
|
|
|
|
<settings_view:SerialSettingsView/> |
|
|
|
|
|
|
|
</DataTemplate> |
|
|
|
|
|
|
|
<DataTemplate DataType="{x:Type protocol_usbhid:UsbHidProtocolSettingsViewModel}"> |
|
|
|
|
|
|
|
<settings_view:UsbHidSettingsView/> |
|
|
|
|
|
|
|
</DataTemplate> |
|
|
|
|
|
|
|
<DataTemplate DataType="{x:Type protocol_udp:UdpProtocolSettingsViewModel}"> |
|
|
|
|
|
|
|
<settings_view:UdpSettingsView/> |
|
|
|
|
|
|
|
</DataTemplate> |
|
|
|
|
|
|
|
<DataTemplate DataType="{x:Type protocol_tcp:TcpClientProtocolSettingsViewModel}"> |
|
|
|
|
|
|
|
<settings_view:TcpClientSettingsView/> |
|
|
|
|
|
|
|
</DataTemplate> |
|
|
|
|
|
|
|
</ContentControl.Resources> |
|
|
|
|
|
|
|
</ContentControl> |
|
|
|
|
|
|
|
</GroupBox> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Settings --> |
|
|
|
|
|
|
|
<GroupBox Header="Settings" Grid.Row="1" Grid.Column="0" Padding="5 1"> |
|
|
|
|
|
|
|
<DockPanel LastChildFill="False"> |
|
|
|
|
|
|
|
<Label DockPanel.Dock="Left" Margin="0 0 5 0" VerticalContentAlignment="Center" Content="Newline Separator"/> |
|
|
|
|
|
|
|
<ComboBox DockPanel.Dock="Left" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto" |
|
|
|
|
|
|
|
ItemsSource="{Binding Source={StaticResource NewlineSeparatorTypeValues}, Converter={StaticResource EnumValToDescConverter}}" |
|
|
|
|
|
|
|
SelectedItem="{Binding Path=DataDisplayNewlineSeparatorType, Mode=TwoWay, |
|
|
|
|
|
|
|
UpdateSourceTrigger=PropertyChanged, |
|
|
|
|
|
|
|
Converter={StaticResource EnumValToDescConverter}}"/> |
|
|
|
|
|
|
|
<Label DockPanel.Dock="Left" Margin="20 0 5 0" VerticalContentAlignment="Center" Content="Newline on Send"/> |
|
|
|
|
|
|
|
<ComboBox DockPanel.Dock="Left" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto" |
|
|
|
|
|
|
|
ItemsSource="{Binding Source={StaticResource NewlineSeparatorTypeValues}, Converter={StaticResource EnumValToDescConverter}}" |
|
|
|
|
|
|
|
SelectedItem="{Binding Path=SendNewlineSeparatorType, Mode=TwoWay, |
|
|
|
|
|
|
|
UpdateSourceTrigger=PropertyChanged, |
|
|
|
|
|
|
|
Converter={StaticResource EnumValToDescConverter}}"/> |
|
|
|
|
|
|
|
<Label DockPanel.Dock="Left" Margin="20 0 5 0" VerticalContentAlignment="Center" Content="Encoding"/> |
|
|
|
|
|
|
|
<ComboBox DockPanel.Dock="Left" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto" |
|
|
|
|
|
|
|
ItemsSource="{Binding Source={StaticResource EncodingTypeValues}, Converter={StaticResource EnumValToDescConverter}}" |
|
|
|
|
|
|
|
SelectedItem="{Binding Path=SelectedEncodingType, Mode=TwoWay, |
|
|
|
|
|
|
|
UpdateSourceTrigger=PropertyChanged, |
|
|
|
|
|
|
|
Converter={StaticResource EnumValToDescConverter}}"/> |
|
|
|
|
|
|
|
<Button Content="Clear" DockPanel.Dock="Right" Padding="10 3" Command="{Binding ClearDataCommand}"/> |
|
|
|
|
|
|
|
</DockPanel> |
|
|
|
|
|
|
|
</GroupBox> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Data view --> |
|
|
|
|
|
|
|
<TextBox Grid.Row="2" Padding="5" Margin="0 5" |
|
|
|
|
|
|
|
IsReadOnly="True" |
|
|
|
|
|
|
|
TextWrapping="Wrap" |
|
|
|
|
|
|
|
ScrollViewer.VerticalScrollBarVisibility="Auto" |
|
|
|
|
|
|
|
ScrollViewer.CanContentScroll="true" |
|
|
|
|
|
|
|
ScrollViewer.PanningMode="VerticalOnly" |
|
|
|
|
|
|
|
Text="{Binding Path=Data}" |
|
|
|
|
|
|
|
TextChanged="DataTextBox_TextChanged" |
|
|
|
|
|
|
|
Style="{StaticResource DataContainerFontStyle}"/> |
|
|
|
|
|
|
|
<!-- Sendable Message Input --> |
|
|
|
|
|
|
|
<TextBox Grid.Row="3" Padding="5 3" Margin="0 5" |
|
|
|
|
|
|
|
AllowDrop="False" |
|
|
|
|
|
|
|
Text="{Binding Path=SendableMessage, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" |
|
|
|
|
|
|
|
Style="{StaticResource DataContainerFontStyle}" |
|
|
|
|
|
|
|
PreviewKeyDown="SendableMessageTextBox_PreviewKeyDown"/> |
|
|
|
|
|
|
|
</Grid> |
|
|
|
|
|
|
|
</UserControl> |