Class MyoViewModel
A base class for objects of which the properties must be observable.
Inherited Members
Namespace: MOSAIC.ViewModels.Devices
Assembly: MOSAIC.dll
Syntax
public class MyoViewModel : ObservableObject, INotifyPropertyChanged, INotifyPropertyChanging
Constructors
MyoViewModel(Myo)
Declaration
public MyoViewModel(Myo myo)
Parameters
| Type | Name | Description |
|---|---|---|
| Myo | myo |
Fields
_isBusy
Declaration
[ObservableProperty]
private bool _isBusy
Field Value
| Type | Description |
|---|---|
| bool |
_isConnected
Declaration
[ObservableProperty]
private bool _isConnected
Field Value
| Type | Description |
|---|---|
| bool |
_lastError
Declaration
[ObservableProperty]
private string? _lastError
Field Value
| Type | Description |
|---|---|
| string |
_selectedDevice
Declaration
[ObservableProperty]
private string? _selectedDevice
Field Value
| Type | Description |
|---|---|
| string |
_status
Declaration
[ObservableProperty]
private string _status
Field Value
| Type | Description |
|---|---|
| string |
connectCommand
The backing field for ConnectCommand.
Declaration
private AsyncRelayCommand? connectCommand
Field Value
| Type | Description |
|---|---|
| AsyncRelayCommand |
disconnectCommand
The backing field for DisconnectCommand.
Declaration
private AsyncRelayCommand? disconnectCommand
Field Value
| Type | Description |
|---|---|
| AsyncRelayCommand |
startScanCommand
The backing field for StartScanCommand.
Declaration
private AsyncRelayCommand? startScanCommand
Field Value
| Type | Description |
|---|---|
| AsyncRelayCommand |
toggleConnectCommand
The backing field for ToggleConnectCommand.
Declaration
private AsyncRelayCommand? toggleConnectCommand
Field Value
| Type | Description |
|---|---|
| AsyncRelayCommand |
Properties
ConnectCommand
Gets an IAsyncRelayCommand instance wrapping Connect().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand ConnectCommand { get; }
Property Value
| Type | Description |
|---|---|
| IAsyncRelayCommand |
DisconnectCommand
Gets an IAsyncRelayCommand instance wrapping Disconnect().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand DisconnectCommand { get; }
Property Value
| Type | Description |
|---|---|
| IAsyncRelayCommand |
FoundDevices
Declaration
public ObservableCollection<string> FoundDevices { get; }
Property Value
| Type | Description |
|---|---|
| ObservableCollection<string> |
FrequencyText
Declaration
public string FrequencyText { get; }
Property Value
| Type | Description |
|---|---|
| string |
IsBusy
Declaration
[ExcludeFromCodeCoverage]
public bool IsBusy { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsConnected
Declaration
[ExcludeFromCodeCoverage]
public bool IsConnected { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
LastError
Declaration
[ExcludeFromCodeCoverage]
public string? LastError { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Myo
Declaration
public Myo Myo { get; }
Property Value
| Type | Description |
|---|---|
| Myo |
Name
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
SelectedDevice
Declaration
[ExcludeFromCodeCoverage]
public string? SelectedDevice { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
StartScanCommand
Gets an IAsyncRelayCommand instance wrapping StartScan().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand StartScanCommand { get; }
Property Value
| Type | Description |
|---|---|
| IAsyncRelayCommand |
Status
Declaration
[ExcludeFromCodeCoverage]
public string Status { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ToggleConnectCommand
Gets an IAsyncRelayCommand instance wrapping ToggleConnect().
Declaration
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand ToggleConnectCommand { get; }
Property Value
| Type | Description |
|---|---|
| IAsyncRelayCommand |
Methods
CanConnect()
Declaration
private bool CanConnect()
Returns
| Type | Description |
|---|---|
| bool |
CanDisconnect()
Declaration
private bool CanDisconnect()
Returns
| Type | Description |
|---|---|
| bool |
Connect()
Declaration
[RelayCommand(CanExecute = "CanConnect")]
private Task Connect()
Returns
| Type | Description |
|---|---|
| Task |
Disconnect()
Declaration
[RelayCommand(CanExecute = "CanDisconnect")]
private Task Disconnect()
Returns
| Type | Description |
|---|---|
| Task |
OnIsBusyChanged(bool)
Executes the logic for when IsBusy just changed.
Declaration
private void OnIsBusyChanged(bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | value | The new property value that was set. |
Remarks
This method is invoked right after the value of IsBusy is changed.
OnIsBusyChanged(bool, bool)
Executes the logic for when IsBusy just changed.
Declaration
private void OnIsBusyChanged(bool oldValue, bool newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | oldValue | The previous property value that was replaced. |
| bool | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of IsBusy is changed.
OnIsBusyChanging(bool)
Executes the logic for when IsBusy is changing.
Declaration
private void OnIsBusyChanging(bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | value | The new property value being set. |
Remarks
This method is invoked right before the value of IsBusy is changed.
OnIsBusyChanging(bool, bool)
Executes the logic for when IsBusy is changing.
Declaration
private void OnIsBusyChanging(bool oldValue, bool newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | oldValue | The previous property value that is being replaced. |
| bool | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of IsBusy is changed.
OnIsConnectedChanged(bool)
Executes the logic for when IsConnected just changed.
Declaration
private void OnIsConnectedChanged(bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | value | The new property value that was set. |
Remarks
This method is invoked right after the value of IsConnected is changed.
OnIsConnectedChanged(bool, bool)
Executes the logic for when IsConnected just changed.
Declaration
private void OnIsConnectedChanged(bool oldValue, bool newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | oldValue | The previous property value that was replaced. |
| bool | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of IsConnected is changed.
OnIsConnectedChanging(bool)
Executes the logic for when IsConnected is changing.
Declaration
private void OnIsConnectedChanging(bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | value | The new property value being set. |
Remarks
This method is invoked right before the value of IsConnected is changed.
OnIsConnectedChanging(bool, bool)
Executes the logic for when IsConnected is changing.
Declaration
private void OnIsConnectedChanging(bool oldValue, bool newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | oldValue | The previous property value that is being replaced. |
| bool | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of IsConnected is changed.
OnLastErrorChanged(string?)
Executes the logic for when LastError just changed.
Declaration
private void OnLastErrorChanged(string? value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The new property value that was set. |
Remarks
This method is invoked right after the value of LastError is changed.
OnLastErrorChanged(string?, string?)
Executes the logic for when LastError just changed.
Declaration
private void OnLastErrorChanged(string? oldValue, string? newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | oldValue | The previous property value that was replaced. |
| string | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of LastError is changed.
OnLastErrorChanging(string?)
Executes the logic for when LastError is changing.
Declaration
private void OnLastErrorChanging(string? value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The new property value being set. |
Remarks
This method is invoked right before the value of LastError is changed.
OnLastErrorChanging(string?, string?)
Executes the logic for when LastError is changing.
Declaration
private void OnLastErrorChanging(string? oldValue, string? newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | oldValue | The previous property value that is being replaced. |
| string | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of LastError is changed.
OnSelectedDeviceChanged(string?)
Executes the logic for when SelectedDevice just changed.
Declaration
private void OnSelectedDeviceChanged(string? value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The new property value that was set. |
Remarks
This method is invoked right after the value of SelectedDevice is changed.
OnSelectedDeviceChanged(string?, string?)
Executes the logic for when SelectedDevice just changed.
Declaration
private void OnSelectedDeviceChanged(string? oldValue, string? newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | oldValue | The previous property value that was replaced. |
| string | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of SelectedDevice is changed.
OnSelectedDeviceChanging(string?)
Executes the logic for when SelectedDevice is changing.
Declaration
private void OnSelectedDeviceChanging(string? value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The new property value being set. |
Remarks
This method is invoked right before the value of SelectedDevice is changed.
OnSelectedDeviceChanging(string?, string?)
Executes the logic for when SelectedDevice is changing.
Declaration
private void OnSelectedDeviceChanging(string? oldValue, string? newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | oldValue | The previous property value that is being replaced. |
| string | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of SelectedDevice is changed.
OnStatusChanged(string)
Executes the logic for when Status just changed.
Declaration
private void OnStatusChanged(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The new property value that was set. |
Remarks
This method is invoked right after the value of Status is changed.
OnStatusChanged(string?, string)
Executes the logic for when Status just changed.
Declaration
private void OnStatusChanged(string? oldValue, string newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | oldValue | The previous property value that was replaced. |
| string | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of Status is changed.
OnStatusChanging(string)
Executes the logic for when Status is changing.
Declaration
private void OnStatusChanging(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The new property value being set. |
Remarks
This method is invoked right before the value of Status is changed.
OnStatusChanging(string?, string)
Executes the logic for when Status is changing.
Declaration
private void OnStatusChanging(string? oldValue, string newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | oldValue | The previous property value that is being replaced. |
| string | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of Status is changed.
StartScan()
Declaration
[RelayCommand]
private Task StartScan()
Returns
| Type | Description |
|---|---|
| Task |
ToggleConnect()
Declaration
[RelayCommand]
private Task ToggleConnect()
Returns
| Type | Description |
|---|---|
| Task |