2019-05-18 21:25:36 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
|
|
|
|
|
|
namespace Aurora.Frontend.Views
|
|
|
|
|
{
|
2019-05-22 14:30:41 +00:00
|
|
|
|
public class BaseViewModel : INotifyPropertyChanged
|
2019-05-18 21:25:36 +00:00
|
|
|
|
{
|
|
|
|
|
public BaseViewModel()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region INotifyPropertyChanged Implementation
|
2019-05-22 14:30:41 +00:00
|
|
|
|
public bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
|
|
|
|
|
{
|
|
|
|
|
if (Object.Equals(storage, value))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
storage = value;
|
|
|
|
|
OnPropertyChanged(propertyName);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-18 21:25:36 +00:00
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
|
public void OnPropertyChanged([CallerMemberName] string propertyName = "")
|
|
|
|
|
{
|
|
|
|
|
if (PropertyChanged == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|