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
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.
72 lines
2.3 KiB
C#
72 lines
2.3 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using Avalonia.Media;
|
|
using ZB.MOM.WW.OtOpcUa.Client.UI.ViewModels;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Client.UI.Views;
|
|
|
|
public partial class AckAlarmWindow : Window
|
|
{
|
|
private readonly AlarmsViewModel _alarmsVm;
|
|
private readonly AlarmEventViewModel _alarm;
|
|
|
|
/// <summary>Initializes a new instance of the AckAlarmWindow class for XAML designer support.</summary>
|
|
public AckAlarmWindow()
|
|
{
|
|
InitializeComponent();
|
|
_alarmsVm = null!;
|
|
_alarm = null!;
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the AckAlarmWindow class with alarm context.</summary>
|
|
/// <param name="alarmsVm">The alarms view model.</param>
|
|
/// <param name="alarm">The alarm event to acknowledge.</param>
|
|
public AckAlarmWindow(AlarmsViewModel alarmsVm, AlarmEventViewModel alarm)
|
|
{
|
|
InitializeComponent();
|
|
_alarmsVm = alarmsVm;
|
|
_alarm = alarm;
|
|
|
|
var sourceText = this.FindControl<TextBlock>("SourceText");
|
|
if (sourceText != null) sourceText.Text = alarm.SourceName;
|
|
|
|
var conditionText = this.FindControl<TextBlock>("ConditionText");
|
|
if (conditionText != null) conditionText.Text = $"{alarm.ConditionName} (Severity: {alarm.Severity})";
|
|
|
|
var ackButton = this.FindControl<Button>("AckButton");
|
|
if (ackButton != null) ackButton.Click += OnAckClicked;
|
|
|
|
var cancelButton = this.FindControl<Button>("CancelButton");
|
|
if (cancelButton != null) cancelButton.Click += OnCancelClicked;
|
|
}
|
|
|
|
private async void OnAckClicked(object? sender, RoutedEventArgs e)
|
|
{
|
|
var commentInput = this.FindControl<TextBox>("CommentInput");
|
|
var resultText = this.FindControl<TextBlock>("ResultText");
|
|
if (commentInput == null || resultText == null) return;
|
|
|
|
var comment = commentInput.Text ?? string.Empty;
|
|
|
|
resultText.Foreground = Brushes.Gray;
|
|
resultText.Text = "Acknowledging...";
|
|
|
|
var (success, message) = await _alarmsVm.AcknowledgeAlarmAsync(_alarm, comment);
|
|
|
|
if (success)
|
|
{
|
|
Close();
|
|
}
|
|
else
|
|
{
|
|
resultText.Foreground = Brushes.Red;
|
|
resultText.Text = message;
|
|
}
|
|
}
|
|
|
|
private void OnCancelClicked(object? sender, RoutedEventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
}
|