26 lines
737 B
C#
26 lines
737 B
C#
using System;
|
|
using System.ComponentModel;
|
|
// ReSharper disable CheckNamespace
|
|
|
|
namespace DTS.Common.Base
|
|
{
|
|
public abstract class BasePropertyChanged : IBasePropertyChanged
|
|
{
|
|
public virtual event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
public bool SetProperty<T>(ref T storage, T value, String propertyName = null)
|
|
{
|
|
if (Equals(storage, value)) return false;
|
|
|
|
storage = value;
|
|
OnPropertyChanged(propertyName);
|
|
return true;
|
|
}
|
|
|
|
public virtual void OnPropertyChanged(string propertyName = null)
|
|
{
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
}
|
|
}
|