private void OnSpeakerCheckBoxChecked(ExCommandParameter e) { string currentDeviceID = e.Parameter as string; DeviceSpeakerList.FirstOrDefault(x => x.DevId == currentDeviceID).DevType = MediaDeviceType.Speaker; try { _nemo.ChooseSpeakerDev(currentDeviceID); } catch { SetPopMessage("设备异常,请刷新重试!"); } }
private void OnSpeakerCheckBoxClick(ExCommandParameter e) { string currentDeviceID = e.Parameter as string; CheckBox sender = e.Sender as CheckBox; //扬声器只能开一个,也可以全关,只用UAS-1000时,默认全关 if (DeviceSpeakerList.Where(x => x.IsChecked == true).Count() < 1) { //SetPopMessage("扬声器必须且只能保持一个为开启状态!"); //DeviceSpeakerList.FirstOrDefault(x => x.DevId == currentDeviceID).IsChecked = true; //return; } else { SettingsDeviceListItemInfo device = DeviceSpeakerList.FirstOrDefault(x => x.DevId != currentDeviceID && x.IsChecked); if (device != null) { device.IsChecked = false; } } }
/// <summary> /// 初始化扬声器设备列表 /// </summary> /// <param name="devInfos"></param> private void InitSpeakerDeviceList(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.Speaker, true); } else { info.NemoDevInfoConverter(devInfo, MediaDeviceType.Speaker, false); } SettingsDeviceListItemInfo itemDev = new SettingsDeviceListItemInfo(info); DeviceSpeakerList.Add(itemDev); DeviceSpeakerList = new ObservableCollection <SettingsDeviceListItemInfo>(DeviceSpeakerList.OrderBy(x => x.DevName).ToList()); } }
private void OnSpeakerCheckBoxUnChecked(ExCommandParameter e) { string currentDeviceID = e.Parameter as string; DeviceSpeakerList.FirstOrDefault(x => x.DevId == currentDeviceID).DevType = MediaDeviceType.None; }