2025-07-18 19:56:00 +08:00
|
|
|
<controls:ContentDialog x:Class="DMS.Views.Dialogs.OpcUaImportDialog"
|
2025-07-09 13:06:21 +08:00
|
|
|
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:controls="http://schemas.inkore.net/lib/ui/wpf/modern"
|
2025-07-18 19:56:00 +08:00
|
|
|
xmlns:vm="clr-namespace:DMS.ViewModels.Dialogs"
|
2025-07-09 13:06:21 +08:00
|
|
|
mc:Ignorable="d"
|
|
|
|
|
d:DataContext="{d:DesignInstance vm:OpcUaImportDialogViewModel}"
|
|
|
|
|
Title="从OPC UA服务器导入变量"
|
|
|
|
|
PrimaryButtonText="导入"
|
|
|
|
|
SecondaryButtonText="取消"
|
|
|
|
|
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
|
|
|
|
|
SecondaryButtonClick="ContentDialog_SecondaryButtonClick"
|
2025-07-09 21:35:51 +08:00
|
|
|
>
|
2025-07-09 13:06:21 +08:00
|
|
|
<Grid>
|
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
|
<RowDefinition Height="*" />
|
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
<ColumnDefinition Width="2*" />
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
|
|
|
|
<!-- 节点树 -->
|
2025-07-09 21:35:51 +08:00
|
|
|
<TreeView Grid.Row="0"
|
2025-07-09 19:38:36 +08:00
|
|
|
Grid.Column="0"
|
|
|
|
|
ItemsSource="{Binding OpcUaNodes}"
|
|
|
|
|
Margin="0,0,10,0"
|
|
|
|
|
SelectedItemChanged="TreeView_SelectedItemChanged">
|
2025-07-09 20:23:41 +08:00
|
|
|
<TreeView.Style>
|
|
|
|
|
<Style TargetType="TreeView"
|
|
|
|
|
BasedOn="{StaticResource {x:Type TreeView}}">
|
|
|
|
|
<Setter Property="Visibility"
|
|
|
|
|
Value="Collapsed" />
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
<DataTrigger Binding="{Binding IsConnected}"
|
|
|
|
|
Value="True">
|
|
|
|
|
<Setter Property="Visibility"
|
|
|
|
|
Value="Visible" />
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
|
|
|
|
</TreeView.Style>
|
2025-07-09 13:06:21 +08:00
|
|
|
<TreeView.ItemTemplate>
|
|
|
|
|
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
|
|
|
|
|
<TextBlock Text="{Binding DisplayName}" />
|
|
|
|
|
</HierarchicalDataTemplate>
|
|
|
|
|
</TreeView.ItemTemplate>
|
|
|
|
|
</TreeView>
|
|
|
|
|
|
|
|
|
|
<!-- 变量列表 -->
|
2025-07-09 21:35:51 +08:00
|
|
|
<DataGrid Grid.Row="0"
|
2025-07-09 19:38:36 +08:00
|
|
|
Grid.Column="1"
|
|
|
|
|
ItemsSource="{Binding SelectedNodeVariables}"
|
|
|
|
|
SelectionChanged="Selector_OnSelectionChanged"
|
|
|
|
|
AutoGenerateColumns="False"
|
|
|
|
|
IsReadOnly="True">
|
2025-07-09 20:23:41 +08:00
|
|
|
<DataGrid.Style>
|
|
|
|
|
<Style TargetType="DataGrid"
|
|
|
|
|
BasedOn="{StaticResource {x:Type DataGrid}}">
|
|
|
|
|
<Setter Property="Visibility"
|
|
|
|
|
Value="Collapsed" />
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
<DataTrigger Binding="{Binding IsConnected}"
|
|
|
|
|
Value="True">
|
|
|
|
|
<Setter Property="Visibility"
|
|
|
|
|
Value="Visible" />
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
|
|
|
|
</DataGrid.Style>
|
2025-07-09 13:06:21 +08:00
|
|
|
<DataGrid.Columns>
|
|
|
|
|
<DataGridTemplateColumn>
|
|
|
|
|
<DataGridTemplateColumn.HeaderTemplate>
|
|
|
|
|
<DataTemplate>
|
2025-07-09 19:38:36 +08:00
|
|
|
<CheckBox
|
|
|
|
|
IsChecked="{Binding DataContext.SelectAllVariables, RelativeSource={RelativeSource AncestorType=DataGrid}}" />
|
2025-07-09 13:06:21 +08:00
|
|
|
</DataTemplate>
|
|
|
|
|
</DataGridTemplateColumn.HeaderTemplate>
|
|
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
|
|
|
<DataTemplate>
|
2025-07-09 19:38:36 +08:00
|
|
|
<CheckBox IsChecked="{Binding IsSelect, UpdateSourceTrigger=PropertyChanged}" />
|
2025-07-09 13:06:21 +08:00
|
|
|
</DataTemplate>
|
|
|
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
|
|
|
</DataGridTemplateColumn>
|
2025-07-09 19:38:36 +08:00
|
|
|
<DataGridTextColumn Header="名称"
|
|
|
|
|
Binding="{Binding Name}" />
|
|
|
|
|
<DataGridTextColumn Header="节点ID"
|
|
|
|
|
Binding="{Binding OpcUaNodeId}" />
|
|
|
|
|
<DataGridTextColumn Header="数据类型"
|
|
|
|
|
Binding="{Binding DataType}" />
|
2025-07-09 13:06:21 +08:00
|
|
|
</DataGrid.Columns>
|
|
|
|
|
</DataGrid>
|
|
|
|
|
</Grid>
|
2025-07-09 19:38:36 +08:00
|
|
|
</controls:ContentDialog>
|