1using CommunityToolkit.Mvvm.ComponentModel;
3using System.Collections.ObjectModel;
4using System.Diagnostics.CodeAnalysis;
26 this.Ended = Args.
Ended;
40 await base.OnInitializeAsync();
42 ServiceRef.XmppService.NeuroFeatureVariablesUpdated += this.Wallet_VariablesUpdated;
43 ServiceRef.XmppService.NeuroFeatureStateUpdated += this.Wallet_StateUpdated;
49 ServiceRef.XmppService.NeuroFeatureVariablesUpdated -= this.Wallet_VariablesUpdated;
50 ServiceRef.XmppService.NeuroFeatureStateUpdated -= this.Wallet_StateUpdated;
52 return base.OnDisposeAsync();
57 MainThread.BeginInvokeOnMainThread(() =>
59 this.CurrentState = e.NewState;
60 this.Ended =
string.IsNullOrEmpty(e.NewState);
61 this.Running = !
this.Ended;
64 return Task.CompletedTask;
69 MainThread.BeginInvokeOnMainThread(() =>
73 if (this.TryGetVariableMode(Variable.Name, out VariableModel? Model))
74 Model.UpdateValue(Variable.ValueObject);
76 this.Variables.Add(new VariableModel(Variable.Name, Variable.ValueObject));
80 return Task.CompletedTask;
83 private bool TryGetVariableMode(
string Name, [NotNullWhen(
true)] out VariableModel? Result)
85 foreach (VariableModel Model
in this.
Variables)
87 if (Model.Name == Name)
103 public ObservableCollection<VariableModel>
Variables {
get; }
109 private bool running;
121 private string? currentState;
A base class for all view models, inheriting from the BindableObject. NOTE: using this class requir...
Holds navigation parameters specific to the current state of a state-machine.
Variables? Variables
Current variables
bool Running
If the State-machine is running
string? CurrentState
The Current State of the state-machine.
bool Ended
If the State-machine has ended
The view model to bind to for when displaying information about the current state of a state-machine.
MachineVariablesViewModel(MachineVariablesNavigationArgs? Args)
The view model to bind to for when displaying information about the current state of a state-machine.
override Task OnDisposeAsync()
Method called when the view is disposed, and will not be used more. Use this method to unregister eve...
override async Task OnInitializeAsync()
Method called when view is initialized for the first time. Use this method to implement registration ...
Event arguments events when the current state of a state-machine has changed.
Event arguments events when the variables of a state-machine has changed.
Contains information about a variable.
object ValueObject
Object Value of variable.
string Name
Name of variable.
virtual Variable Add(string Name, object Value)
Adds a variable to the collection.