22 lines
696 B
C#
22 lines
696 B
C#
namespace Common.UI.Infrastructure
|
|
{
|
|
using System;
|
|
using System.ComponentModel;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
internal abstract class BaseViewModel<T> : INotifyPropertyChanged where T : BaseViewModel<T>
|
|
{
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
protected void Set(Action<T> propertySetterCallback, [CallerMemberName] string property = null)
|
|
{
|
|
propertySetterCallback?.Invoke(this as T);
|
|
|
|
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
|
|
}
|
|
|
|
protected void InvokeAsync(Action callback)
|
|
=> App.Current.Dispatcher.InvokeAsync(callback);
|
|
}
|
|
}
|