mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-23 13:15:53 +12:00
Finish MPN00Bs
This commit is contained in:
parent
b439ad1511
commit
b83960d872
22 changed files with 720 additions and 155 deletions
26
HorseIsleServer/MPN00BS/MiniMvvm/ViewModelBase.cs
Normal file
26
HorseIsleServer/MPN00BS/MiniMvvm/ViewModelBase.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Reactive.Joins;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace MiniMvvm
|
||||
{
|
||||
public class ViewModelBase : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected bool RaiseAndSetIfChanged<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
|
||||
{
|
||||
if (!EqualityComparer<T>.Default.Equals(field, value))
|
||||
{
|
||||
field = value;
|
||||
RaisePropertyChanged(propertyName);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
protected void RaisePropertyChanged([CallerMemberName] string propertyName = null)
|
||||
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue