using JetBrains.Annotations; using System.Collections.ObjectModel; using System.ComponentModel; using System.Runtime.CompilerServices; using System.Windows.Forms; using System.Xml.Serialization; namespace Configuration { [XmlRoot(Namespace = "urn:typetheboard-configuration-schema", ElementName = "Configuration")] public class Configuration : INotifyPropertyChanged { private bool _pasteKeysEnabled = true; private bool _pasteMouseEnabled = false; private MouseButtons _pasteMouseButtons = MouseButtons.None; private Keys _pasteKeys = Keys.T; private Keys _pasteModifierKeys = Keys.Control | Keys.Shift; private bool _launchOnBoot; private int _pasteKeystrokeDelay = 25; private Keys _cancelKeys = Keys.Escape; private Keys _cancelModifierKeys = Keys.None; public bool LaunchOnBoot { get => _launchOnBoot; set { if (value == _launchOnBoot) { return; } _launchOnBoot = value; OnPropertyChanged(); } } public bool PasteMouseEnabled { get => _pasteMouseEnabled; set { if (value == _pasteMouseEnabled) { return; } _pasteMouseEnabled = value; OnPropertyChanged(); } } public bool PasteKeysEnabled { get => _pasteKeysEnabled; set { if (value == _pasteKeysEnabled) { return; } _pasteKeysEnabled = value; OnPropertyChanged(); } } public int PasteKeystrokeDelay { get => _pasteKeystrokeDelay; set { if (value == _pasteKeystrokeDelay) { return; } _pasteKeystrokeDelay = value; OnPropertyChanged(); } } public MouseButtons PasteMouseButtons { get => _pasteMouseButtons; set { if (value == _pasteMouseButtons) { return; } _pasteMouseButtons = value; OnPropertyChanged(); } } public Keys CancelKeys { get => _cancelKeys; set { if (value == _cancelKeys) { return; } _cancelKeys = value; OnPropertyChanged(); } } public Keys PasteKeys { get => _pasteKeys; set { if (value == _pasteKeys) { return; } _pasteKeys = value; OnPropertyChanged(); } } public Keys PasteModifierKeys { get => _pasteModifierKeys; set { if (value == _pasteModifierKeys) { return; } _pasteModifierKeys = value; OnPropertyChanged(); } } public Keys CancelModifierKeys { get => _cancelModifierKeys; set { if (value == _cancelModifierKeys) { return; } _cancelModifierKeys = value; OnPropertyChanged(); } } public event PropertyChangedEventHandler PropertyChanged; [NotifyPropertyChangedInvocator] protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } }