Files
DMS/Views/Dialogs/DeviceDialog.xaml

110 lines
4.9 KiB
Plaintext
Raw Normal View History

2025-07-01 21:34:20 +08:00
<ui:ContentDialog x:Class="PMSWPF.Views.Dialogs.DeviceDialog"
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"
xmlns:vmd="clr-namespace:PMSWPF.ViewModels.Dialogs"
xmlns:vc="clr-namespace:PMSWPF.ValueConverts"
xmlns:ex="clr-namespace:PMSWPF.Extensions"
xmlns:en="clr-namespace:PMSWPF.Enums"
Title="{Binding Title}"
CloseButtonText="取消"
DefaultButton="Primary"
PrimaryButtonText="{Binding PrimaryButContent}"
Background="#fff"
d:DataContext="{d:DesignInstance vmd:DeviceDialogViewModel}"
mc:Ignorable="d">
<ui:ContentDialog.Resources>
2025-07-01 21:34:20 +08:00
<ex:EnumBindingSource x:Key="deviceType"
EnumType="{x:Type en:DeviceType}" />
<ex:EnumBindingSource x:Key="protocolType"
EnumType="{x:Type en:ProtocolType}" />
<vc:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
2025-07-01 21:34:20 +08:00
</ui:ContentDialog.Resources>
2025-07-01 21:34:20 +08:00
<Grid Width="480"
Margin="10">
<Grid.ColumnDefinitions>
2025-07-01 21:34:20 +08:00
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</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 21:34:20 +08:00
<TextBlock Text="设备名称"
HorizontalAlignment="Left"
Style="{StaticResource TextBlockSubTitle}" />
<TextBox Text="{Binding Device.Name, UpdateSourceTrigger=PropertyChanged}" />
<!-- 设备IP地址 -->
2025-07-01 21:34:20 +08:00
<TextBlock Text="设备IP地址"
HorizontalAlignment="Left"
Style="{StaticResource TextBlockSubTitle}" />
<TextBox AcceptsReturn="True"
Text="{Binding Device.Ip, UpdateSourceTrigger=PropertyChanged}" />
<!-- 设备类型 -->
2025-07-01 21:34:20 +08:00
<TextBlock Text="设备类型"
HorizontalAlignment="Left"
Style="{StaticResource TextBlockSubTitle}" />
<ComboBox SelectedItem="{Binding Device.DeviceType}"
ItemsSource="{Binding Source={StaticResource deviceType} }">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Converter={StaticResource EnumDescriptionConverter}}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
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
</ikw:SimpleStackPanel>
<!-- 右边列 -->
2025-07-01 21:34:20 +08:00
<ikw:SimpleStackPanel Margin="10"
Grid.Column="1"
Spacing="12">
<!-- 设备描述 -->
2025-07-01 21:34:20 +08:00
<TextBlock Text="设备描述"
HorizontalAlignment="Left"
Style="{StaticResource TextBlockSubTitle}" />
<TextBox Text="{Binding Device.Description, UpdateSourceTrigger=PropertyChanged}" />
<!-- 设备IP地址 -->
2025-07-01 21:34:20 +08:00
<TextBlock Text="设备端口"
HorizontalAlignment="Left"
Style="{StaticResource TextBlockSubTitle}" />
<TextBox AcceptsReturn="True"
2025-07-04 14:42:28 +08:00
Text="{Binding Device.Prot, UpdateSourceTrigger=PropertyChanged}" />
<!-- 通讯协议-->
2025-07-01 21:34:20 +08:00
<TextBlock Text="设备通信协议"
HorizontalAlignment="Left"
Style="{StaticResource TextBlockSubTitle}" />
<ComboBox SelectedItem="{Binding Device.ProtocolType}"
ItemsSource="{Binding Source={StaticResource protocolType} }">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Converter={StaticResource EnumDescriptionConverter}}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- 通讯协议-->
2025-07-01 21:34:20 +08:00
<CheckBox FontSize="16"
Content="是否启用"
Margin="0 30 0 0"
IsChecked="{Binding Device.IsActive}" />
</ikw:SimpleStackPanel>
</Grid>
2025-07-01 21:34:20 +08:00
</ui:ContentDialog>