1
0
mirror of synced 2024-11-05 09:49:16 +00:00
MassiveKnob/Windows/MassiveKnob.Plugin.EmulatorDevice/Settings/EmulatorDeviceSettingsViewModel.cs
Mark van Renswoude 28c25c8b43 Implemented OSD
Implemented mute/unmute input and output actions
Changed MockDevice to EmulatorDevice with UI for easier testing
2021-02-24 19:35:01 +01:00

82 lines
2.1 KiB
C#

using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace MassiveKnob.Plugin.EmulatorDevice.Settings
{
public class EmulatorDeviceSettingsViewModel : INotifyPropertyChanged
{
private readonly EmulatorDeviceSettings settings;
public event PropertyChangedEventHandler PropertyChanged;
// ReSharper disable UnusedMember.Global - used by WPF Binding
public int AnalogInputCount
{
get => settings.AnalogInputCount;
set
{
if (value == settings.AnalogInputCount)
return;
settings.AnalogInputCount = value;
OnPropertyChanged();
}
}
public int DigitalInputCount
{
get => settings.DigitalInputCount;
set
{
if (value == settings.DigitalInputCount)
return;
settings.DigitalInputCount = value;
OnPropertyChanged();
}
}
public int AnalogOutputCount
{
get => settings.AnalogOutputCount;
set
{
if (value == settings.AnalogOutputCount)
return;
settings.AnalogOutputCount = value;
OnPropertyChanged();
}
}
public int DigitalOutputCount
{
get => settings.DigitalOutputCount;
set
{
if (value == settings.DigitalOutputCount)
return;
settings.DigitalOutputCount = value;
OnPropertyChanged();
}
}
// ReSharper restore UnusedMember.Global
public EmulatorDeviceSettingsViewModel(EmulatorDeviceSettings settings)
{
this.settings = settings;
}
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}