参数配置界面弹窗添加
This commit is contained in:
136
SettingModule/Views/Dialogs/SerialPortConfigView.xaml
Normal file
136
SettingModule/Views/Dialogs/SerialPortConfigView.xaml
Normal file
@@ -0,0 +1,136 @@
|
||||
<UserControl x:Class="SettingModule.Views.Dialogs.SerialPortConfigView"
|
||||
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:local="clr-namespace:SettingModule.Views.Dialogs"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:helpers="clr-namespace:UIShare.Helpers;assembly=UIShare"
|
||||
xmlns:converters="clr-namespace:UIShare.Converters;assembly=UIShare"
|
||||
mc:Ignorable="d"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
Background="White"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
Width="440"
|
||||
Height="430">
|
||||
<prism:Dialog.WindowStyle>
|
||||
<Style TargetType="Window">
|
||||
<Setter Property="ResizeMode" Value="NoResize"/>
|
||||
|
||||
<Setter Property="SizeToContent" Value="WidthAndHeight"/>
|
||||
</Style>
|
||||
</prism:Dialog.WindowStyle>
|
||||
|
||||
<UserControl.Resources>
|
||||
<converters:StringToVisibilityConverter x:Key="StringToVisibility"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<GroupBox Padding="12,8,12,8"
|
||||
Header="{Binding Title}"
|
||||
helpers:WindowDragHelper.EnableWindowDrag="True">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 表单 -->
|
||||
<Grid Grid.Row="0" Margin="0,4,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
Text="串口名称:"
|
||||
VerticalAlignment="Center" Margin="0,6"/>
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" Margin="0,6"
|
||||
IsEditable="True"
|
||||
ItemsSource="{Binding AvailablePorts}"
|
||||
Text="{Binding Config.PortName, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<Button Grid.Row="0" Grid.Column="2" Margin="6,6,0,6"
|
||||
Padding="8,0" Content="刷新"
|
||||
Command="{Binding RefreshPortsCommand}"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
Text="波特率:"
|
||||
VerticalAlignment="Center" Margin="0,6"/>
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,6"
|
||||
IsEditable="True"
|
||||
ItemsSource="{Binding CommonBaudRates}"
|
||||
Text="{Binding Config.BaudRate, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
Text="数据位:"
|
||||
VerticalAlignment="Center" Margin="0,6"/>
|
||||
<ComboBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,6"
|
||||
ItemsSource="{Binding DataBitsList}"
|
||||
SelectedItem="{Binding Config.DataBits}"/>
|
||||
|
||||
<TextBlock Grid.Row="3" Grid.Column="0"
|
||||
Text="停止位:"
|
||||
VerticalAlignment="Center" Margin="0,6"/>
|
||||
<ComboBox Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,6"
|
||||
ItemsSource="{Binding StopBitsList}"
|
||||
SelectedItem="{Binding Config.StopBits}"/>
|
||||
|
||||
<TextBlock Grid.Row="4" Grid.Column="0"
|
||||
Text="校验位:"
|
||||
VerticalAlignment="Center" Margin="0,6"/>
|
||||
<ComboBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,6"
|
||||
ItemsSource="{Binding ParityList}"
|
||||
SelectedItem="{Binding Config.Parity}"/>
|
||||
|
||||
<TextBlock Grid.Row="5" Grid.Column="0"
|
||||
Text="读取超时(ms):"
|
||||
VerticalAlignment="Center" Margin="0,6"/>
|
||||
<ComboBox Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,6"
|
||||
IsEditable="True"
|
||||
ItemsSource="{Binding CommonTimeouts}"
|
||||
Text="{Binding Config.ReadTimeout, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
|
||||
<TextBlock Grid.Row="6" Grid.Column="0"
|
||||
Text="写入超时(ms):"
|
||||
VerticalAlignment="Center" Margin="0,6"/>
|
||||
<ComboBox Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,6"
|
||||
IsEditable="True"
|
||||
ItemsSource="{Binding CommonTimeouts}"
|
||||
Text="{Binding Config.WriteTimeout, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- 错误提示 -->
|
||||
<TextBlock Grid.Row="1"
|
||||
Margin="0,8,0,0"
|
||||
Foreground="#D32F2F"
|
||||
TextWrapping="Wrap"
|
||||
Text="{Binding ErrorMessage}"
|
||||
Visibility="{Binding ErrorMessage, Converter={StaticResource StringToVisibility}}"/>
|
||||
|
||||
<!-- 按钮 -->
|
||||
<StackPanel Grid.Row="2"
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,12,0,0">
|
||||
<Button Content="取消"
|
||||
Width="80" Padding="0,4"
|
||||
Command="{Binding CancelCommand}"/>
|
||||
<Button Content="保存"
|
||||
Width="80" Padding="0,4"
|
||||
Margin="10,0,0,0"
|
||||
IsDefault="True"
|
||||
Command="{Binding SaveCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</UserControl>
|
||||
Reference in New Issue
Block a user