Files
lmxopcua/src/Client/ZB.MOM.WW.OtOpcUa.Client.UI/Views/SubscriptionsView.axaml.cs
T
Joseph Doherty 64e3fbe035
v2-ci / build (push) Failing after 1m43s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests) (push) Has been skipped
docs: backfill XML documentation across 756 files
Adds <summary>, <param>, <typeparam>, and <inheritdoc/> tags to public
members surfaced by commentchecker — resolves 5,847 of 5,869 issues
(99.6%) across three /fixdocs passes.
2026-05-28 08:10:17 -04:00

54 lines
1.6 KiB
C#

using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.VisualTree;
using ZB.MOM.WW.OtOpcUa.Client.UI.ViewModels;
namespace ZB.MOM.WW.OtOpcUa.Client.UI.Views;
public partial class SubscriptionsView : UserControl
{
/// <summary>Initializes a new instance of the <see cref="SubscriptionsView"/> class.</summary>
public SubscriptionsView()
{
InitializeComponent();
}
/// <inheritdoc />
protected override void OnLoaded(RoutedEventArgs e)
{
base.OnLoaded(e);
var grid = this.FindControl<DataGrid>("SubscriptionsGrid");
if (grid != null)
{
grid.DoubleTapped += OnGridDoubleTapped;
grid.SelectionChanged += OnGridSelectionChanged;
}
}
private void OnGridSelectionChanged(object? sender, SelectionChangedEventArgs e)
{
if (DataContext is not SubscriptionsViewModel vm || sender is not DataGrid grid) return;
vm.SelectedSubscriptions.Clear();
foreach (var item in grid.SelectedItems)
if (item is SubscriptionItemViewModel sub)
vm.SelectedSubscriptions.Add(sub);
vm.RemoveSubscriptionCommand.NotifyCanExecuteChanged();
}
private void OnGridDoubleTapped(object? sender, TappedEventArgs e)
{
if (DataContext is not SubscriptionsViewModel vm) return;
if (vm.SelectedSubscription is not { } item) return;
var parentWindow = this.FindAncestorOfType<Window>();
if (parentWindow == null) return;
var writeWindow = new WriteValueWindow(vm, item.NodeId, item.Value);
writeWindow.ShowDialog(parentWindow);
}
}