重构了添加设备对话框的布局
This commit is contained in:
@@ -1,38 +1,28 @@
|
||||
<ui:ContentDialog x:Class="DMS.WPF.Views.Dialogs.ConfirmDialog"
|
||||
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:DMS.WPF.ViewModels.Dialogs"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:ex="clr-namespace:DMS.Extensions"
|
||||
xmlns:en="clr-namespace:DMS.Core.Enums"
|
||||
Title="{Binding Title}"
|
||||
CloseButtonText="取消"
|
||||
DefaultButton="Primary"
|
||||
PrimaryButtonText="{Binding PrimaryButText}"
|
||||
Background="#fff"
|
||||
d:DataContext="{d:DesignInstance vmd:ConfrimDialogViewModel}"
|
||||
mc:Ignorable="d">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="PrimaryButtonClick">
|
||||
<i:InvokeCommandAction Command="{Binding PrimaryButtonCommand}" />
|
||||
</i:EventTrigger>
|
||||
<i:EventTrigger EventName="CloseButtonClick">
|
||||
<i:InvokeCommandAction Command="{Binding CancleButtonCommand}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ui:ContentDialog
|
||||
x:Class="DMS.WPF.Views.Dialogs.ConfirmDialog"
|
||||
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:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
||||
Title="{Binding Title}"
|
||||
d:DataContext="{d:DesignInstance vmd:ConfirmDialogViewModel}"
|
||||
Background="#fff"
|
||||
CloseButtonCommand="{Binding CancleButtonCommand}"
|
||||
CloseButtonText="取消"
|
||||
DefaultButton="Primary"
|
||||
PrimaryButtonCommand="{Binding PrimaryButtonCommand}"
|
||||
PrimaryButtonText="{Binding PrimaryButText}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Width="360"
|
||||
Margin="10">
|
||||
<TextBlock Margin="20"
|
||||
FontSize="14"
|
||||
TextWrapping="Wrap"
|
||||
FontWeight="Bold"
|
||||
Text="{Binding Message}">
|
||||
</TextBlock>
|
||||
<Grid Width="360" Margin="10">
|
||||
<TextBlock
|
||||
Margin="20"
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
Text="{Binding Message}"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
|
||||
</ui:ContentDialog>
|
||||
@@ -1,23 +1,23 @@
|
||||
<ui:ContentDialog x:Class="DMS.WPF.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: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:ex="clr-namespace:DMS.Extensions"
|
||||
xmlns:enums="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
||||
xmlns:vc="clr-namespace:DMS.WPF.ValueConverts"
|
||||
Title="{Binding Title}"
|
||||
CloseButtonText="取消"
|
||||
DefaultButton="Primary"
|
||||
PrimaryButtonText="{Binding PrimaryButText}"
|
||||
PrimaryButtonCommand="{Binding PrimaryButtonCommand}"
|
||||
CloseButtonCommand="{Binding CancleButtonCommand}"
|
||||
d:DataContext="{d:DesignInstance vmd:DeviceDialogViewModel}"
|
||||
mc:Ignorable="d"
|
||||
>
|
||||
<ui:ContentDialog
|
||||
x:Class="DMS.WPF.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:enums="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
||||
xmlns:ex="clr-namespace:DMS.Extensions"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:vc="clr-namespace:DMS.WPF.ValueConverts"
|
||||
xmlns:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
||||
Title="{Binding Title}"
|
||||
d:DataContext="{d:DesignInstance vmd:DeviceDialogViewModel}"
|
||||
CloseButtonCommand="{Binding CancleButtonCommand}"
|
||||
CloseButtonText="取消"
|
||||
DefaultButton="Primary"
|
||||
PrimaryButtonCommand="{Binding PrimaryButtonCommand}"
|
||||
PrimaryButtonText="{Binding PrimaryButText}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<ui:ContentDialog.Resources>
|
||||
<ex:EnumBindingSource x:Key="DeviceType" EnumType="{x:Type enums:DeviceType}" />
|
||||
@@ -26,45 +26,64 @@
|
||||
<vc:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
||||
<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 x:Key="LabelStyle" TargetType="TextBlock">
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||
<Setter Property="Margin" Value="0,0,10,0" />
|
||||
</Style>
|
||||
</ui:ContentDialog.Resources>
|
||||
|
||||
<Grid Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Margin="16">
|
||||
<!-- 主设置项 -->
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 左边列 -->
|
||||
<StackPanel Grid.Column="0" MinWidth="220" Margin="0,0,10,0">
|
||||
<hc:TextBox hc:InfoElement.Title="设备名称"
|
||||
Text="{Binding Device.Name, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<!-- Row 0 -->
|
||||
<hc:TextBox
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
hc:InfoElement.Title="设备名称:"
|
||||
Text="{Binding Device.Name, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
<hc:TextBox hc:InfoElement.Title="设备IP地址"
|
||||
Text="{Binding Device.IpAddress, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<hc:TextBox
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
hc:InfoElement.Title="设备描述:"
|
||||
Text="{Binding Device.Description, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
<hc:ComboBox hc:InfoElement.Title="设备类型"
|
||||
IsEnabled="{Binding IsAddMode}"
|
||||
ItemsSource="{Binding Source={StaticResource DeviceType}}"
|
||||
SelectedItem="{Binding Device.DeviceType}">
|
||||
<!-- Row 1 -->
|
||||
<hc:TextBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="0,15,0,0"
|
||||
hc:InfoElement.Title="IP 地址:"
|
||||
Text="{Binding Device.IpAddress, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
<hc:TextBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Margin="0,15,0,0"
|
||||
hc:InfoElement.Title="端口:"
|
||||
Text="{Binding Device.Port, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
<hc:ComboBox
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Margin="0,15,0,0"
|
||||
hc:InfoElement.Title="设备类型:"
|
||||
IsEnabled="{Binding IsAddMode}"
|
||||
ItemsSource="{Binding Source={StaticResource DeviceType}}"
|
||||
SelectedItem="{Binding Device.DeviceType}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Converter={StaticResource EnumDescriptionConverter}}" />
|
||||
@@ -72,24 +91,15 @@
|
||||
</ComboBox.ItemTemplate>
|
||||
</hc:ComboBox>
|
||||
|
||||
<CheckBox Content="是否添加默认变量表"
|
||||
IsChecked="{Binding Device.IsAddDefVarTable}" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- 右边列 -->
|
||||
<StackPanel Grid.Column="1" MinWidth="220" Margin="10,0,0,0">
|
||||
<hc:TextBox hc:InfoElement.Title="设备描述"
|
||||
Text="{Binding Device.Description, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
<TextBlock Margin="8,0,0,5" Text="设备端口"/>
|
||||
<hc:NumericUpDown
|
||||
Value="{Binding Device.Port, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
<hc:ComboBox x:Name="ProtocolComboBox"
|
||||
hc:InfoElement.Title="设备通信协议"
|
||||
IsEnabled="{Binding IsAddMode}"
|
||||
ItemsSource="{Binding Source={StaticResource ProtocolType}}"
|
||||
SelectedItem="{Binding Device.Protocol}">
|
||||
<hc:ComboBox
|
||||
x:Name="ProtocolComboBox"
|
||||
Grid.Row="2"
|
||||
Grid.Column="4"
|
||||
Margin="0,15,0,0"
|
||||
hc:InfoElement.Title="通讯协议:"
|
||||
IsEnabled="{Binding IsAddMode}"
|
||||
ItemsSource="{Binding Source={StaticResource ProtocolType}}"
|
||||
SelectedItem="{Binding Device.Protocol}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Converter={StaticResource EnumDescriptionConverter}}" />
|
||||
@@ -97,50 +107,92 @@
|
||||
</ComboBox.ItemTemplate>
|
||||
</hc:ComboBox>
|
||||
|
||||
<!-- OpcUa Specific Properties -->
|
||||
<Border x:Name="OpcUaPanel">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border" BasedOn="{StaticResource ConditionalPanelStyle}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=ProtocolComboBox, Path=SelectedItem, Converter={StaticResource EnumToStringConverter}}" Value="OpcUa">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<StackPanel>
|
||||
<hc:TextBox hc:InfoElement.Title="OpcUa服务器地址"
|
||||
Text="{Binding Device.OpcUaServerUrl}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<!-- Row 3 -->
|
||||
<CheckBox
|
||||
Grid.Row="3"
|
||||
Grid.Column="0"
|
||||
Margin="0,20,0,0"
|
||||
Content="是否添加默认变量表"
|
||||
IsChecked="{Binding Device.IsAddDefVarTable}" />
|
||||
<CheckBox
|
||||
Grid.Row="3"
|
||||
Grid.Column="4"
|
||||
Margin="0,20,0,0"
|
||||
Content="是否启用"
|
||||
IsChecked="{Binding Device.IsActive}" />
|
||||
|
||||
<!-- S7 Specific Properties -->
|
||||
<Border x:Name="S7PropertiesPanel">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border" BasedOn="{StaticResource ConditionalPanelStyle}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=ProtocolComboBox, Path=SelectedItem, Converter={StaticResource EnumToStringConverter}}" Value="S7">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<StackPanel>
|
||||
<hc:ComboBox hc:InfoElement.Title="CPU 类型"
|
||||
ItemsSource="{Binding Source={StaticResource CpuType}}"
|
||||
SelectedItem="{Binding Device.CpuType}" />
|
||||
<TextBlock Margin="8,0,0,5" Text="机架号"/>
|
||||
<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>
|
||||
</Grid>
|
||||
|
||||
<CheckBox Content="是否启用"
|
||||
IsChecked="{Binding Device.IsActive}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<!-- OpcUa Specific Properties -->
|
||||
<GroupBox Margin="0,15,0,0" Header="OpcUa 协议设置">
|
||||
<GroupBox.Style>
|
||||
<Style BasedOn="{StaticResource {x:Type GroupBox}}" TargetType="GroupBox">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=ProtocolComboBox, Path=SelectedItem, Converter={StaticResource EnumToStringConverter}}" Value="OpcUa">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</GroupBox.Style>
|
||||
<Grid Margin="5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<hc:TextBox
|
||||
Grid.Column="1"
|
||||
MinWidth="400"
|
||||
hc:InfoElement.Title="OpcUa服务器地址:"
|
||||
Text="{Binding Device.OpcUaServerUrl}" />
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
<!-- S7 Specific Properties -->
|
||||
<GroupBox Margin="0,10,0,0" Header="S7 协议设置">
|
||||
<GroupBox.Style>
|
||||
<Style BasedOn="{StaticResource {x:Type GroupBox}}" TargetType="GroupBox">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=ProtocolComboBox, Path=SelectedItem, Converter={StaticResource EnumToStringConverter}}" Value="S7">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</GroupBox.Style>
|
||||
<Grid Margin="5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Grid.Column="0"
|
||||
Style="{StaticResource LabelStyle}"
|
||||
Text="CPU 类型:" />
|
||||
<hc:ComboBox
|
||||
Grid.Column="1"
|
||||
ItemsSource="{Binding Source={StaticResource CpuType}}"
|
||||
SelectedItem="{Binding Device.CpuType}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Column="3"
|
||||
Style="{StaticResource LabelStyle}"
|
||||
Text="机架号:" />
|
||||
<hc:TextBox Grid.Column="4" Text="{Binding Device.Rack, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Column="6"
|
||||
Style="{StaticResource LabelStyle}"
|
||||
Text="槽号:" />
|
||||
<hc:TextBox Grid.Column="7" Text="{Binding Device.Slot, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
</StackPanel>
|
||||
</ui:ContentDialog>
|
||||
@@ -1,87 +0,0 @@
|
||||
|
||||
<UserControl x:Class="DMS.WPF.Views.HandyDialogs.VariableEditorDialog"
|
||||
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:DMS.WPF.Views"
|
||||
xmlns:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:enums="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=vmd:VariableDialogViewModel}"
|
||||
Background="#fff"
|
||||
Width="1000">
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Text="{Binding Title}" Style="{StaticResource TextBlockTitle}" Margin="0,0,0,16"/>
|
||||
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="名称:" VerticalAlignment="Center" Margin="0,0,10,0"/>
|
||||
<hc:TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Variable.Name, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource TextBoxExtend}" Margin="0,5"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="地址:" VerticalAlignment="Center" Margin="0,0,10,0"/>
|
||||
<hc:TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Variable.S7Address, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource TextBoxExtend}" Margin="0,5"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="描述:" VerticalAlignment="Center" Margin="0,0,10,0"/>
|
||||
<hc:TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Variable.Description, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" AcceptsReturn="True" MinHeight="60" Style="{StaticResource TextBoxExtend}" Margin="0,5"/>
|
||||
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="数据类型:" VerticalAlignment="Center" Margin="0,0,10,0"/>
|
||||
<hc:ComboBox Grid.Row="3" Grid.Column="1" ItemsSource="{Binding CSharpDataTypes}" SelectedItem="{Binding Variable.CSharpDataType}" Style="{StaticResource ComboBoxExtend}" Margin="0,5"/>
|
||||
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Text="协议:" VerticalAlignment="Center" Margin="0,0,10,0"/>
|
||||
<hc:ComboBox Grid.Row="4" Grid.Column="1" ItemsSource="{Binding ProtocolTypes}" SelectedItem="{Binding Variable.Protocol}" Style="{StaticResource ComboBoxExtend}" Margin="0,5"/>
|
||||
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Text="轮询频率:" VerticalAlignment="Center" Margin="0,0,10,0"/>
|
||||
<hc:ComboBox Grid.Row="5" Grid.Column="1" ItemsSource="{Binding PollLevelTypes}" SelectedItem="{Binding Variable.PollLevel}" Style="{StaticResource ComboBoxExtend}" Margin="0,5"/>
|
||||
|
||||
<hc:Divider Grid.Row="6" Grid.ColumnSpan="2" Margin="0,10"/>
|
||||
|
||||
<StackPanel Grid.Row="7" Grid.ColumnSpan="2" Orientation="Horizontal">
|
||||
<CheckBox IsChecked="{Binding Variable.IsActive}" Content="启用变量" Margin="0,5,20,5"/>
|
||||
<CheckBox IsChecked="{Binding Variable.IsHistoryEnabled}" Content="启用历史记录" Margin="0,5,20,5"/>
|
||||
<CheckBox IsChecked="{Binding Variable.IsAlarmEnabled}" Content="启用报警" Margin="0,5,20,5"/>
|
||||
</StackPanel>
|
||||
|
||||
<Grid Grid.Row="8" Grid.ColumnSpan="2" IsEnabled="{Binding Variable.IsAlarmEnabled}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<hc:NumericUpDown Grid.Column="0" Minimum="-999999" Maximum="999999" Value="{Binding Variable.AlarmMinValue}" hc:InfoElement.Title="报警下限" Margin="0,5,5,5"/>
|
||||
<hc:NumericUpDown Grid.Column="1" Minimum="-999999" Maximum="999999" Value="{Binding Variable.AlarmMaxValue}" hc:InfoElement.Title="报警上限" Margin="5,5"/>
|
||||
<hc:NumericUpDown Grid.Column="2" Minimum="0" Maximum="999999" Value="{Binding Variable.AlarmDeadband}" hc:InfoElement.Title="报警死区" Margin="5,5,0,5"/>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,16,0,0">
|
||||
<Button Command="{Binding SaveCommand}" Content="保存" Style="{StaticResource ButtonPrimary}" IsDefault="True"/>
|
||||
<Button Command="{Binding CancelCommand}" Content="取消" Margin="10,0,0,0" IsCancel="True"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace DMS.WPF.Views.HandyDialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for VariableEditorDialog.xaml
|
||||
/// </summary>
|
||||
public partial class VariableEditorDialog : UserControl
|
||||
{
|
||||
public VariableEditorDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,28 @@
|
||||
<Window x:Class="DMS.WPF.Views.MainView"
|
||||
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:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:local="clr-namespace:DMS.WPF.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="clr-namespace:DMS.WPF.ViewModels"
|
||||
xmlns:mo="clr-namespace:DMS.Core.Models;assembly=DMS.Core"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:tb="http://hardcodet.net/taskbar"
|
||||
xmlns:taskbarNotification="http://www.hardcodet.net/taskbar"
|
||||
Title="设备管理系统"
|
||||
Width="1080"
|
||||
Height="800"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
WindowState="Maximized"
|
||||
Loaded="MainView_OnLoaded"
|
||||
Closing="Window_Closing"
|
||||
ui:WindowHelper.UseModernWindowStyle="True"
|
||||
ui:WindowHelper.SystemBackdropType="Mica"
|
||||
d:DataContext="{d:DesignInstance vm:MainViewModel}"
|
||||
mc:Ignorable="d">
|
||||
<Window
|
||||
x:Class="DMS.WPF.Views.MainView"
|
||||
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:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:DMS.WPF.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mo="clr-namespace:DMS.Core.Models;assembly=DMS.Core"
|
||||
xmlns:taskbarNotification="http://www.hardcodet.net/taskbar"
|
||||
xmlns:tb="http://hardcodet.net/taskbar"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:vm="clr-namespace:DMS.WPF.ViewModels"
|
||||
Title="设备管理系统"
|
||||
Width="1080"
|
||||
Height="800"
|
||||
d:DataContext="{d:DesignInstance vm:MainViewModel}"
|
||||
ui:WindowHelper.SystemBackdropType="Mica"
|
||||
ui:WindowHelper.UseModernWindowStyle="True"
|
||||
Closing="Window_Closing"
|
||||
Loaded="MainView_OnLoaded"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
WindowState="Maximized"
|
||||
mc:Ignorable="d">
|
||||
<Window.Resources>
|
||||
|
||||
<ContextMenu x:Key="MyMenuItemContextMenu">
|
||||
@@ -30,11 +31,11 @@
|
||||
<Separator />
|
||||
<MenuItem Header="删除" />
|
||||
</ContextMenu>
|
||||
<DataTemplate x:Key="NavigationViewMenuItem"
|
||||
DataType="{x:Type mo:MenuBean}">
|
||||
<ui:NavigationViewItem Content="{Binding Header}"
|
||||
Tag="{Binding }"
|
||||
MenuItemsSource="{Binding Children }">
|
||||
<DataTemplate x:Key="NavigationViewMenuItem" DataType="{x:Type mo:MenuBean}">
|
||||
<ui:NavigationViewItem
|
||||
Content="{Binding Header}"
|
||||
MenuItemsSource="{Binding Children}"
|
||||
Tag="{Binding}">
|
||||
<ui:NavigationViewItem.Icon>
|
||||
<ui:FontIcon Glyph="{Binding Icon}" />
|
||||
</ui:NavigationViewItem.Icon>
|
||||
@@ -42,31 +43,33 @@
|
||||
</DataTemplate>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<taskbarNotification:TaskbarIcon x:Name="MyNotifyIcon"
|
||||
ToolTipText="设备管理系统"
|
||||
IconSource="/Assets/AppIcon2.ico"
|
||||
DoubleClickCommand="{Binding ShowWindowCommand}">
|
||||
<taskbarNotification:TaskbarIcon
|
||||
x:Name="MyNotifyIcon"
|
||||
DoubleClickCommand="{Binding ShowWindowCommand}"
|
||||
IconSource="/Assets/AppIcon2.ico"
|
||||
ToolTipText="设备管理系统">
|
||||
<taskbarNotification:TaskbarIcon.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="显示窗口" Command="{Binding ShowWindowCommand}" />
|
||||
<MenuItem Header="退出" Command="{Binding ExitApplicationCommand}" />
|
||||
<MenuItem Command="{Binding ShowWindowCommand}" Header="显示窗口" />
|
||||
<MenuItem Command="{Binding ExitApplicationCommand}" Header="退出" />
|
||||
</ContextMenu>
|
||||
</taskbarNotification:TaskbarIcon.ContextMenu>
|
||||
</taskbarNotification:TaskbarIcon>
|
||||
<ui:NavigationView ExpandedModeThresholdWidth="500"
|
||||
IsTabStop="False"
|
||||
PaneDisplayMode="Left"
|
||||
PaneTitle="设备管理系统"
|
||||
IsSettingsVisible="False"
|
||||
AlwaysShowHeader="True"
|
||||
IsBackButtonVisible="Collapsed"
|
||||
IsBackEnabled="False"
|
||||
SelectionFollowsFocus="Disabled"
|
||||
SelectionChanged="NavigationView_SelectionChanged"
|
||||
MenuItemsSource="{Binding DataServices.MenuTrees}"
|
||||
MenuItemTemplate="{StaticResource NavigationViewMenuItem}">
|
||||
<ui:NavigationView
|
||||
AlwaysShowHeader="True"
|
||||
ExpandedModeThresholdWidth="500"
|
||||
IsBackButtonVisible="Collapsed"
|
||||
IsBackEnabled="False"
|
||||
IsSettingsVisible="False"
|
||||
IsTabStop="False"
|
||||
MenuItemTemplate="{StaticResource NavigationViewMenuItem}"
|
||||
MenuItemsSource="{Binding DataServices.MenuTrees}"
|
||||
PaneDisplayMode="Left"
|
||||
PaneTitle="设备管理系统"
|
||||
SelectionChanged="NavigationView_SelectionChanged"
|
||||
SelectionFollowsFocus="Disabled">
|
||||
|
||||
|
||||
|
||||
|
||||
<ui:NavigationView.AutoSuggestBox>
|
||||
<ui:AutoSuggestBox AutomationProperties.Name="Search">
|
||||
@@ -78,49 +81,49 @@
|
||||
|
||||
|
||||
<Grid>
|
||||
<!-- 数据模版绑定不同的View显示 -->
|
||||
<!-- 数据模版绑定不同的View显示 -->
|
||||
<ContentControl Content="{Binding CurrentViewModel}">
|
||||
<ContentControl.Resources>
|
||||
<!-- 主页 -->
|
||||
<!-- 主页 -->
|
||||
<DataTemplate DataType="{x:Type vm:HomeViewModel}">
|
||||
<local:HomeView />
|
||||
</DataTemplate>
|
||||
<!-- 设备列表页 -->
|
||||
<!-- 设备列表页 -->
|
||||
<DataTemplate DataType="{x:Type vm:DevicesViewModel}">
|
||||
<local:DevicesView />
|
||||
</DataTemplate>
|
||||
<!-- 数据转换页 -->
|
||||
<!-- 数据转换页 -->
|
||||
<DataTemplate DataType="{x:Type vm:DataTransformViewModel}">
|
||||
<local:DataTransformView />
|
||||
</DataTemplate>
|
||||
<!-- Mqtt服务器页 -->
|
||||
<!-- Mqtt服务器页 -->
|
||||
<DataTemplate DataType="{x:Type vm:MqttsViewModel}">
|
||||
<local:MqttsView />
|
||||
</DataTemplate>
|
||||
<!-- 设置页 -->
|
||||
<!-- 设置页 -->
|
||||
<DataTemplate DataType="{x:Type vm:SettingViewModel}">
|
||||
<local:SettingView />
|
||||
</DataTemplate>
|
||||
<!-- 设备详情页 -->
|
||||
<!-- 设备详情页 -->
|
||||
<DataTemplate DataType="{x:Type vm:DeviceDetailViewModel}">
|
||||
<local:DeviceDetailView />
|
||||
<local:DeviceDetailView />
|
||||
</DataTemplate>
|
||||
<!-- 设备变量页 -->
|
||||
<!-- 设备变量页 -->
|
||||
<DataTemplate DataType="{x:Type vm:VariableTableViewModel}">
|
||||
<local:VariableTableView DataContext="{Binding }"/>
|
||||
<local:VariableTableView DataContext="{Binding}" />
|
||||
</DataTemplate>
|
||||
<!-- Mqtt服务器详情页 -->
|
||||
<!-- Mqtt服务器详情页 -->
|
||||
<!-- <DataTemplate DataType="{x:Type vm:MqttServerDetailViewModel}"> -->
|
||||
<!-- <local:MqttServerDetailView DataContext="{Binding }"/> -->
|
||||
<!-- </DataTemplate> -->
|
||||
</ContentControl.Resources>
|
||||
</ContentControl>
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Hidden"
|
||||
HorizontalAlignment="Right">
|
||||
<StackPanel hc:Growl.GrowlParent="True"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,10,10,10" />
|
||||
<ScrollViewer HorizontalAlignment="Right" VerticalScrollBarVisibility="Hidden">
|
||||
<StackPanel
|
||||
Margin="0,10,10,10"
|
||||
VerticalAlignment="Top"
|
||||
hc:Growl.GrowlParent="True" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user