2025-07-19 11:11:01 +08:00
|
|
|
<ui:ContentDialog x:Class="DMS.WPF.Views.Dialogs.DeviceDialog"
|
2025-07-01 21:34:20 +08:00
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
|
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
|
|
|
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
|
|
|
|
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
2025-07-26 10:05:43 +08:00
|
|
|
xmlns:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
2025-07-18 19:56:00 +08:00
|
|
|
xmlns:ex="clr-namespace:DMS.Extensions"
|
2025-07-26 10:05:43 +08:00
|
|
|
xmlns:enums="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
2025-07-27 21:08:58 +08:00
|
|
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
2025-07-27 22:35:07 +08:00
|
|
|
xmlns:vc="clr-namespace:DMS.WPF.ValueConverts"
|
2025-07-01 21:34:20 +08:00
|
|
|
Title="{Binding Title}"
|
|
|
|
|
CloseButtonText="取消"
|
|
|
|
|
DefaultButton="Primary"
|
|
|
|
|
PrimaryButtonText="{Binding PrimaryButContent}"
|
|
|
|
|
d:DataContext="{d:DesignInstance vmd:DeviceDialogViewModel}"
|
|
|
|
|
mc:Ignorable="d">
|
2025-07-27 21:08:58 +08:00
|
|
|
|
|
|
|
|
<i:Interaction.Triggers>
|
|
|
|
|
<i:EventTrigger EventName="PrimaryButtonClick">
|
|
|
|
|
<i:InvokeCommandAction Command="{Binding SaveCommand}" />
|
|
|
|
|
</i:EventTrigger>
|
|
|
|
|
<i:EventTrigger EventName="CloseButtonClick">
|
|
|
|
|
<i:InvokeCommandAction Command="{Binding CancelCommand}" />
|
|
|
|
|
</i:EventTrigger>
|
|
|
|
|
</i:Interaction.Triggers>
|
|
|
|
|
|
2025-06-20 18:53:29 +08:00
|
|
|
<ui:ContentDialog.Resources>
|
2025-07-01 21:34:20 +08:00
|
|
|
<ex:EnumBindingSource x:Key="deviceType"
|
2025-07-26 10:05:43 +08:00
|
|
|
EnumType="{x:Type enums:DeviceType}" />
|
2025-07-01 21:34:20 +08:00
|
|
|
<ex:EnumBindingSource x:Key="protocolType"
|
2025-07-26 10:05:43 +08:00
|
|
|
EnumType="{x:Type enums:ProtocolType}" />
|
2025-07-27 21:58:50 +08:00
|
|
|
<ex:EnumBindingSource x:Key="cpuType"
|
|
|
|
|
EnumType="{x:Type enums:CpuType}" />
|
2025-06-23 17:01:06 +08:00
|
|
|
<vc:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
2025-07-27 22:35:07 +08:00
|
|
|
<vc:EnumToStringConverter x:Key="EnumToStringConverter" />
|
2025-07-01 21:34:20 +08:00
|
|
|
|
|
|
|
|
|
2025-06-20 18:53:29 +08:00
|
|
|
</ui:ContentDialog.Resources>
|
2025-07-01 21:34:20 +08:00
|
|
|
|
|
|
|
|
<Grid Width="480"
|
|
|
|
|
Margin="10">
|
2025-07-01 11:11:02 +08:00
|
|
|
<Grid.ColumnDefinitions>
|
2025-07-01 21:34:20 +08:00
|
|
|
<ColumnDefinition Width="1*" />
|
|
|
|
|
<ColumnDefinition Width="1*" />
|
2025-07-01 11:11:02 +08:00
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
<!-- 左边列 -->
|
2025-07-01 21:34:20 +08:00
|
|
|
<ikw:SimpleStackPanel Grid.Column="0"
|
|
|
|
|
Margin="10 10 20 10 "
|
|
|
|
|
Spacing="12">
|
2025-07-01 11:11:02 +08:00
|
|
|
<!-- 设备名称 -->
|
2025-07-01 21:34:20 +08:00
|
|
|
<TextBlock Text="设备名称"
|
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
|
Style="{StaticResource TextBlockSubTitle}" />
|
|
|
|
|
<TextBox Text="{Binding Device.Name, UpdateSourceTrigger=PropertyChanged}" />
|
2025-07-01 11:11:02 +08:00
|
|
|
<!-- 设备IP地址 -->
|
2025-07-01 21:34:20 +08:00
|
|
|
<TextBlock Text="设备IP地址"
|
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
|
Style="{StaticResource TextBlockSubTitle}" />
|
|
|
|
|
<TextBox AcceptsReturn="True"
|
2025-07-27 21:08:58 +08:00
|
|
|
Text="{Binding Device.IpAddress, UpdateSourceTrigger=PropertyChanged}" />
|
2025-07-01 11:11:02 +08:00
|
|
|
|
|
|
|
|
<!-- 设备类型 -->
|
2025-07-27 22:35:07 +08:00
|
|
|
<TextBlock Text="设备类型"
|
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
|
Style="{StaticResource TextBlockSubTitle}" />
|
|
|
|
|
<ComboBox SelectedItem="{Binding Device}"
|
|
|
|
|
ItemsSource="{Binding Source={StaticResource deviceType} }">
|
|
|
|
|
<ComboBox.ItemTemplate>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<TextBlock Text="{Binding Converter={StaticResource EnumDescriptionConverter}}" />
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</ComboBox.ItemTemplate>
|
|
|
|
|
</ComboBox>
|
2025-07-01 11:11:02 +08:00
|
|
|
|
2025-07-02 22:07:16 +08:00
|
|
|
<CheckBox FontSize="16"
|
|
|
|
|
Content="是否添加默认变量表"
|
|
|
|
|
Margin="0 30 0 0"
|
|
|
|
|
IsChecked="{Binding Device.IsAddDefVarTable}" />
|
2025-07-01 21:34:20 +08:00
|
|
|
|
2025-07-01 11:11:02 +08:00
|
|
|
</ikw:SimpleStackPanel>
|
|
|
|
|
<!-- 右边列 -->
|
2025-07-01 21:34:20 +08:00
|
|
|
<ikw:SimpleStackPanel Margin="10"
|
|
|
|
|
Grid.Column="1"
|
|
|
|
|
Spacing="12">
|
|
|
|
|
|
2025-07-01 11:11:02 +08:00
|
|
|
<!-- 设备描述 -->
|
2025-07-01 21:34:20 +08:00
|
|
|
<TextBlock Text="设备描述"
|
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
|
Style="{StaticResource TextBlockSubTitle}" />
|
|
|
|
|
<TextBox Text="{Binding Device.Description, UpdateSourceTrigger=PropertyChanged}" />
|
2025-07-01 11:11:02 +08:00
|
|
|
<!-- 设备IP地址 -->
|
2025-07-01 21:34:20 +08:00
|
|
|
<TextBlock Text="设备端口"
|
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
|
Style="{StaticResource TextBlockSubTitle}" />
|
|
|
|
|
<TextBox AcceptsReturn="True"
|
2025-07-27 21:08:58 +08:00
|
|
|
Text="{Binding Device.Port, UpdateSourceTrigger=PropertyChanged}" />
|
2025-07-01 11:11:02 +08:00
|
|
|
|
2025-06-23 17:01:06 +08:00
|
|
|
|
2025-07-01 11:11:02 +08:00
|
|
|
<!-- 通讯协议-->
|
2025-07-01 21:34:20 +08:00
|
|
|
<TextBlock Text="设备通信协议"
|
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
|
Style="{StaticResource TextBlockSubTitle}" />
|
2025-07-27 22:35:07 +08:00
|
|
|
<ComboBox x:Name="ProtocolComboBox" SelectedItem="{Binding Device.Protocol}"
|
2025-07-01 11:11:02 +08:00
|
|
|
ItemsSource="{Binding Source={StaticResource protocolType} }">
|
|
|
|
|
<ComboBox.ItemTemplate>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<TextBlock Text="{Binding Converter={StaticResource EnumDescriptionConverter}}" />
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</ComboBox.ItemTemplate>
|
|
|
|
|
</ComboBox>
|
2025-07-27 22:35:07 +08:00
|
|
|
|
2025-07-05 01:31:44 +08:00
|
|
|
<!-- S7 Specific Properties -->
|
2025-07-27 22:35:07 +08:00
|
|
|
<StackPanel x:Name="S7PropertiesPanel" Background="LightGray">
|
2025-07-05 01:31:44 +08:00
|
|
|
<StackPanel.Style>
|
|
|
|
|
<Style TargetType="StackPanel">
|
2025-07-27 22:35:07 +08:00
|
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
2025-07-05 01:31:44 +08:00
|
|
|
<Style.Triggers>
|
2025-07-27 22:35:07 +08:00
|
|
|
<DataTrigger Binding="{Binding ElementName=ProtocolComboBox, Path=SelectedItem, Converter={StaticResource EnumToStringConverter}}"
|
|
|
|
|
Value="S7">
|
2025-07-05 01:31:44 +08:00
|
|
|
<Setter Property="Visibility" Value="Visible" />
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
|
|
|
|
</StackPanel.Style>
|
|
|
|
|
<!-- CpuType -->
|
|
|
|
|
<TextBlock Text="CPU 类型"
|
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
|
Style="{StaticResource TextBlockSubTitle}" />
|
|
|
|
|
<ComboBox SelectedItem="{Binding Device.CpuType}"
|
2025-07-27 21:58:50 +08:00
|
|
|
ItemsSource="{Binding Source={StaticResource cpuType}}" />
|
2025-07-05 01:31:44 +08:00
|
|
|
|
|
|
|
|
<!-- Rack -->
|
|
|
|
|
<TextBlock Text="机架号"
|
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
|
Style="{StaticResource TextBlockSubTitle}" />
|
|
|
|
|
<TextBox Text="{Binding Device.Rack, UpdateSourceTrigger=PropertyChanged}" />
|
|
|
|
|
|
|
|
|
|
<!-- Slot -->
|
|
|
|
|
<TextBlock Text="槽号"
|
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
|
Style="{StaticResource TextBlockSubTitle}" />
|
|
|
|
|
<TextBox Text="{Binding Device.Slot, UpdateSourceTrigger=PropertyChanged}" />
|
|
|
|
|
</StackPanel>
|
2025-06-23 17:01:06 +08:00
|
|
|
|
2025-07-01 21:34:20 +08:00
|
|
|
<CheckBox FontSize="16"
|
|
|
|
|
Content="是否启用"
|
|
|
|
|
Margin="0 30 0 0"
|
|
|
|
|
IsChecked="{Binding Device.IsActive}" />
|
|
|
|
|
|
2025-07-01 11:11:02 +08:00
|
|
|
</ikw:SimpleStackPanel>
|
|
|
|
|
</Grid>
|
2025-07-01 21:34:20 +08:00
|
|
|
|
2025-06-12 13:15:55 +08:00
|
|
|
</ui:ContentDialog>
|