Spring – Rev 1
?pathlinks?
using System.ComponentModel;
using System.Drawing;
using System.Runtime.CompilerServices;
using System.Xml.Serialization;
using Configuration.Properties;
namespace Configuration
{
[XmlRoot(ElementName = "HUD")]
public class HUD : INotifyPropertyChanged
{
#region Public Events & Delegates
public event PropertyChangedEventHandler PropertyChanged;
#endregion
#region Public Enums, Properties and Fields
[XmlIgnore]
public Color Color
{
get => _color;
set
{
if (value == _color)
{
return;
}
_color = value;
OnPropertyChanged();
}
}
[XmlElement(ElementName = "Color")]
public int ColorArgb
{
get => _color.ToArgb();
set
{
if (value == _color.ToArgb())
{
return;
}
_color = Color.FromArgb(value);
OnPropertyChanged();
}
}
[XmlElement(ElementName = "Enable")]
public bool Enable
{
get => _enable;
set
{
if (value == _enable)
{
return;
}
_enable = value;
OnPropertyChanged();
}
}
public bool EnableWhiteList
{
get => _enableWhiteList;
set
{
if (value == _enableWhiteList)
{
return;
}
_enableWhiteList = value;
OnPropertyChanged();
}
}
[XmlElement(ElementName = "Whitelist")]
public WhiteList WhiteList
{
get => _whiteList;
set
{
if (Equals(value, _whiteList))
{
return;
}
_whiteList = value;
OnPropertyChanged();
}
}
[XmlElement(ElementName = "Position")]
public Position Position
{
get => _position;
set
{
if (Equals(value, _position))
{
return;
}
_position = value;
OnPropertyChanged();
}
}
#endregion
#region Private Delegates, Events, Enums, Properties, Indexers and Fields
[UsedImplicitly] private Color _color = Color.FromArgb(255, 255, 255, 255);
private bool _enable = true;
private bool _enableWhiteList;
private Position _position = new Position();
private WhiteList _whiteList = new WhiteList();
#endregion
#region Constructors, Destructors and Finalizers
[UsedImplicitly]
public HUD()
{
}
#endregion
#region Private Methods
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
}
}