private void SelectDevice(string name) { AutomationElement device = AudioDevice(name); if ((device == null)) { DefaultAudioDeviceSetter.ThrowOnAudioDeviceNameNotFound(name, AudioDeviceListText()); } device.SelectElement(); }
private void SetDefaultAudioDevice(string name, AutomationElement tabControl) { if ((myWindow == null)) { throw new InvalidOperationException("The Sound control panel window is not open."); } else if ((string.IsNullOrEmpty(name))) { throw new ArgumentNullException("name"); } DefaultAudioDeviceSetter command = new DefaultAudioDeviceSetter(tabControl); command.Execute(name); }