2025-07-09 13:06:21 +08:00
|
|
|
using System.Windows;
|
2025-07-09 19:38:36 +08:00
|
|
|
using System.Windows.Controls;
|
2025-07-09 13:06:21 +08:00
|
|
|
using CommunityToolkit.Mvvm.Messaging;
|
2025-07-18 19:56:00 +08:00
|
|
|
using DMS.Models;
|
|
|
|
|
using DMS.ViewModels.Dialogs;
|
2025-07-09 13:06:21 +08:00
|
|
|
using iNKORE.UI.WPF.Modern.Controls;
|
|
|
|
|
|
2025-07-18 19:56:00 +08:00
|
|
|
namespace DMS.Views.Dialogs;
|
2025-07-09 13:06:21 +08:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// OpcUaImportDialog.xaml 的交互逻辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class OpcUaImportDialog : ContentDialog
|
|
|
|
|
{
|
|
|
|
|
public OpcUaImportDialogViewModel ViewModel
|
|
|
|
|
{
|
|
|
|
|
get => (OpcUaImportDialogViewModel)DataContext;
|
|
|
|
|
set => DataContext = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public OpcUaImportDialog(OpcUaImportDialogViewModel viewModel)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
ViewModel = viewModel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
// 在这里处理导入逻辑,例如获取选中的变量
|
|
|
|
|
// ViewModel.ImportSelectedVariables();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
// 处理取消逻辑
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
|
|
|
|
{
|
|
|
|
|
if (e.NewValue is OpcUaNode selectedNode)
|
|
|
|
|
{
|
|
|
|
|
await ViewModel.LoadNodeVariables(selectedNode);
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-07-09 19:38:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
if (args.AddedItems!=null && args.AddedItems.Count>0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in args.AddedItems)
|
|
|
|
|
{
|
2025-07-17 20:13:21 +08:00
|
|
|
ViewModel.SelectedVariables.Add((Variable)item);
|
2025-07-09 19:38:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-07-09 13:06:21 +08:00
|
|
|
}
|