using System.ComponentModel; using System.Runtime.CompilerServices; using System.Xml.Serialization; using Configuration.Annotations; namespace Configuration { [XmlRoot(Namespace = "urn:winify-configuration-schema", ElementName = "Configuration")] public class Configuration : INotifyPropertyChanged { private bool _launchOnBoot; private bool _ignoreSelfSignedCertificates; private Proxy _proxy = new Proxy(); private int _toastDuration = 5000; private bool _infiniteToastDuration; private int _retrievePastNotificationHours; private byte[] _chime; public bool LaunchOnBoot { get => _launchOnBoot; set { if (value == _launchOnBoot) return; _launchOnBoot = value; OnPropertyChanged(); } } public bool IgnoreSelfSignedCertificates { get => _ignoreSelfSignedCertificates; set { if (value == _ignoreSelfSignedCertificates) return; _ignoreSelfSignedCertificates = value; OnPropertyChanged(); } } public int ToastDuration { get => _toastDuration; set { if (value == _toastDuration) return; _toastDuration = value; OnPropertyChanged(); } } public bool InfiniteToastDuration { get => _infiniteToastDuration; set { if (value == _infiniteToastDuration) return; _infiniteToastDuration = value; OnPropertyChanged(); } } public int RetrievePastNotificationHours { get => _retrievePastNotificationHours; set { if (value == _retrievePastNotificationHours) return; _retrievePastNotificationHours = value; OnPropertyChanged(); } } public Proxy Proxy { get => _proxy; set { if (Equals(value, _proxy)) return; _proxy = value; OnPropertyChanged(); } } public byte[] Chime { get => _chime; set { if (Equals(value, _proxy)) return; _chime = value; OnPropertyChanged(); } } [UsedImplicitly] public Configuration() { } public event PropertyChangedEventHandler PropertyChanged; [NotifyPropertyChangedInvocator] protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } }