|
@@ -0,0 +1,122 @@
|
|
|
|
+<UserControl x:Class="MV485.uc.UCDeviceConfig"
|
|
|
|
+ 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:MV485.uc"
|
|
|
|
+ xmlns:zdfflatui="clr-namespace:ZdfFlatUI;assembly=WPF.UI"
|
|
|
|
+ mc:Ignorable="d"
|
|
|
|
+ Padding="5,2,5,5"
|
|
|
|
+ Background="WhiteSmoke"
|
|
|
|
+ d:DesignHeight="800" d:DesignWidth="1024">
|
|
|
|
+ <Grid>
|
|
|
|
+ <Grid.RowDefinitions>
|
|
|
|
+ <RowDefinition Height="Auto" />
|
|
|
|
+ <RowDefinition Height="*" />
|
|
|
|
+ </Grid.RowDefinitions>
|
|
|
|
+
|
|
|
|
+ <!-- 控制面板 -->
|
|
|
|
+ <StackPanel Orientation="Horizontal" Margin="10 10 10 5" >
|
|
|
|
+ <TextBlock Text="端口号: " VerticalAlignment="Center" FontSize="14px" Margin="0 0 0 0" />
|
|
|
|
+ <ComboBox x:Name="cmbPortNames" DisplayMemberPath="ModelName" SelectedValuePath="PortName"
|
|
|
|
+ Width="180" Padding="5 0 0 0" Margin="2" FontSize="13px" VerticalContentAlignment="Center"/>
|
|
|
|
+ <zdfflatui:FlatButton x:Name="btnRefreshPorts" HorizontalAlignment="Center" Background="#2196F3"
|
|
|
|
+ Foreground="White" Content="🔄" ToolTip="刷新并重新加载串口列表"
|
|
|
|
+ Click="btnRefreshPorts_Click" Margin="5 0 5 0" Width="30" Height="30" FontSize="20px" />
|
|
|
|
+
|
|
|
|
+ <TextBlock Text="设备波特率: " VerticalAlignment="Center" FontSize="14" Margin="10 0 0 0" />
|
|
|
|
+ <ComboBox x:Name="cmbBaudrate"
|
|
|
|
+ Width="100" Padding="5 0 0 0" Margin="2" FontSize="13px" VerticalContentAlignment="Center"/>
|
|
|
|
+
|
|
|
|
+ <TextBlock Text="设备地址: " VerticalAlignment="Center" FontSize="14" Margin="10 0 0 0" />
|
|
|
|
+ <TextBox x:Name="txtDevId" Text="1" FontSize="13" Width="60" Margin="0 0 0 0"
|
|
|
|
+ PreviewTextInput="TextBox_PreviewTextInput" MaxLength="3"
|
|
|
|
+ TextAlignment="Left" VerticalContentAlignment="Center" Height="24" />
|
|
|
|
+
|
|
|
|
+ <zdfflatui:FlatButton x:Name="btnReadConfig" Background="#4CAF50" Foreground="White" Content="读取485基本参数" Width="120"
|
|
|
|
+ Click="BtnReadConfig_Click" Padding="10 0 10 0" Height="28" FontSize="13" Margin="10 0 0 0" />
|
|
|
|
+
|
|
|
|
+ <!--<zdfflatui:FlatButton x:Name="btnClearLog" HorizontalAlignment="Center" Background="#FF4C4C" Foreground="White" Width="80"
|
|
|
|
+ Content="清空日志" Click="btnClearLog_Click" Padding="10 0 10 0" Height="28" FontSize="13" Margin="10 0 0 0" />-->
|
|
|
|
+ </StackPanel>
|
|
|
|
+
|
|
|
|
+ <Border Grid.Row="1" Margin="10" BorderBrush="DarkGray" BorderThickness="1">
|
|
|
|
+ <Grid>
|
|
|
|
+ <Grid.ColumnDefinitions>
|
|
|
|
+ <ColumnDefinition Width="300" />
|
|
|
|
+ <ColumnDefinition Width="*" />
|
|
|
|
+ </Grid.ColumnDefinitions>
|
|
|
|
+
|
|
|
|
+ <Border Grid.Column="0" BorderBrush="DarkGray" BorderThickness="0 0 1 0" Background="White" >
|
|
|
|
+ <StackPanel Orientation="Vertical" Margin="10 0 0 0">
|
|
|
|
+ <StackPanel Orientation="Horizontal" Height="50">
|
|
|
|
+ <TextBlock Text="设备类型" Width="80" VerticalAlignment="Center" FontSize="14" />
|
|
|
|
+ <TextBox IsEnabled="False" x:Name="txtDevType" VerticalContentAlignment="Center"
|
|
|
|
+ Text="0x4001" FontSize="14" Width="120" Height="26" Padding="5 0 0 0" />
|
|
|
|
+ <TextBlock Text="只读" FontSize="14" Foreground="Gray" Margin="20 0 0 0"
|
|
|
|
+ VerticalAlignment="Center" />
|
|
|
|
+ </StackPanel>
|
|
|
|
+
|
|
|
|
+ <StackPanel Orientation="Horizontal" Height="50">
|
|
|
|
+ <TextBlock Text="设备序号" Width="80" VerticalAlignment="Center" FontSize="14" />
|
|
|
|
+ <TextBox IsEnabled="False" x:Name="txtDevSn" VerticalContentAlignment="Center"
|
|
|
|
+ Text="240505102203" FontSize="14" Width="120" Height="26" Padding="5 0 0 0" />
|
|
|
|
+ <TextBlock Text="只读" FontSize="14" Foreground="Gray" Margin="20 0 0 0"
|
|
|
|
+ VerticalAlignment="Center" />
|
|
|
|
+ </StackPanel>
|
|
|
|
+
|
|
|
|
+ <StackPanel Orientation="Horizontal" Height="50">
|
|
|
|
+ <TextBlock Text="校验和" Width="80" VerticalAlignment="Center" FontSize="14" />
|
|
|
|
+ <TextBox IsEnabled="False" x:Name="txtParty" VerticalContentAlignment="Center"
|
|
|
|
+ Text="None" FontSize="14" Width="120" Height="26" Padding="5 0 0 0" />
|
|
|
|
+ <TextBlock Text="只读" FontSize="14" Foreground="Gray" Margin="20 0 0 0"
|
|
|
|
+ VerticalAlignment="Center" />
|
|
|
|
+ </StackPanel>
|
|
|
|
+
|
|
|
|
+ <StackPanel Orientation="Horizontal" Height="50">
|
|
|
|
+ <TextBlock Text="数据位" Width="80" VerticalAlignment="Center" FontSize="14" />
|
|
|
|
+ <TextBox IsEnabled="False" x:Name="txtDataBits" VerticalContentAlignment="Center"
|
|
|
|
+ Text="8" FontSize="14" Width="120" Height="26" Padding="5 0 0 0" />
|
|
|
|
+ <TextBlock Text="只读" FontSize="14" Foreground="Gray" Margin="20 0 0 0"
|
|
|
|
+ VerticalAlignment="Center" />
|
|
|
|
+ </StackPanel>
|
|
|
|
+
|
|
|
|
+ <StackPanel Orientation="Horizontal" Height="50">
|
|
|
|
+ <TextBlock Text="停止位" Width="80" VerticalAlignment="Center" FontSize="14" />
|
|
|
|
+ <TextBox IsEnabled="False" x:Name="txtStopBits" VerticalContentAlignment="Center"
|
|
|
|
+ Text="1" FontSize="14" Width="120" Height="26" Padding="5 0 0 0" />
|
|
|
|
+ <TextBlock Text="只读" FontSize="14" Foreground="Gray" Margin="20 0 0 0"
|
|
|
|
+ VerticalAlignment="Center" />
|
|
|
|
+ </StackPanel>
|
|
|
|
+
|
|
|
|
+ <StackPanel Orientation="Horizontal" Height="50">
|
|
|
|
+ <TextBlock Text="设备波特率" Width="80" VerticalAlignment="Center" FontSize="14" />
|
|
|
|
+ <!--<TextBox IsEnabled="True" x:Name="txtDevBaudrate" VerticalContentAlignment="Center"
|
|
|
|
+ Text="240505102203" FontSize="14" Width="120" Height="26" Padding="5 0 0 0" />-->
|
|
|
|
+ <ComboBox x:Name="cmbDevBaudrate" Width="120" Padding="5 0 0 0" Margin="0" FontSize="14"
|
|
|
|
+ VerticalContentAlignment="Center" Height="28" IsEditable="True"/>
|
|
|
|
+ <zdfflatui:FlatButton x:Name="btnSetBaudrate" Background="#2196F3" Foreground="White"
|
|
|
|
+ Content="设置" Width="60" Click="BtnSetBaudrate_Click"
|
|
|
|
+ Padding="10 0 10 0" Height="28" FontSize="14" Margin="10 0 0 0" />
|
|
|
|
+ </StackPanel>
|
|
|
|
+
|
|
|
|
+ <StackPanel Orientation="Horizontal" Height="50">
|
|
|
|
+ <TextBlock Text="设备地址" Width="80" VerticalAlignment="Center" FontSize="14" />
|
|
|
|
+ <TextBox IsEnabled="True" x:Name="txtDevAddress" VerticalContentAlignment="Center"
|
|
|
|
+ Text="1" FontSize="14" Width="40" Height="26" Padding="5 0 0 0" />
|
|
|
|
+ <TextBlock Text="范围:1~247" Width="80" Foreground="OrangeRed" VerticalAlignment="Center" Padding="6 0 0 0" FontSize="14" />
|
|
|
|
+ <zdfflatui:FlatButton x:Name="btnSetDevAddress" Background="#2196F3" Foreground="White"
|
|
|
|
+ Content="设置" Width="60" Click="BtnSetDevAddress_Click"
|
|
|
|
+ Padding="10 0 10 0" Height="28" FontSize="14" Margin="10 0 0 0" />
|
|
|
|
+ </StackPanel>
|
|
|
|
+
|
|
|
|
+ </StackPanel>
|
|
|
|
+ </Border>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ </Grid>
|
|
|
|
+ </Border>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ </Grid>
|
|
|
|
+</UserControl>
|