mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-06 07:58:28 -04:00
3f9a077dbd
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1153 f9c3cf11-9bcb-44bc-f272-b75c42450872
31 lines
935 B
C#
31 lines
935 B
C#
using System.ComponentModel;
|
|
|
|
namespace ArducopterConfigurator
|
|
{
|
|
public abstract class NotifyProperyChangedBase : INotifyPropertyChanged
|
|
{
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
protected bool CheckPropertyChanged<T>(string propertyName, ref T oldValue, ref T newValue)
|
|
{
|
|
if (oldValue == null && newValue == null)
|
|
return false;
|
|
|
|
if ((oldValue == null && newValue != null) || !oldValue.Equals((T)newValue))
|
|
{
|
|
oldValue = newValue;
|
|
FirePropertyChanged(propertyName);
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
protected void FirePropertyChanged(string propertyName)
|
|
{
|
|
if (PropertyChanged != null)
|
|
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
|
|
}
|
|
} |