1
0
mirror of synced 2024-11-16 13:33:50 +00:00
MassiveKnob/Windows/MassiveKnob.Plugin.MockDevice/Settings/MockDeviceSettingsViewModel.cs
Mark van Renswoude ff1e1ca74c Working proof-of-concept for refactoring
Implemented orchestrator
Implemented mock device
Implemented serial device
Implemented volume action
Removed old implementation
2021-02-24 09:05:11 +01:00

68 lines
1.7 KiB
C#

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