HeadMeld 0.0.0.1

- Working MVVM implementation
- Refactored code
This commit is contained in:
2022-03-27 22:20:56 +01:00
parent ae9fbc6d97
commit 67f440e7e8
7 changed files with 131 additions and 79 deletions
+50
View File
@@ -0,0 +1,50 @@
using System.Collections.Generic;
using System.ComponentModel;
using HeadMeld.Models;
namespace HeadMeld.ViewModels
{
sealed class MainWindowViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
protected void OnPropertyChange(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
private MainWindowModel _model = new();
public bool ToggleAPOEnabled
{
get { return _model.ToggleAPOEnabled; }
set
{
if (_model.ToggleAPOEnabled != value)
{
_model.ToggleAPOEnabled = value;
OnPropertyChange(nameof(ToggleAPOEnabled));
}
}
}
public List<string> Profiles
{
get { return _model.Profiles; }
set
{
if (_model.Profiles != value)
{
_model.Profiles = value;
OnPropertyChange(nameof(Profiles));
}
}
}
public MainWindowViewModel()
{
_model = new()
{
ToggleAPOEnabled = true,
Profiles = new List<string>() { "1", "2"}
};
}
}
}