2025-08-25 20:16:57 +08:00
|
|
|
<controls:ContentDialog
|
|
|
|
|
x:Class="DMS.WPF.Views.Dialogs.ImportOpcUaDialog"
|
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
|
|
xmlns:controls="http://schemas.inkore.net/lib/ui/wpf/modern"
|
|
|
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
|
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
|
|
|
xmlns:vm="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
|
|
|
|
Title="从OPC UA服务器导入变量"
|
|
|
|
|
d:DataContext="{d:DesignInstance vm:ImportOpcUaDialogViewModel}"
|
|
|
|
|
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
|
|
|
|
|
PrimaryButtonText="导入"
|
|
|
|
|
SecondaryButtonClick="ContentDialog_SecondaryButtonClick"
|
|
|
|
|
SecondaryButtonText="取消"
|
|
|
|
|
mc:Ignorable="d">
|
|
|
|
|
<Grid>
|
|
|
|
|
<Grid.RowDefinitions>
|
2025-08-25 21:26:18 +08:00
|
|
|
<RowDefinition Height="Auto" />
|
2025-08-25 20:16:57 +08:00
|
|
|
<RowDefinition Height="*" />
|
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
<ColumnDefinition Width="2*" />
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
2025-08-25 21:26:18 +08:00
|
|
|
<!-- 连接区域 -->
|
|
|
|
|
<StackPanel
|
|
|
|
|
Grid.Row="0"
|
|
|
|
|
Grid.Column="0"
|
|
|
|
|
Grid.ColumnSpan="2"
|
|
|
|
|
Margin="0,0,0,10"
|
|
|
|
|
Orientation="Horizontal">
|
|
|
|
|
<TextBox
|
|
|
|
|
x:Name="EndpointUrlTextBox"
|
|
|
|
|
Width="300"
|
|
|
|
|
Margin="0,0,10,0"
|
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
IsEnabled="False"
|
|
|
|
|
Text="{Binding EndpointUrl, UpdateSourceTrigger=PropertyChanged}" />
|
|
|
|
|
<Button
|
|
|
|
|
x:Name="ConnectButton"
|
|
|
|
|
Command="{Binding ConnectCommand}"
|
|
|
|
|
Content="{Binding ConnectButtonText}"
|
|
|
|
|
IsEnabled="{Binding IsConnectButtonEnabled}"
|
|
|
|
|
Style="{StaticResource AccentButtonStyle}" />
|
|
|
|
|
</StackPanel>
|
|
|
|
|
|
2025-08-25 20:16:57 +08:00
|
|
|
<!-- 节点树 -->
|
|
|
|
|
<TreeView
|
2025-08-25 21:26:18 +08:00
|
|
|
Grid.Row="1"
|
2025-08-25 20:16:57 +08:00
|
|
|
Grid.Column="0"
|
|
|
|
|
Margin="0,0,10,0"
|
2025-09-01 21:03:34 +08:00
|
|
|
ItemsSource="{Binding RootOpcUaNode.Children}"
|
2025-08-25 20:16:57 +08:00
|
|
|
SelectedItemChanged="TreeView_SelectedItemChanged">
|
|
|
|
|
<TreeView.Style>
|
|
|
|
|
<Style BasedOn="{StaticResource {x:Type TreeView}}" TargetType="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>
|
|
|
|
|
<TreeView.ItemTemplate>
|
|
|
|
|
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
|
|
|
|
|
<TextBlock Text="{Binding DisplayName}" />
|
|
|
|
|
</HierarchicalDataTemplate>
|
|
|
|
|
</TreeView.ItemTemplate>
|
|
|
|
|
</TreeView>
|
|
|
|
|
|
|
|
|
|
<!-- 变量列表 -->
|
|
|
|
|
<DataGrid
|
2025-08-25 21:26:18 +08:00
|
|
|
Grid.Row="1"
|
2025-08-25 20:16:57 +08:00
|
|
|
Grid.Column="1"
|
|
|
|
|
AutoGenerateColumns="False"
|
|
|
|
|
IsReadOnly="True"
|
|
|
|
|
ItemsSource="{Binding SelectedNodeVariables}"
|
|
|
|
|
SelectionChanged="Selector_OnSelectionChanged">
|
|
|
|
|
<DataGrid.Style>
|
|
|
|
|
<Style BasedOn="{StaticResource {x:Type DataGrid}}" TargetType="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>
|
|
|
|
|
<DataGrid.Columns>
|
|
|
|
|
<DataGridTemplateColumn>
|
|
|
|
|
<DataGridTemplateColumn.HeaderTemplate>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<CheckBox IsChecked="{Binding DataContext.SelectAllVariables, RelativeSource={RelativeSource AncestorType=DataGrid}}" />
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</DataGridTemplateColumn.HeaderTemplate>
|
|
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<CheckBox IsChecked="{Binding IsSelect, UpdateSourceTrigger=PropertyChanged}" />
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
|
|
|
</DataGridTemplateColumn>
|
|
|
|
|
<DataGridTextColumn Binding="{Binding Name}" Header="名称" />
|
|
|
|
|
<DataGridTextColumn Binding="{Binding OpcUaNodeId}" Header="节点ID" />
|
|
|
|
|
<DataGridTextColumn Binding="{Binding SignalType}" Header="数据类型" />
|
|
|
|
|
</DataGrid.Columns>
|
|
|
|
|
</DataGrid>
|
|
|
|
|
</Grid>
|
|
|
|
|
</controls:ContentDialog>
|