1
0
mirror of https://github.com/DarthAffe/RGBSyncPlus synced 2025-12-12 17:08:31 +00:00
RGBSyncPlus/RGBSync+/Configuration/AbstractConfiguration.cs

32 lines
918 B
C#

using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using RGB.NET.Core;
namespace RGBSyncPlus.Configuration
{
public class AbstractConfiguration : AbstractBindable, IConfiguration, INotifyPropertyChanged
{
#region Methods
protected override bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
{
if ((typeof(T) == typeof(double)) || (typeof(T) == typeof(float)))
{
if (Math.Abs((double)(object)storage - (double)(object)value) < 0.000001) return false;
}
else
{
if (Equals(storage, value)) return false;
}
storage = value;
// ReSharper disable once ExplicitCallerInfoArgument
OnPropertyChanged(propertyName);
return true;
}
#endregion
}
}