修复添加设备时选择通讯协议,界面也跟着跟新
This commit is contained in:
@@ -3,7 +3,7 @@ using System.Globalization;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace DMS.ValueConverts;
|
namespace DMS.WPF.ValueConverts;
|
||||||
|
|
||||||
public class EnumDescriptionConverter : IValueConverter
|
public class EnumDescriptionConverter : IValueConverter
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
using System;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace DMS.ValueConverts
|
namespace DMS.WPF.ValueConverts
|
||||||
{
|
{
|
||||||
public class NullableBooleanConverter : IValueConverter
|
public class NullableBooleanConverter : IValueConverter
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,6 +54,11 @@ public partial class DeviceItemViewModel : ObservableObject
|
|||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private string _status;
|
private string _status;
|
||||||
|
|
||||||
|
partial void OnProtocolChanged(ProtocolType oldValue, ProtocolType newValue)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public ObservableCollection<VariableTableItemViewModel> VariableTables { get; set; } = new();
|
public ObservableCollection<VariableTableItemViewModel> VariableTables { get; set; } = new();
|
||||||
|
|
||||||
public DeviceItemViewModel(DeviceDto dto)
|
public DeviceItemViewModel(DeviceDto dto)
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
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:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
xmlns:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
||||||
xmlns:vc="clr-namespace:DMS.ValueConverts"
|
|
||||||
xmlns:ex="clr-namespace:DMS.Extensions"
|
xmlns:ex="clr-namespace:DMS.Extensions"
|
||||||
xmlns:en="clr-namespace:DMS.Core.Enums"
|
xmlns:en="clr-namespace:DMS.Core.Enums"
|
||||||
Title="{Binding Title}"
|
Title="{Binding Title}"
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
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:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
xmlns:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
||||||
xmlns:vc="clr-namespace:DMS.ValueConverts"
|
|
||||||
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"
|
||||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||||
|
xmlns:vc="clr-namespace:DMS.WPF.ValueConverts"
|
||||||
Title="{Binding Title}"
|
Title="{Binding Title}"
|
||||||
CloseButtonText="取消"
|
CloseButtonText="取消"
|
||||||
DefaultButton="Primary"
|
DefaultButton="Primary"
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
<ex:EnumBindingSource x:Key="cpuType"
|
<ex:EnumBindingSource x:Key="cpuType"
|
||||||
EnumType="{x:Type enums:CpuType}" />
|
EnumType="{x:Type enums:CpuType}" />
|
||||||
<vc:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
<vc:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
||||||
|
<vc:EnumToStringConverter x:Key="EnumToStringConverter" />
|
||||||
|
|
||||||
|
|
||||||
</ui:ContentDialog.Resources>
|
</ui:ContentDialog.Resources>
|
||||||
@@ -61,17 +62,17 @@
|
|||||||
Text="{Binding Device.IpAddress, UpdateSourceTrigger=PropertyChanged}" />
|
Text="{Binding Device.IpAddress, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
|
||||||
<!-- 设备类型 -->
|
<!-- 设备类型 -->
|
||||||
<!-- <TextBlock Text="设备类型" -->
|
<TextBlock Text="设备类型"
|
||||||
<!-- HorizontalAlignment="Left" -->
|
HorizontalAlignment="Left"
|
||||||
<!-- Style="{StaticResource TextBlockSubTitle}" /> -->
|
Style="{StaticResource TextBlockSubTitle}" />
|
||||||
<!-- <ComboBox SelectedItem="{Binding Device}" -->
|
<ComboBox SelectedItem="{Binding Device}"
|
||||||
<!-- ItemsSource="{Binding Source={StaticResource 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> -->
|
</ComboBox>
|
||||||
|
|
||||||
<CheckBox FontSize="16"
|
<CheckBox FontSize="16"
|
||||||
Content="是否添加默认变量表"
|
Content="是否添加默认变量表"
|
||||||
@@ -101,7 +102,7 @@
|
|||||||
<TextBlock Text="设备通信协议"
|
<TextBlock Text="设备通信协议"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Style="{StaticResource TextBlockSubTitle}" />
|
Style="{StaticResource TextBlockSubTitle}" />
|
||||||
<ComboBox SelectedItem="{Binding Device.Protocol}"
|
<ComboBox x:Name="ProtocolComboBox" SelectedItem="{Binding Device.Protocol}"
|
||||||
ItemsSource="{Binding Source={StaticResource protocolType} }">
|
ItemsSource="{Binding Source={StaticResource protocolType} }">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
@@ -109,14 +110,15 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
<!-- S7 Specific Properties -->
|
<!-- S7 Specific Properties -->
|
||||||
<StackPanel x:Name="S7PropertiesPanel" Visibility="Visible" Background="LightGray">
|
<StackPanel x:Name="S7PropertiesPanel" Background="LightGray">
|
||||||
<StackPanel.Style>
|
<StackPanel.Style>
|
||||||
<Style TargetType="StackPanel">
|
<Style TargetType="StackPanel">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed" />
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<DataTrigger Binding="{Binding Device.Protocol}"
|
<DataTrigger Binding="{Binding ElementName=ProtocolComboBox, Path=SelectedItem, Converter={StaticResource EnumToStringConverter}}"
|
||||||
Value="{x:Static enums:ProtocolType.S7}">
|
Value="S7">
|
||||||
<Setter Property="Visibility" Value="Visible" />
|
<Setter Property="Visibility" Value="Visible" />
|
||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:controls="http://schemas.inkore.net/lib/ui/wpf/modern"
|
xmlns:controls="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||||
xmlns:vm="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
xmlns:vm="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
||||||
xmlns:vc="clr-namespace:DMS.ValueConverts"
|
xmlns:valueConverts="clr-namespace:DMS.WPF.ValueConverts"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DataContext="{d:DesignInstance vm:IsActiveDialogViewModel}"
|
d:DataContext="{d:DesignInstance vm:IsActiveDialogViewModel}"
|
||||||
Title="修改激活状态"
|
Title="修改激活状态"
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
|
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
|
||||||
SecondaryButtonClick="ContentDialog_SecondaryButtonClick">
|
SecondaryButtonClick="ContentDialog_SecondaryButtonClick">
|
||||||
<controls:ContentDialog.Resources>
|
<controls:ContentDialog.Resources>
|
||||||
<vc:NullableBooleanConverter x:Key="NullableBooleanConverter" />
|
<valueConverts:NullableBooleanConverter x:Key="NullableBooleanConverter" />
|
||||||
</controls:ContentDialog.Resources>
|
</controls:ContentDialog.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel Orientation="Vertical" Margin="10">
|
<StackPanel Orientation="Vertical" Margin="10">
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
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:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
xmlns:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
||||||
xmlns:vc="clr-namespace:DMS.ValueConverts"
|
|
||||||
xmlns:ex="clr-namespace:DMS.Extensions"
|
xmlns:ex="clr-namespace:DMS.Extensions"
|
||||||
xmlns:en="clr-namespace:DMS.Core.Enums"
|
xmlns:en="clr-namespace:DMS.Core.Enums"
|
||||||
xmlns:enums="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
xmlns:enums="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
||||||
|
xmlns:valueConverts="clr-namespace:DMS.WPF.ValueConverts"
|
||||||
Title="{Binding Title}"
|
Title="{Binding Title}"
|
||||||
CloseButtonText="取消"
|
CloseButtonText="取消"
|
||||||
DefaultButton="Primary"
|
DefaultButton="Primary"
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<ui:ContentDialog.Resources>
|
<ui:ContentDialog.Resources>
|
||||||
<ex:EnumBindingSource x:Key="mqttPlatform"
|
<ex:EnumBindingSource x:Key="mqttPlatform"
|
||||||
EnumType="{x:Type enums:MqttPlatform}" />
|
EnumType="{x:Type enums:MqttPlatform}" />
|
||||||
<vc:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
<valueConverts:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
||||||
</ui:ContentDialog.Resources>
|
</ui:ContentDialog.Resources>
|
||||||
|
|
||||||
<Grid Width="480"
|
<Grid Width="480"
|
||||||
|
|||||||
@@ -6,14 +6,14 @@
|
|||||||
xmlns:enums="clr-namespace:DMS.Core.Enums"
|
xmlns:enums="clr-namespace:DMS.Core.Enums"
|
||||||
xmlns:extensions="clr-namespace:DMS.Extensions"
|
xmlns:extensions="clr-namespace:DMS.Extensions"
|
||||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||||
xmlns:vc="clr-namespace:DMS.ValueConverts"
|
xmlns:valueConverts="clr-namespace:DMS.WPF.ValueConverts"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="修改轮询频率"
|
Title="修改轮询频率"
|
||||||
PrimaryButtonText="确定"
|
PrimaryButtonText="确定"
|
||||||
CloseButtonText="取消"
|
CloseButtonText="取消"
|
||||||
d:DesignHeight="150" d:DesignWidth="300">
|
d:DesignHeight="150" d:DesignWidth="300">
|
||||||
<ui:ContentDialog.Resources>
|
<ui:ContentDialog.Resources>
|
||||||
<vc:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
<valueConverts:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
||||||
</ui:ContentDialog.Resources>
|
</ui:ContentDialog.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<ComboBox
|
<ComboBox
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
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:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
xmlns:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
||||||
xmlns:vc="clr-namespace:DMS.ValueConverts"
|
|
||||||
xmlns:ex="clr-namespace:DMS.Extensions"
|
xmlns:ex="clr-namespace:DMS.Extensions"
|
||||||
xmlns:en="clr-namespace:DMS.Core.Enums"
|
xmlns:en="clr-namespace:DMS.Core.Enums"
|
||||||
xmlns:sockets="clr-namespace:System.Net.Sockets;assembly=System.Net.Sockets"
|
xmlns:sockets="clr-namespace:System.Net.Sockets;assembly=System.Net.Sockets"
|
||||||
xmlns:enums="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
xmlns:enums="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
||||||
|
xmlns:valueConverts="clr-namespace:DMS.WPF.ValueConverts"
|
||||||
Title="{Binding Title}"
|
Title="{Binding Title}"
|
||||||
CloseButtonText="取消"
|
CloseButtonText="取消"
|
||||||
DefaultButton="Primary"
|
DefaultButton="Primary"
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
d:DataContext="{d:DesignInstance vmd:VarDataDialogViewModel}"
|
d:DataContext="{d:DesignInstance vmd:VarDataDialogViewModel}"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<ui:ContentDialog.Resources>
|
<ui:ContentDialog.Resources>
|
||||||
<vc:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
<valueConverts:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
||||||
</ui:ContentDialog.Resources>
|
</ui:ContentDialog.Resources>
|
||||||
|
|
||||||
<Grid Margin="10" Width="480">
|
<Grid Margin="10" Width="480">
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
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:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
xmlns:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
||||||
xmlns:vc="clr-namespace:DMS.ValueConverts"
|
|
||||||
xmlns:ex="clr-namespace:DMS.Extensions"
|
xmlns:ex="clr-namespace:DMS.Extensions"
|
||||||
xmlns:en="clr-namespace:DMS.Core.Enums"
|
xmlns:en="clr-namespace:DMS.Core.Enums"
|
||||||
Title="{Binding Title}"
|
Title="{Binding Title}"
|
||||||
|
|||||||
@@ -6,13 +6,13 @@
|
|||||||
xmlns:viewmodels="clr-namespace:DMS.WPF.ViewModels"
|
xmlns:viewmodels="clr-namespace:DMS.WPF.ViewModels"
|
||||||
xmlns:models="clr-namespace:DMS.Core.Models;assembly=DMS.Core"
|
xmlns:models="clr-namespace:DMS.Core.Models;assembly=DMS.Core"
|
||||||
xmlns:iNKORE="clr-namespace:iNKORE.UI.WPF.Modern.Controls;assembly=iNKORE.UI.WPF.Modern"
|
xmlns:iNKORE="clr-namespace:iNKORE.UI.WPF.Modern.Controls;assembly=iNKORE.UI.WPF.Modern"
|
||||||
xmlns:converters="clr-namespace:DMS.ValueConverts"
|
|
||||||
xmlns:extensions="clr-namespace:DMS.Extensions"
|
xmlns:extensions="clr-namespace:DMS.Extensions"
|
||||||
xmlns:enums="clr-namespace:DMS.Core.Enums"
|
xmlns:enums="clr-namespace:DMS.Core.Enums"
|
||||||
|
xmlns:valueConverts="clr-namespace:DMS.WPF.ValueConverts"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<converters:EnumDescriptionConverter x:Key="EnumDescriptionConverter"/>
|
<valueConverts:EnumDescriptionConverter x:Key="EnumDescriptionConverter"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
xmlns:vm="clr-namespace:DMS.WPF.ViewModels"
|
xmlns:vm="clr-namespace:DMS.WPF.ViewModels"
|
||||||
xmlns:controls="http://schemas.inkore.net/lib/ui/wpf/modern"
|
xmlns:controls="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
xmlns:vc="clr-namespace:DMS.ValueConverts"
|
|
||||||
xmlns:ex="clr-namespace:DMS.Extensions"
|
xmlns:ex="clr-namespace:DMS.Extensions"
|
||||||
xmlns:en="clr-namespace:DMS.Core.Enums"
|
xmlns:en="clr-namespace:DMS.Core.Enums"
|
||||||
xmlns:enums="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
xmlns:enums="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
||||||
xmlns:global="clr-namespace:;assembly=DMS.Core"
|
xmlns:global="clr-namespace:;assembly=DMS.Core"
|
||||||
|
xmlns:valueConverts="clr-namespace:DMS.WPF.ValueConverts"
|
||||||
Loaded="VariableTableView_OnLoaded"
|
Loaded="VariableTableView_OnLoaded"
|
||||||
d:DataContext="{d:DesignInstance vm:VariableTableViewModel}"
|
d:DataContext="{d:DesignInstance vm:VariableTableViewModel}"
|
||||||
d:DesignHeight="600"
|
d:DesignHeight="600"
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
EnumType="{x:Type enums:SignalType}" />
|
EnumType="{x:Type enums:SignalType}" />
|
||||||
<ex:EnumBindingSource x:Key="protocolType"
|
<ex:EnumBindingSource x:Key="protocolType"
|
||||||
EnumType="{x:Type enums:ProtocolType}" />
|
EnumType="{x:Type enums:ProtocolType}" />
|
||||||
<vc:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
<valueConverts:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
||||||
<ex:EnumBindingSource x:Key="pollLevelType"
|
<ex:EnumBindingSource x:Key="pollLevelType"
|
||||||
EnumType="{x:Type enums:PollLevelType}" />
|
EnumType="{x:Type enums:PollLevelType}" />
|
||||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||||
|
|||||||
Reference in New Issue
Block a user