修改了添加设备界面和变量表界面
This commit is contained in:
@@ -13,72 +13,89 @@
|
||||
Title="{Binding Title}"
|
||||
CloseButtonText="取消"
|
||||
DefaultButton="Primary"
|
||||
PrimaryButtonText="添加"
|
||||
|
||||
PrimaryButtonText="添加设备"
|
||||
Background="#fff"
|
||||
d:DataContext="{d:DesignInstance vmd:DeviceDialogViewModel}"
|
||||
mc:Ignorable="d">
|
||||
<ui:ContentDialog.Resources>
|
||||
<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" />
|
||||
|
||||
|
||||
</ui:ContentDialog.Resources>
|
||||
<ikw:SimpleStackPanel Width="260" Spacing="12">
|
||||
<!-- 设备名称 -->
|
||||
<TextBlock Text="设备名称" HorizontalAlignment="Left" Style="{StaticResource TextBlockSubTitle}" />
|
||||
<TextBox
|
||||
Text="{Binding Device.Name, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<!-- 设备描述 -->
|
||||
<TextBlock Text="设备描述" HorizontalAlignment="Left" Style="{StaticResource TextBlockSubTitle}" />
|
||||
<TextBox
|
||||
Text="{Binding Device.Description, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<!-- 设备IP地址 -->
|
||||
<TextBlock Text="设备IP地址" HorizontalAlignment="Left" Style="{StaticResource TextBlockSubTitle}" />
|
||||
<TextBox
|
||||
AcceptsReturn="True"
|
||||
Text="{Binding Device.Ip, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
<Grid Width="480" Margin="10" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- 左边列 -->
|
||||
<ikw:SimpleStackPanel Grid.Column="0" Margin="10 10 20 10 " Spacing="12">
|
||||
<!-- 设备名称 -->
|
||||
<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.Ip, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
<!-- 设备类型 -->
|
||||
<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>
|
||||
<!-- 设备类型 -->
|
||||
<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>
|
||||
|
||||
<!-- 通讯协议-->
|
||||
<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>
|
||||
<!-- 通讯协议-->
|
||||
<CheckBox Content="是否启用" IsChecked="{Binding Device.IsActive}" />
|
||||
<!-- <TextBox ui:ControlHelper.Header="PrimaryButtonText" -->
|
||||
<!-- Text="{Binding ElementName=dialog, Path=PrimaryButtonText, UpdateSourceTrigger=PropertyChanged}" /> -->
|
||||
<!-- <TextBox ui:ControlHelper.Header="SecondaryButtonText" -->
|
||||
<!-- Text="{Binding ElementName=dialog, Path=SecondaryButtonText, UpdateSourceTrigger=PropertyChanged}" /> -->
|
||||
<!-- <TextBox ui:ControlHelper.Header="CloseButtonText" -->
|
||||
<!-- Text="{Binding ElementName=dialog, Path=CloseButtonText, UpdateSourceTrigger=PropertyChanged}" /> -->
|
||||
<!-- <ComboBox -->
|
||||
<!-- ui:ControlHelper.Header="DefaultButton" -->
|
||||
<!-- ItemsSource="{Binding Source={x:Type ui:ContentDialogButton}}" -->
|
||||
<!-- SelectedItem="{Binding ElementName=dialog, Path=DefaultButton}" /> -->
|
||||
<!-- -->
|
||||
<!-- <CheckBox Content="IsShadowEnabled" IsChecked="{Binding ElementName=dialog, Path=IsShadowEnabled}" /> -->
|
||||
<!-- <StackPanel> -->
|
||||
<!-- <Button Click="TryOpenAnother" Content="Try to open another ContentDialog" /> -->
|
||||
<!-- <TextBlock -->
|
||||
<!-- x:Name="ErrorText" -->
|
||||
<!-- Margin="0,8,0,0" -->
|
||||
<!-- Foreground="{DynamicResource SystemControlErrorTextForegroundBrush}" -->
|
||||
<!-- Visibility="Collapsed" /> -->
|
||||
<!-- </StackPanel> -->
|
||||
</ikw:SimpleStackPanel>
|
||||
<!-- 通讯协议-->
|
||||
<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>
|
||||
|
||||
|
||||
</ikw:SimpleStackPanel>
|
||||
<!-- 右边列 -->
|
||||
<ikw:SimpleStackPanel Margin="10" Grid.Column="1" Spacing="12">
|
||||
|
||||
<!-- 设备描述 -->
|
||||
<TextBlock Text="设备描述" HorizontalAlignment="Left" Style="{StaticResource TextBlockSubTitle}" />
|
||||
<TextBox
|
||||
Text="{Binding Device.Description, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<!-- 设备IP地址 -->
|
||||
<TextBlock Text="设备端口" HorizontalAlignment="Left" Style="{StaticResource TextBlockSubTitle}" />
|
||||
<TextBox
|
||||
AcceptsReturn="True"
|
||||
Text="{Binding Device.Ip, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
|
||||
|
||||
<!-- 通讯协议-->
|
||||
<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>
|
||||
<!-- 通讯协议-->
|
||||
|
||||
<CheckBox FontSize="16" Content="是否启用" Margin="0 30 0 0" IsChecked="{Binding Device.IsActive}" />
|
||||
|
||||
</ikw:SimpleStackPanel>
|
||||
</Grid>
|
||||
|
||||
</ui:ContentDialog>
|
||||
@@ -68,34 +68,4 @@ public partial class MainView : Window
|
||||
_viewModel.OnLoaded();
|
||||
}
|
||||
|
||||
// private void NavigationView_OnItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
|
||||
// {
|
||||
// ViewModelBase navgateVM = App.Current.Services.GetRequiredService<HomeViewModel>();
|
||||
//
|
||||
// switch (args.InvokedItem)
|
||||
// {
|
||||
// case "主页":
|
||||
// // mainViewModel.NavgateTo<HomeViewModel>();
|
||||
// navgateVM = App.Current.Services.GetRequiredService<HomeViewModel>();
|
||||
// _logger.LogInformation("导航到到主页面");
|
||||
// break;
|
||||
// case "设备":
|
||||
// navgateVM = App.Current.Services.GetRequiredService<DevicesViewModel>();
|
||||
// // mainViewModel.NavgateTo<DevicesViewModel>();
|
||||
// _logger.LogInformation("导航到到设备页面");
|
||||
// break;
|
||||
// case "数据转换":
|
||||
// navgateVM = App.Current.Services.GetRequiredService<DataTransformViewModel>();
|
||||
// // mainViewModel.NavgateTo<DataTransformViewModel>();
|
||||
// _logger.LogInformation("导航到到数据转换页面");
|
||||
// break;
|
||||
// case "设置":
|
||||
// // mainViewModel.NavgateTo<SettingViewModel>();
|
||||
// navgateVM = App.Current.Services.GetRequiredService<SettingViewModel>();
|
||||
// _logger.LogInformation("导航到到设备页面");
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// MessageHelper.SendNavgatorMessage(navgateVM);
|
||||
// }
|
||||
}
|
||||
@@ -4,25 +4,75 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:vm="clr-namespace:PMSWPF.ViewModels"
|
||||
xmlns:controls="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance vm:VariableTableViewModel}"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<ikw:SimpleStackPanel Spacing="5">
|
||||
d:DesignHeight="600" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<!-- 标签字体的样式 -->
|
||||
<Style TargetType="TextBlock" x:Key="VarTableLabelStyle">
|
||||
<Setter Property="Foreground" Value="#555" />
|
||||
<Setter Property="FontSize" Value="20" />
|
||||
</Style>
|
||||
<!-- 值字体的样式 -->
|
||||
<Style TargetType="TextBlock" x:Key="VarTableValueStyle">
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
<Setter Property="MinWidth" Value="120" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<DockPanel>
|
||||
|
||||
<ikw:SimpleStackPanel Margin="10" DockPanel.Dock="Top">
|
||||
<!-- 操作菜单 -->
|
||||
<controls:CommandBar x:Name="PrimaryCommandBar"
|
||||
DefaultLabelPosition="Right" IsOpen="False">
|
||||
<ui:AppBarButton x:Name="AddButton"
|
||||
Command="{Binding AddDeviceCommand}"
|
||||
Label="Add">
|
||||
<ui:AppBarButton.Icon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Add}" />
|
||||
</ui:AppBarButton.Icon>
|
||||
</ui:AppBarButton>
|
||||
<ui:AppBarButton x:Name="EditButton"
|
||||
Label="Edit">
|
||||
<ui:AppBarButton.Icon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Edit}" />
|
||||
</ui:AppBarButton.Icon>
|
||||
|
||||
</ui:AppBarButton>
|
||||
<ui:AppBarButton x:Name="ShareButton"
|
||||
Label="Share">
|
||||
<ui:AppBarButton.Icon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Share}" />
|
||||
</ui:AppBarButton.Icon>
|
||||
</ui:AppBarButton>
|
||||
<ui:CommandBar.SecondaryCommands>
|
||||
<ui:AppBarButton x:Name="SettingsButton"
|
||||
|
||||
Icon="Setting" Label="Settings" />
|
||||
</ui:CommandBar.SecondaryCommands>
|
||||
</controls:CommandBar>
|
||||
<!-- 变量表的名称描述等信息 -->
|
||||
<ikw:SimpleStackPanel Margin="10" Orientation="Horizontal" Spacing="10">
|
||||
<TextBlock Style="{StaticResource VarTableLabelStyle}" Text="变量表名称:" />
|
||||
<TextBlock Style="{StaticResource VarTableValueStyle}" Text="{Binding VariableTable.Name}" />
|
||||
<TextBlock Style="{StaticResource VarTableLabelStyle}" Text="变量表描述:" />
|
||||
<TextBlock Style="{StaticResource VarTableValueStyle}" Text="{Binding VariableTable.Description}" />
|
||||
<TextBlock Style="{StaticResource VarTableLabelStyle}" Text="所属设备:" />
|
||||
<TextBlock Style="{StaticResource VarTableValueStyle}" Text="默认变量表" />
|
||||
</ikw:SimpleStackPanel>
|
||||
|
||||
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="10">
|
||||
<TextBlock Text="变量表名称:" /> <TextBlock Text="{Binding VariableTable.Name}" />
|
||||
</ikw:SimpleStackPanel>
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="10">
|
||||
<TextBlock Text="变量表描述:" /> <TextBlock Text="{Binding VariableTable.Description}" />
|
||||
</ikw:SimpleStackPanel>
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="10">
|
||||
<TextBlock Text="所属设备:" /> <TextBlock Text="默认变量表" />
|
||||
</ikw:SimpleStackPanel>
|
||||
<DataGrid>
|
||||
|
||||
|
||||
<DataGrid Margin="10" >
|
||||
|
||||
</DataGrid>
|
||||
</ikw:SimpleStackPanel>
|
||||
|
||||
</DockPanel>
|
||||
|
||||
</UserControl>
|
||||
Reference in New Issue
Block a user