private void OnMicrophoneCheckBoxChecked(ExCommandParameter e) { string currentDeviceID = e.Parameter as string; DeviceMicrophoneList.FirstOrDefault(x => x.DevId == currentDeviceID).DevType = MediaDeviceType.Microphone; try { _nemo.ChooseMicrophoneDev(currentDeviceID); } catch { SetPopMessage("设备异常,请刷新重试!"); } }
private void OnMicrophoneCheckBoxClick(ExCommandParameter e) { string currentDeviceID = e.Parameter as string; CheckBox sender = e.Sender as CheckBox; if (DeviceMicrophoneList.Where(x => x.IsChecked == true).Count() < 1) { SetPopMessage("麦克风至少保持一个为开启状态!"); DeviceMicrophoneList.FirstOrDefault(x => x.DevId == currentDeviceID).IsChecked = true; return; } else { SettingsDeviceListItemInfo device = DeviceMicrophoneList.FirstOrDefault(x => x.DevId != currentDeviceID && x.IsChecked); if (device != null) { device.IsChecked = false; } } }
/// <summary> /// 初始化麦克风设备列表 /// </summary> /// <param name="devInfos"></param> /// <param name="selectedDevId"></param> private void InitMicrophoneDeviceList(SDKMediaDevInfo[] devInfos, string selectedDevId) { if (0 >= devInfos.Length) { return; } foreach (SDKMediaDevInfo devInfo in devInfos) { SettingsDeviceInfo info = new SettingsDeviceInfo(); if (0 == string.CompareOrdinal(selectedDevId, devInfo.devId)) { info.NemoDevInfoConverter(devInfo, MediaDeviceType.Microphone, true); } else { info.NemoDevInfoConverter(devInfo, MediaDeviceType.Microphone, false); } SettingsDeviceListItemInfo itemDev = new SettingsDeviceListItemInfo(info); DeviceMicrophoneList.Add(itemDev); } DeviceMicrophoneList = new ObservableCollection <SettingsDeviceListItemInfo>(DeviceMicrophoneList.OrderBy(x => x.DevName).ToList()); }
private void OnMicrophoneUnCheckBoxChecked(ExCommandParameter e) { string currentDeviceID = e.Parameter as string; DeviceMicrophoneList.FirstOrDefault(x => x.DevId == currentDeviceID).DevType = MediaDeviceType.None; }