using System.ComponentModel; using System.IO; using System.Runtime.CompilerServices; using System.Xml.Serialization; using Configuration.Properties; namespace Configuration { [XmlRoot(ElementName = "Spring")] public class Spring : INotifyPropertyChanged { #region Public Events & Delegates public event PropertyChangedEventHandler PropertyChanged; #endregion #region Public Enums, Properties and Fields [XmlElement(ElementName = "Loading")] public Charge Charge { get => _charge; set { if (Equals(value, _charge)) { return; } _charge = value; OnPropertyChanged(); } } [XmlElement(ElementName = "Discharge")] public Discharge Discharge { get => _discharge; set { if (Equals(value, _discharge)) { return; } _discharge = value; OnPropertyChanged(); } } [XmlElement(ElementName = "Fuzz")] public int Fuzz { get => _fuzz; set { if (value == _fuzz) { return; } _fuzz = value; OnPropertyChanged(); } } [XmlElement(ElementName = "History")] public ObservableUniqueCollection History { get => _history; set { if (Equals(value, _history)) { return; } _history = value; OnPropertyChanged(); } } [XmlElement(ElementName = "Store")] public string Store { get => _store; set { if (value == _store) { return; } _store = value; OnPropertyChanged(); } } #endregion #region Private Delegates, Events, Enums, Properties, Indexers and Fields private Charge _charge = new Charge(); private Discharge _discharge = new Discharge(); private int _fuzz; private ObservableUniqueCollection _history = new ObservableUniqueCollection(); private string _store = Path.GetTempFileName(); #endregion #region Constructors, Destructors and Finalizers [UsedImplicitly] public Spring() { } #endregion #region Private Methods [NotifyPropertyChangedInvocator] protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } #endregion } }