private async Task SetupDeviceListAsync() { await _meetingConfigView.Dispatcher.BeginInvoke(new Action(() => { ClearDeviceList(); CachedCameras.ForEach((camera) => { MainCameras.Add(camera); SecondaryCameras.Add(camera); }); CachedMicrophones.ForEach((microphone) => { MainMicrophones.Add(microphone); SecondaryMicrophones.Add(microphone); }); CachedSpeakers.ForEach((speaker) => { Speakers.Add(speaker); }); })); }
private async Task CacheDeviceListAsync() { await Task.Run(() => { var cameraList = _sdkService.GetDeviceList(1); CachedCameras.Clear(); foreach (var camera in cameraList) { if (!string.IsNullOrEmpty(camera.m_szDevName)) { CachedCameras.Add(camera.m_szDevName); } } CachedCameras.Add(NonExclusiveItem); var micList = _sdkService.GetDeviceList(3); CachedMicrophones.Clear(); foreach (var mic in micList) { if (!string.IsNullOrEmpty(mic.m_szDevName)) { CachedMicrophones.Add(mic.m_szDevName); } } CachedMicrophones.Add(NonExclusiveItem); var speakerList = _sdkService.GetDeviceList(4); CachedSpeakers.Clear(); foreach (var speaer in speakerList) { if (!string.IsNullOrEmpty(speaer.m_szDevName)) { CachedSpeakers.Add(speaer.m_szDevName); } } }); }
private async Task RefreshExclusiveDataSourceAsync(ConfigItemKey configItemKey, string exclusiveItem) { await _meetingConfigView.Dispatcher.BeginInvoke(new Action(() => { switch (configItemKey) { case ConfigItemKey.MainCamera: string tempSecondaryCamera = MeetingConfigResult.SecondaryCamera.Name; SecondaryCameras.Clear(); CachedCameras.ForEach((camera) => { if (camera != exclusiveItem) { SecondaryCameras.Add(camera); } }); if (!SecondaryCameras.Contains(NonExclusiveItem)) { SecondaryCameras.Add(NonExclusiveItem); } MeetingConfigResult.SecondaryCamera.Name = tempSecondaryCamera; break; case ConfigItemKey.SecondaryCamera: string tempMainCamera = MeetingConfigResult.MainCamera.Name; MainCameras.Clear(); CachedCameras.ForEach((camera) => { if (camera != exclusiveItem) { MainCameras.Add(camera); } }); if (!MainCameras.Contains(NonExclusiveItem)) { MainCameras.Add(NonExclusiveItem); } MeetingConfigResult.MainCamera.Name = tempMainCamera; break; case ConfigItemKey.MainMicrophone: string tempSecondaryMic = MeetingConfigResult.AudioConfig.SecondaryMicrophone; SecondaryMicrophones.Clear(); CachedMicrophones.ForEach((mic) => { if (mic != exclusiveItem) { SecondaryMicrophones.Add(mic); } }); if (!SecondaryMicrophones.Contains(NonExclusiveItem)) { SecondaryMicrophones.Add(NonExclusiveItem); } MeetingConfigResult.AudioConfig.SecondaryMicrophone = tempSecondaryMic; break; case ConfigItemKey.SecondaryMicrophone: string tempMainMic = MeetingConfigResult.AudioConfig.MainMicrophone; MainMicrophones.Clear(); CachedMicrophones.ForEach((mic) => { if (mic != exclusiveItem) { MainMicrophones.Add(mic); } }); if (!MainMicrophones.Contains(NonExclusiveItem)) { MainMicrophones.Add(NonExclusiveItem); } MeetingConfigResult.AudioConfig.MainMicrophone = tempMainMic; break; case ConfigItemKey.Unknown: default: break; } })); }