private void OnSaveMicrophoneConfig(string obj) { try { int count = MicrophoneList.TakeWhile(x => !string.IsNullOrEmpty(x.Name) && !string.IsNullOrEmpty(x.Title)).Count(); int count1 = MicrophoneList.Where(x => !string.IsNullOrEmpty(x.Name) && !string.IsNullOrEmpty(x.Title)).Count(); if (count != count1) { SetPopMessage("保存失败!请按顺序设置麦克风", new SolidColorBrush(Color.FromRgb(225, 0, 0))); return; } _asrManager = AsrServerManager.GetInstance(_nemo, _dataService, _eventAggregator); _asrManager.Stop(); devManager.SetMode(true); devManager.ClearDev(); foreach (var deviceMic in DeviceMicrophoneList) { if (deviceMic.DevName.StartsWith("UAS-1000")) { _asrManager.SetDefaultConfigWithoutStart(deviceMic.DevName); } } foreach (var device in MicrophoneList) { if (!(string.IsNullOrEmpty(device.Name) || string.IsNullOrEmpty(device.Title))) { devManager.AddDevInfo(device.Title, device.Name, device.MicPort); } } ConfigFile.collegiateBenchSwich = 1; _asrManager.IsOpen = true; _asrManager.SetDefaultConfigStart(); SetPopMessage("保存成功", new SolidColorBrush(Color.FromRgb(0, 255, 0))); } catch (Exception ex) { Log.WriteLog(ex.Message); } }
private void OnLoaded(string obj) { ParticipantList.Add(new ClientModel { Id = FIRST_PARTICIPANT, TitleName = "(空)", IsSelected = false }); foreach (Participant person in AppContext.Default.MeetingDetail.Participants) { if ((person.TitleGroup == 0 || person.TitleGroup == 1 || person.TitleGroup == 2) && !(UtilsMethods.Decrypt(person.Name) == "原告席") && !(UtilsMethods.Decrypt(person.Name) == "被告席")) { ParticipantList.Add(new ClientModel { Id = person.Id, TitleName = person.Title + "-" + UtilsMethods.Decrypt(person.Name), TitleGroup = person.TitleGroup, Title = person.Title, Name = UtilsMethods.Decrypt(person.Name), }); } } clientModelsList = ParticipantList.ToList(); ClientModel clientModel = clientModelsList[0]; MicrophoneList = new ObservableCollection <MicrophoneModel> { new MicrophoneModel { MicrophoneId = "(1)", MicPort = ConfigFile.micPort1of9, SelectedClient = clientModel }, new MicrophoneModel { MicrophoneId = "(2)", MicPort = ConfigFile.micPort2of9, SelectedClient = clientModel }, new MicrophoneModel { MicrophoneId = "(3)", MicPort = ConfigFile.micPort3of9, SelectedClient = clientModel }, new MicrophoneModel { MicrophoneId = "(4)", MicPort = ConfigFile.micPort4of9, SelectedClient = clientModel }, new MicrophoneModel { MicrophoneId = "(5)", MicPort = ConfigFile.micPort5of9, SelectedClient = clientModel }, new MicrophoneModel { MicrophoneId = "(6)", MicPort = ConfigFile.micPort6of9, SelectedClient = clientModel }, new MicrophoneModel { MicrophoneId = "(7)", MicPort = ConfigFile.micPort7of9, SelectedClient = clientModel }, new MicrophoneModel { MicrophoneId = "(8)", MicPort = ConfigFile.micPort8of9, SelectedClient = clientModel }, new MicrophoneModel { MicrophoneId = "(9)", MicPort = ConfigFile.micPort9of9, SelectedClient = clientModel }, }; _asrManager = AsrServerManager.GetInstance(_nemo, _dataService, _eventAggregator); List <string> res = _asrManager.GetAsrMicrophoneConfig(); if (res != null && res.Count > 0) { for (int i = 0; i < res.Count; i++) { MicrophoneList[i].TitleName = res[i]; string title = string.Empty, name = string.Empty; ConvertString2TitleName(res[i], ref title, ref name); MicrophoneList[i].Title = title; MicrophoneList[i].Name = name; ClientModel clientSelected = clientModelsList.FirstOrDefault(x => x.Id != FIRST_PARTICIPANT && x.Title.Equals(title) && x.Name.Equals(name)); if (clientSelected != null) { clientSelected.IsSelected = true; MicrophoneList[i].SelectedClient = clientSelected; } } ParticipantList = new ObservableCollection <ClientModel>(clientModelsList); } InitDeviceList(); }