30 lines
826 B
C#
30 lines
826 B
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Runtime.CompilerServices;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
|
|||
|
|
namespace MonitoringTechnology.Base
|
|||
|
|
{
|
|||
|
|
public class NotifyPropertyBase : INotifyPropertyChanged
|
|||
|
|
{
|
|||
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|||
|
|
|
|||
|
|
public void RaisePropertyChanged([CallerMemberName] string propName = "")
|
|||
|
|
{
|
|||
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void Set<T>(ref T field, T value, [CallerMemberName] string propName = "")
|
|||
|
|
{
|
|||
|
|
if (EqualityComparer<T>.Default.Equals(field, value))
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
field = value;
|
|||
|
|
RaisePropertyChanged(propName);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|