添加项目文件。
This commit is contained in:
28
WPFMonitorRevitAPI-master/DoWork/ViewModelBase.cs
Normal file
28
WPFMonitorRevitAPI-master/DoWork/ViewModelBase.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
namespace Utils.Basis
|
||||
{
|
||||
using System.ComponentModel;
|
||||
|
||||
public abstract class ViewModelBase : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected bool Set<T>(ref T field, T newValue = default(T), [System.Runtime.CompilerServices.CallerMemberName] string propertyName = null)
|
||||
{
|
||||
if (System.Collections.Generic.EqualityComparer<T>.Default.Equals(field, newValue))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
field = newValue;
|
||||
|
||||
OnPropertyChanged(propertyName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void OnPropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user