修改了界面
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
<ui:ContentDialog x:Class="DMS.WPF.Views.Dialogs.DeviceDialog"
|
<ui:ContentDialog x:Class="DMS.WPF.Views.Dialogs.DeviceDialog"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
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:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
xmlns:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
xmlns:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
||||||
xmlns:ex="clr-namespace:DMS.Extensions"
|
xmlns:ex="clr-namespace:DMS.Extensions"
|
||||||
xmlns:enums="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
xmlns:enums="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
||||||
@@ -14,157 +14,133 @@
|
|||||||
DefaultButton="Primary"
|
DefaultButton="Primary"
|
||||||
PrimaryButtonText="{Binding PrimaryButText}"
|
PrimaryButtonText="{Binding PrimaryButText}"
|
||||||
PrimaryButtonCommand="{Binding PrimaryButtonCommand}"
|
PrimaryButtonCommand="{Binding PrimaryButtonCommand}"
|
||||||
CloseButtonCommand="{Binding CancleButtonCommand}"
|
CloseButtonCommand="{Binding CancleButtonCommand}"
|
||||||
d:DataContext="{d:DesignInstance vmd:DeviceDialogViewModel}"
|
d:DataContext="{d:DesignInstance vmd:DeviceDialogViewModel}"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d"
|
||||||
|
>
|
||||||
|
|
||||||
<ui:ContentDialog.Resources>
|
<ui:ContentDialog.Resources>
|
||||||
<ex:EnumBindingSource x:Key="DeviceType"
|
<ex:EnumBindingSource x:Key="DeviceType" EnumType="{x:Type enums:DeviceType}" />
|
||||||
EnumType="{x:Type enums:DeviceType}" />
|
<ex:EnumBindingSource x:Key="ProtocolType" EnumType="{x:Type enums:ProtocolType}" />
|
||||||
<ex:EnumBindingSource x:Key="ProtocolType"
|
<ex:EnumBindingSource x:Key="CpuType" EnumType="{x:Type enums:CpuType}" />
|
||||||
EnumType="{x:Type enums:ProtocolType}" />
|
|
||||||
<ex:EnumBindingSource x:Key="CpuType"
|
|
||||||
EnumType="{x:Type enums:CpuType}" />
|
|
||||||
<vc:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
<vc:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
||||||
<vc:EnumToStringConverter x:Key="EnumToStringConverter" />
|
<vc:EnumToStringConverter x:Key="EnumToStringConverter" />
|
||||||
|
|
||||||
|
<!-- 统一定义输入控件的下边距 -->
|
||||||
|
<Style TargetType="hc:TextBox" BasedOn="{StaticResource {x:Type hc:TextBox}}">
|
||||||
|
<Setter Property="Margin" Value="0,0,0,15"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="hc:ComboBox" BasedOn="{StaticResource {x:Type hc:ComboBox}}">
|
||||||
|
<Setter Property="Margin" Value="0,0,0,15"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="CheckBox" BasedOn="{StaticResource {x:Type CheckBox}}">
|
||||||
|
<Setter Property="Margin" Value="0,10,0,0"/>
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="ConditionalPanelStyle" TargetType="Border">
|
||||||
|
<Setter Property="Padding" Value="10"/>
|
||||||
|
<Setter Property="Margin" Value="0,0,0,15"/>
|
||||||
|
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
<Setter Property="CornerRadius" Value="4"/>
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
</Style>
|
||||||
</ui:ContentDialog.Resources>
|
</ui:ContentDialog.Resources>
|
||||||
|
|
||||||
<Grid
|
<Grid Margin="10">
|
||||||
Margin="10">
|
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="1*" />
|
<ColumnDefinition Width="1*" />
|
||||||
<ColumnDefinition Width="1*" />
|
<ColumnDefinition Width="1*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<!-- 左边列 -->
|
<!-- 左边列 -->
|
||||||
<ikw:SimpleStackPanel Grid.Column="0"
|
<StackPanel Grid.Column="0" MinWidth="220" Margin="0,0,10,0">
|
||||||
Margin="10 10 20 10 "
|
<hc:TextBox hc:InfoElement.Title="设备名称"
|
||||||
Spacing="12">
|
Text="{Binding Device.Name, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
<!-- 设备名称 -->
|
|
||||||
<TextBlock Text="设备名称"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
Style="{StaticResource TextBlockSubTitle}" />
|
|
||||||
<TextBox Text="{Binding Device.Name, UpdateSourceTrigger=PropertyChanged}" />
|
|
||||||
<!-- 设备IP地址 -->
|
|
||||||
<TextBlock Text="设备IP地址"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
Style="{StaticResource TextBlockSubTitle}" />
|
|
||||||
<TextBox AcceptsReturn="True"
|
|
||||||
Text="{Binding Device.IpAddress, UpdateSourceTrigger=PropertyChanged}" />
|
|
||||||
|
|
||||||
<!-- 设备类型 -->
|
<hc:TextBox hc:InfoElement.Title="设备IP地址"
|
||||||
<TextBlock Text="设备类型"
|
Text="{Binding Device.IpAddress, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
HorizontalAlignment="Left"
|
|
||||||
Style="{StaticResource TextBlockSubTitle}" />
|
<hc:ComboBox hc:InfoElement.Title="设备类型"
|
||||||
<ComboBox
|
IsEnabled="{Binding IsAddMode}"
|
||||||
IsEnabled="{Binding IsAddMode}"
|
ItemsSource="{Binding Source={StaticResource DeviceType}}"
|
||||||
SelectedItem="{Binding Device.DeviceType}"
|
SelectedItem="{Binding Device.DeviceType}">
|
||||||
ItemsSource="{Binding Source={StaticResource DeviceType} }">
|
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding Converter={StaticResource EnumDescriptionConverter}}" />
|
<TextBlock Text="{Binding Converter={StaticResource EnumDescriptionConverter}}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
</ComboBox>
|
</hc:ComboBox>
|
||||||
|
|
||||||
<CheckBox FontSize="16"
|
<CheckBox Content="是否添加默认变量表"
|
||||||
Content="是否添加默认变量表"
|
IsChecked="{Binding Device.IsAddDefVarTable}" />
|
||||||
Margin="0 30 0 0"
|
</StackPanel>
|
||||||
IsChecked="{Binding Device.IsAddDefVarTable}" />
|
|
||||||
|
|
||||||
</ikw:SimpleStackPanel>
|
|
||||||
<!-- 右边列 -->
|
<!-- 右边列 -->
|
||||||
<ikw:SimpleStackPanel Margin="10"
|
<StackPanel Grid.Column="1" MinWidth="220" Margin="10,0,0,0">
|
||||||
Grid.Column="1"
|
<hc:TextBox hc:InfoElement.Title="设备描述"
|
||||||
Spacing="12">
|
Text="{Binding Device.Description, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
|
||||||
<!-- 设备描述 -->
|
<TextBlock Margin="8,0,0,5" Text="设备端口"/>
|
||||||
<TextBlock Text="设备描述"
|
<hc:NumericUpDown
|
||||||
HorizontalAlignment="Left"
|
Value="{Binding Device.Port, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
Style="{StaticResource TextBlockSubTitle}" />
|
|
||||||
<TextBox Text="{Binding Device.Description, UpdateSourceTrigger=PropertyChanged}" />
|
|
||||||
<!-- 设备IP地址 -->
|
|
||||||
<TextBlock Text="设备端口"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
Style="{StaticResource TextBlockSubTitle}" />
|
|
||||||
<TextBox AcceptsReturn="True"
|
|
||||||
Text="{Binding Device.Port, UpdateSourceTrigger=PropertyChanged}" />
|
|
||||||
|
|
||||||
|
<hc:ComboBox x:Name="ProtocolComboBox"
|
||||||
<!-- 通讯协议-->
|
hc:InfoElement.Title="设备通信协议"
|
||||||
<TextBlock Text="设备通信协议"
|
IsEnabled="{Binding IsAddMode}"
|
||||||
HorizontalAlignment="Left"
|
ItemsSource="{Binding Source={StaticResource ProtocolType}}"
|
||||||
Style="{StaticResource TextBlockSubTitle}" />
|
SelectedItem="{Binding Device.Protocol}">
|
||||||
<ComboBox x:Name="ProtocolComboBox"
|
|
||||||
IsEnabled="{Binding IsAddMode}"
|
|
||||||
SelectedItem="{Binding Device.Protocol}"
|
|
||||||
ItemsSource="{Binding Source={StaticResource ProtocolType} }">
|
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding Converter={StaticResource EnumDescriptionConverter}}" />
|
<TextBlock Text="{Binding Converter={StaticResource EnumDescriptionConverter}}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
</ComboBox>
|
</hc:ComboBox>
|
||||||
|
|
||||||
<StackPanel Background="LightGray">
|
<!-- OpcUa Specific Properties -->
|
||||||
<StackPanel.Style>
|
<Border x:Name="OpcUaPanel">
|
||||||
<Style TargetType="StackPanel">
|
<Border.Style>
|
||||||
<Setter Property="Visibility" Value="Collapsed" />
|
<Style TargetType="Border" BasedOn="{StaticResource ConditionalPanelStyle}">
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<DataTrigger Binding="{Binding ElementName=ProtocolComboBox, Path=SelectedItem, Converter={StaticResource EnumToStringConverter}}"
|
<DataTrigger Binding="{Binding ElementName=ProtocolComboBox, Path=SelectedItem, Converter={StaticResource EnumToStringConverter}}" Value="OpcUa">
|
||||||
Value="OpcUa">
|
|
||||||
<Setter Property="Visibility" Value="Visible" />
|
<Setter Property="Visibility" Value="Visible" />
|
||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
</StackPanel.Style>
|
</Border.Style>
|
||||||
<TextBlock Text="OpcUa服务器地址"
|
<StackPanel>
|
||||||
HorizontalAlignment="Left"
|
<hc:TextBox hc:InfoElement.Title="OpcUa服务器地址"
|
||||||
Style="{StaticResource TextBlockSubTitle}" />
|
Text="{Binding Device.OpcUaServerUrl}"/>
|
||||||
<TextBox Text="{Binding Device.OpcUaServerUrl}"/>
|
</StackPanel>
|
||||||
</StackPanel>
|
</Border>
|
||||||
|
|
||||||
|
|
||||||
<!-- S7 Specific Properties -->
|
<!-- S7 Specific Properties -->
|
||||||
<StackPanel x:Name="S7PropertiesPanel" Background="LightGray">
|
<Border x:Name="S7PropertiesPanel">
|
||||||
<StackPanel.Style>
|
<Border.Style>
|
||||||
<Style TargetType="StackPanel">
|
<Style TargetType="Border" BasedOn="{StaticResource ConditionalPanelStyle}">
|
||||||
<Setter Property="Visibility" Value="Collapsed" />
|
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<DataTrigger Binding="{Binding ElementName=ProtocolComboBox, Path=SelectedItem, Converter={StaticResource EnumToStringConverter}}"
|
<DataTrigger Binding="{Binding ElementName=ProtocolComboBox, Path=SelectedItem, Converter={StaticResource EnumToStringConverter}}" Value="S7">
|
||||||
Value="S7">
|
|
||||||
<Setter Property="Visibility" Value="Visible" />
|
<Setter Property="Visibility" Value="Visible" />
|
||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
</StackPanel.Style>
|
</Border.Style>
|
||||||
<!-- CpuType -->
|
<StackPanel>
|
||||||
<TextBlock Text="CPU 类型"
|
<hc:ComboBox hc:InfoElement.Title="CPU 类型"
|
||||||
HorizontalAlignment="Left"
|
ItemsSource="{Binding Source={StaticResource CpuType}}"
|
||||||
Style="{StaticResource TextBlockSubTitle}" />
|
SelectedItem="{Binding Device.CpuType}" />
|
||||||
<ComboBox SelectedItem="{Binding Device.CpuType}"
|
<TextBlock Margin="8,0,0,5" Text="机架号"/>
|
||||||
ItemsSource="{Binding Source={StaticResource CpuType}}" />
|
<hc:NumericUpDown
|
||||||
|
Value="{Binding Device.Rack, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
<TextBlock Margin="8,0,0,5" Text="槽号"/>
|
||||||
|
<hc:NumericUpDown
|
||||||
|
Value="{Binding Device.Slot, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
<!-- Rack -->
|
<CheckBox Content="是否启用"
|
||||||
<TextBlock Text="机架号"
|
IsChecked="{Binding Device.IsActive}" />
|
||||||
HorizontalAlignment="Left"
|
</StackPanel>
|
||||||
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>
|
|
||||||
|
|
||||||
<CheckBox FontSize="16"
|
|
||||||
Content="是否启用"
|
|
||||||
Margin="0 30 0 0"
|
|
||||||
IsChecked="{Binding Device.IsActive}" />
|
|
||||||
|
|
||||||
</ikw:SimpleStackPanel>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</ui:ContentDialog>
|
</ui:ContentDialog>
|
||||||
Reference in New Issue
Block a user