using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using Configuration.Annotations; namespace Configuration { public class Proxy : INotifyPropertyChanged { private string _url = string.Empty; private string _username = string.Empty; private string _password = string.Empty; private bool _enabled = false; public bool Enabled { get => _enabled; set { if (value == _enabled) return; _enabled = value; OnPropertyChanged(); } } public string Url { get => _url; set { if (value == _url) return; _url = value; OnPropertyChanged(); } } public string Username { get => _username; set { if (value == _username) return; _username = value; OnPropertyChanged(); } } public string Password { get => _password; set { if (value == _password) return; _password = value; OnPropertyChanged(); } } [UsedImplicitly] public Proxy() { } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } protected bool SetField(ref T field, T value, [CallerMemberName] string propertyName = null) { if (EqualityComparer.Default.Equals(field, value)) return false; field = value; OnPropertyChanged(propertyName); return true; } } }