private void OnSelectionChanged(object sender, SelectionChangedEventArgs e) { if (sender is ComboBox c && c.SelectedItem is Device d) { Properties.Settings.Default.AudioPlayerDevice = d.DeviceId; Properties.Settings.Default.Save(); if (output == null) { output = new OutputSource(d); } else { output.SwapDevice(d); } } }