You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
6.5 KiB
116 lines
6.5 KiB
<UserControl x:Class="MultiTerm.Wpf.View.SendReceiveView"
|
|
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:types="clr-namespace:MultiTerm.Core.Types;assembly=MultiTerm.Core"
|
|
xmlns:settings_view="clr-namespace:MultiTerm.Wpf.View.SettingsView"
|
|
xmlns:custom_controls="clr-namespace:MultiTerm.Wpf.CustomControl;assembly=MultiTerm.Wpf.CustomControl"
|
|
xmlns:behaviors="http://schemas.microsoft.com/xaml/behaviors"
|
|
mc:Ignorable="d"
|
|
d:DesignHeight="450" d:DesignWidth="800">
|
|
<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>
|
|
</UserControl.Resources>
|
|
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="5*"/>
|
|
<RowDefinition Height="3*"/>
|
|
</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>
|
|
</ContentControl.Resources>
|
|
</ContentControl>
|
|
</GroupBox>
|
|
|
|
<!-- Display settings -->
|
|
<GroupBox Header="Display" 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}}">
|
|
</ComboBox>
|
|
</DockPanel>
|
|
</GroupBox>
|
|
|
|
<!-- Data View -->
|
|
<GroupBox Header="Receive" Grid.Row="2" Padding="5">
|
|
<!-- Received Data View -->
|
|
<custom_controls:MultiFormatDataView x:Name="mfdvReceive" DataSource="{Binding ReceivedData}">
|
|
|
|
<behaviors:Interaction.Triggers>
|
|
<behaviors:EventTrigger EventName="ClearRequested" SourceObject="{Binding ElementName=mfdvReceive}">
|
|
<behaviors:InvokeCommandAction Command="{Binding ReceivedData.ClearCommand}" />
|
|
</behaviors:EventTrigger>
|
|
</behaviors:Interaction.Triggers>
|
|
</custom_controls:MultiFormatDataView>
|
|
</GroupBox>
|
|
<GroupBox Header="Send" Grid.Row="3" Padding="5">
|
|
<DockPanel>
|
|
<!-- Send text box -->
|
|
<DockPanel DockPanel.Dock="Top" LastChildFill="True">
|
|
<ComboBox DockPanel.Dock="Right" 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}}">
|
|
</ComboBox>
|
|
<Label DockPanel.Dock="Right" Content="Send on Enter:"/>
|
|
<Button DockPanel.Dock="Right" Content="Send" Margin="0 0 10 0" Padding="10 0" Command="{Binding SendCommand}"/>
|
|
|
|
<custom_controls:MultiFormatTextBox x:Name="sendTextBox" DockPanel.Dock="Left"
|
|
CurrentMultiFormatString="{Binding Path=SendableData, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
|
|
|
|
<behaviors:Interaction.Triggers>
|
|
<behaviors:EventTrigger EventName="EnterPressed" SourceObject="{Binding ElementName=sendTextBox}">
|
|
<behaviors:InvokeCommandAction Command="{Binding SendCommand}" />
|
|
</behaviors:EventTrigger>
|
|
</behaviors:Interaction.Triggers>
|
|
</custom_controls:MultiFormatTextBox>
|
|
</DockPanel>
|
|
<Separator/>
|
|
|
|
<!-- Sent Data View -->
|
|
<custom_controls:MultiFormatDataView x:Name="mfdvSend" DataSource="{Binding SentData}">
|
|
|
|
<behaviors:Interaction.Triggers>
|
|
<behaviors:EventTrigger EventName="ClearRequested" SourceObject="{Binding ElementName=mfdvSend}">
|
|
<behaviors:InvokeCommandAction Command="{Binding SentData.ClearCommand}" />
|
|
</behaviors:EventTrigger>
|
|
</behaviors:Interaction.Triggers>
|
|
</custom_controls:MultiFormatDataView>
|
|
|
|
</DockPanel>
|
|
</GroupBox>
|
|
</Grid>
|
|
</UserControl>
|
|
|