186 lines
8.1 KiB
XML
186 lines
8.1 KiB
XML
<UserControl x:Class="ProcessManager.Setting"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
|
xmlns:local="clr-namespace:ProcessManager"
|
|
|
|
Width="800">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition />
|
|
<ColumnDefinition />
|
|
</Grid.ColumnDefinitions>
|
|
<StackPanel Margin="16"
|
|
Orientation="Vertical">
|
|
|
|
<!-- 子程序路径 -->
|
|
<StackPanel Orientation="Horizontal"
|
|
Margin="0 5">
|
|
<TextBlock Margin="0 5"
|
|
Text="子程序路径:"
|
|
materialDesign:HintAssist.Hint="子程序路径" />
|
|
<TextBox Text="{Binding Config.SubProgramFilePath,Mode=TwoWay}"
|
|
materialDesign:HintAssist.Hint="子程序路径"
|
|
Margin="0,0,0,8" />
|
|
</StackPanel>
|
|
|
|
|
|
<!-- 默认程序 -->
|
|
<StackPanel Orientation="Horizontal"
|
|
Margin="0 5">
|
|
<TextBlock Margin="0 5"
|
|
Text="子程序路径:"
|
|
materialDesign:HintAssist.Hint="子程序路径" />
|
|
<TextBox Text="{Binding Config.DefaultSubProgramFilePath,Mode=TwoWay}"
|
|
materialDesign:HintAssist.Hint="默认程序"
|
|
Margin="0,0,0,16" />
|
|
</StackPanel>
|
|
<!-- 设备列表 -->
|
|
<ListBox ItemsSource="{Binding Devices}"
|
|
SelectedItem="{Binding SelectedDevice, Mode=TwoWay}">
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<StackPanel Orientation="Horizontal"
|
|
Margin="4">
|
|
<TextBlock Text="{Binding DeviceName}"
|
|
FontSize="14"
|
|
materialDesign:HintAssist.Hint="设备名称" />
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
</StackPanel>
|
|
|
|
|
|
<StackPanel Grid.Column="1"
|
|
DataContext="{Binding SelectedDevice}">
|
|
<!-- 设备名称 -->
|
|
<StackPanel Orientation="Horizontal"
|
|
Margin="0,2">
|
|
<TextBlock Text="设备名称:"
|
|
Width="120"
|
|
VerticalAlignment="Center" />
|
|
<TextBox Text="{Binding DeviceName, Mode=TwoWay}"
|
|
Width="200" />
|
|
</StackPanel>
|
|
|
|
<!-- TCP相关 -->
|
|
<StackPanel Orientation="Vertical">
|
|
<StackPanel.Style>
|
|
<Style TargetType="StackPanel">
|
|
<Setter Property="Visibility"
|
|
Value="Collapsed" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding DataContext.SelectedDeviceType, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
|
Value="False">
|
|
<Setter Property="Visibility"
|
|
Value="Visible" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</StackPanel.Style>
|
|
|
|
<StackPanel Orientation="Horizontal"
|
|
Margin="0,2">
|
|
<TextBlock Text="IP地址:"
|
|
Width="120"
|
|
VerticalAlignment="Center" />
|
|
<TextBox Text="{Binding CommunicationConfig.IPAddress, Mode=TwoWay}"
|
|
Width="200" />
|
|
</StackPanel>
|
|
<StackPanel Orientation="Horizontal"
|
|
Margin="0,2">
|
|
<TextBlock Text="端口:"
|
|
Width="120"
|
|
VerticalAlignment="Center" />
|
|
<TextBox Text="{Binding CommunicationConfig.Port, Mode=TwoWay}"
|
|
Width="200" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
|
|
<!-- 串口相关 -->
|
|
<StackPanel Orientation="Vertical">
|
|
<StackPanel.Style>
|
|
<Style TargetType="StackPanel">
|
|
<Setter Property="Visibility"
|
|
Value="Collapsed" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding DataContext.SelectedDeviceType, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
|
Value="True">
|
|
<Setter Property="Visibility"
|
|
Value="Visible" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</StackPanel.Style>
|
|
|
|
<StackPanel Orientation="Horizontal"
|
|
Margin="0,2">
|
|
<TextBlock Text="串口:"
|
|
Width="120"
|
|
VerticalAlignment="Center" />
|
|
<TextBox Text="{Binding CommunicationConfig.COMPort, Mode=TwoWay}"
|
|
Width="200" />
|
|
</StackPanel>
|
|
<StackPanel Orientation="Horizontal"
|
|
Margin="0,2">
|
|
<TextBlock Text="波特率:"
|
|
Width="120"
|
|
VerticalAlignment="Center" />
|
|
<TextBox Text="{Binding CommunicationConfig.BaudRate, Mode=TwoWay}"
|
|
Width="200" />
|
|
</StackPanel>
|
|
<StackPanel Orientation="Horizontal"
|
|
Margin="0,2">
|
|
<TextBlock Text="数据位:"
|
|
Width="120"
|
|
VerticalAlignment="Center" />
|
|
<TextBox Text="{Binding CommunicationConfig.DataBit, Mode=TwoWay}"
|
|
Width="200" />
|
|
</StackPanel>
|
|
<StackPanel Orientation="Horizontal"
|
|
Margin="0,2">
|
|
<TextBlock Text="停止位:"
|
|
Width="120"
|
|
VerticalAlignment="Center" />
|
|
<TextBox Text="{Binding CommunicationConfig.StopBit, Mode=TwoWay}"
|
|
Width="200" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
|
|
<!-- 公共超时 -->
|
|
<StackPanel Orientation="Horizontal"
|
|
Margin="0,2">
|
|
<TextBlock Text="读取超时:"
|
|
Width="120"
|
|
VerticalAlignment="Center" />
|
|
<TextBox Text="{Binding CommunicationConfig.ReadTimeout, Mode=TwoWay}"
|
|
Width="200" />
|
|
</StackPanel>
|
|
<StackPanel Orientation="Horizontal"
|
|
Margin="0,2">
|
|
<TextBlock Text="写入超时:"
|
|
Width="120"
|
|
VerticalAlignment="Center" />
|
|
<TextBox Text="{Binding CommunicationConfig.WriteTimeout, Mode=TwoWay}"
|
|
Width="200" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
|
|
|
|
|
|
|
|
<StackPanel Orientation="Horizontal"
|
|
Grid.ColumnSpan="2"
|
|
VerticalAlignment="Bottom"
|
|
HorizontalAlignment="Center"
|
|
Margin="20 5">
|
|
<Button Command="{Binding SaveCommand}"
|
|
Margin="10 0"
|
|
Content="保存" />
|
|
<Button Command="{Binding CancelCommand}"
|
|
Content="取消" />
|
|
</StackPanel>
|
|
</Grid>
|
|
</UserControl>
|