laatzen/Common/Ui/Common.UI/Infrastructure/ViewModel.cs
2024-12-17 10:38:42 +01:00

32 lines
780 B
C#

namespace Common.UI.Infrastructure
{
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
public class ViewModel : INotifyPropertyChanged
{
private static event Action Dispose;
public ViewModel() => Dispose += ViewModel_Dispose;
public event PropertyChangedEventHandler PropertyChanged;
protected void NotifyPropertyChanged([CallerMemberName] string property = null)
=> this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
protected virtual void ViewModel_Dispose()
{
}
internal virtual void ViewModel_Loaded(object data)
{
}
internal static void ApplicationExit() => Dispose?.Invoke();
}
}