Apply code style formatting and restore partial modifiers on Avalonia views
Linter/formatter pass across the full codebase. Restores required partial keyword on AXAML code-behind classes that the formatter incorrectly removed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,42 +7,34 @@ using ZB.MOM.WW.LmxOpcUa.Client.UI.Services;
|
||||
namespace ZB.MOM.WW.LmxOpcUa.Client.UI.ViewModels;
|
||||
|
||||
/// <summary>
|
||||
/// ViewModel for the read/write panel.
|
||||
/// ViewModel for the read/write panel.
|
||||
/// </summary>
|
||||
public partial class ReadWriteViewModel : ObservableObject
|
||||
{
|
||||
private readonly IOpcUaClientService _service;
|
||||
private readonly IUiDispatcher _dispatcher;
|
||||
private readonly IOpcUaClientService _service;
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(ReadCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(WriteCommand))]
|
||||
private string? _selectedNodeId;
|
||||
[ObservableProperty] private string? _currentStatus;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _currentValue;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _currentStatus;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _sourceTimestamp;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _serverTimestamp;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _writeValue;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _writeStatus;
|
||||
[ObservableProperty] private string? _currentValue;
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(ReadCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(WriteCommand))]
|
||||
private bool _isConnected;
|
||||
|
||||
public bool IsNodeSelected => !string.IsNullOrEmpty(SelectedNodeId);
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(ReadCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(WriteCommand))]
|
||||
private string? _selectedNodeId;
|
||||
|
||||
[ObservableProperty] private string? _serverTimestamp;
|
||||
|
||||
[ObservableProperty] private string? _sourceTimestamp;
|
||||
|
||||
[ObservableProperty] private string? _writeStatus;
|
||||
|
||||
[ObservableProperty] private string? _writeValue;
|
||||
|
||||
public ReadWriteViewModel(IOpcUaClientService service, IUiDispatcher dispatcher)
|
||||
{
|
||||
@@ -50,16 +42,18 @@ public partial class ReadWriteViewModel : ObservableObject
|
||||
_dispatcher = dispatcher;
|
||||
}
|
||||
|
||||
public bool IsNodeSelected => !string.IsNullOrEmpty(SelectedNodeId);
|
||||
|
||||
partial void OnSelectedNodeIdChanged(string? value)
|
||||
{
|
||||
OnPropertyChanged(nameof(IsNodeSelected));
|
||||
if (!string.IsNullOrEmpty(value) && IsConnected)
|
||||
{
|
||||
_ = ExecuteReadAsync();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(value) && IsConnected) _ = ExecuteReadAsync();
|
||||
}
|
||||
|
||||
private bool CanReadOrWrite() => IsConnected && !string.IsNullOrEmpty(SelectedNodeId);
|
||||
private bool CanReadOrWrite()
|
||||
{
|
||||
return IsConnected && !string.IsNullOrEmpty(SelectedNodeId);
|
||||
}
|
||||
|
||||
[RelayCommand(CanExecute = nameof(CanReadOrWrite))]
|
||||
private async Task ReadAsync()
|
||||
@@ -106,22 +100,16 @@ public partial class ReadWriteViewModel : ObservableObject
|
||||
var nodeId = NodeId.Parse(SelectedNodeId);
|
||||
var statusCode = await _service.WriteValueAsync(nodeId, WriteValue);
|
||||
|
||||
_dispatcher.Post(() =>
|
||||
{
|
||||
WriteStatus = statusCode.ToString();
|
||||
});
|
||||
_dispatcher.Post(() => { WriteStatus = statusCode.ToString(); });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_dispatcher.Post(() =>
|
||||
{
|
||||
WriteStatus = $"Error: {ex.Message}";
|
||||
});
|
||||
_dispatcher.Post(() => { WriteStatus = $"Error: {ex.Message}"; });
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears all displayed values.
|
||||
/// Clears all displayed values.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
@@ -133,4 +121,4 @@ public partial class ReadWriteViewModel : ObservableObject
|
||||
WriteValue = null;
|
||||
WriteStatus = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user