private void CurrentClient_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == nameof(DnsClient.DnsType)) { if (sender is DnsClient client) { client.Port = client.DnsType switch { DnsType.Default when client.Port == DnsClient.DefaultTlsPort => DnsClient.DefaultPort, DnsType.DnsOverTls when client.Port == DnsClient.DefaultPort => DnsClient.DefaultTlsPort, _ => client.Port }; client.DnsServer = client.DnsType switch { DnsType.Default when client.DnsServer == DnsClient.DefaultTlsDnsServer => DnsClient.DefaultDnsServer, DnsType.DnsOverTls when client.DnsServer == DnsClient.DefaultDnsServer => DnsClient.DefaultTlsDnsServer, _ => client.DnsServer }; } } DnsClientsChanged?.Invoke(sender, new EventArgs()); }
private void Clients_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { DnsClientsChanged?.Invoke(sender, new EventArgs()); }