Пример #1
0
        private void GotoSetting()
        {
            GlobalData.Instance.CurrentHomeMenu = MainMenuNames.Setting;
            var view = new SettingNavView();

            view.Show();
            _mainView.Close();
        }
Пример #2
0
        private void GoBack()
        {
            SaveSetting();
            var nav = new SettingNavView();

            nav.Show();
            _view.Close();
        }
Пример #3
0
 public SettingNavViewModel(SettingNavView view)
 {
     ElementName        = "AudioSetting";
     _navView           = view;
     GotoVideoCommand   = new DelegateCommand(GotoVideo);
     GotoAudioCommand   = new DelegateCommand(GotoAudio);
     GotoLiveCommand    = new DelegateCommand(GotoLive);
     GotoNetWorkCommand = new DelegateCommand(GotoNetWork);
     GotoBasicCommand   = new DelegateCommand(GotoBasic);
     GoBackCommand      = new DelegateCommand(GoBack);
     InitMenus();
 }
Пример #4
0
        public bool IsVideoAudioSettingsValid(Window sourceWindow)
        {
            string errorMsg = string.Empty;

            MeetingResult <IList <VideoDeviceModel> > videoDeviceResult = _meetingSdkAgent.GetVideoDevices();

            MeetingResult <IList <string> > micResult = _meetingSdkAgent.GetMicrophones();

            MeetingResult <IList <string> > speakerResult = _meetingSdkAgent.GetLoudSpeakers();

            ConfigManager configManager = _localDataManager.GetSettingConfigData();

            if (configManager == null)
            {
                errorMsg = "参数配置有误!";
                MessageQueueManager.Instance.AddInfo(errorMsg);

                SettingNavView settingNavView = new SettingNavView();
                settingNavView.Show();

                sourceWindow?.Close();
                return(false);
            }

            IDeviceNameAccessor deviceNameAccessor = DependencyResolver.Current.GetService <IDeviceNameAccessor>();

            IEnumerable <string> cameraDeviceName;

            if (videoDeviceResult.Result.Count == 0 || string.IsNullOrEmpty(configManager.MainVideoInfo?.VideoDevice) || !deviceNameAccessor.TryGetName(DeviceName.Camera, new Func <DeviceName, bool>(d => { return(d.Option == "first"); }), out cameraDeviceName) || !videoDeviceResult.Result.Any(vdm => vdm.DeviceName == cameraDeviceName.FirstOrDefault()))
            {
                errorMsg = "人像采集未设置!";
                MessageQueueManager.Instance.AddInfo(errorMsg);

                VideoSettingView videoSettingView = new VideoSettingView();
                videoSettingView.Show();

                sourceWindow?.Close();
                return(false);
            }

            if (configManager.MainVideoInfo?.DisplayWidth == 0 || configManager.MainVideoInfo?.DisplayHeight == 0 || configManager.MainVideoInfo?.VideoBitRate == 0)
            {
                errorMsg = "人像采集参数未设置!";
                MessageQueueManager.Instance.AddInfo(errorMsg);

                VideoSettingView videoSettingView = new VideoSettingView();
                videoSettingView.Show();

                sourceWindow?.Close();

                return(false);
            }

            IEnumerable <string> micDeviceName;

            if (micResult.Result.Count == 0 || string.IsNullOrEmpty(configManager.AudioInfo?.AudioSammpleDevice) || !deviceNameAccessor.TryGetName(DeviceName.Microphone, new Func <DeviceName, bool>(d => { return(d.Option == "first"); }), out micDeviceName) || !micResult.Result.Any(mic => mic == micDeviceName.FirstOrDefault()))
            {
                errorMsg = "人声音源未设置!";
                MessageQueueManager.Instance.AddInfo(errorMsg);

                AudioSettingView audioSettingView = new AudioSettingView();
                audioSettingView.Show();

                sourceWindow?.Close();

                return(false);
            }

            if (configManager.AudioInfo?.SampleRate == 0 || configManager.AudioInfo?.AAC == 0)
            {
                errorMsg = "人声音源参数未设置!";
                MessageQueueManager.Instance.AddInfo(errorMsg);

                AudioSettingView audioSettingView = new AudioSettingView();
                audioSettingView.Show();

                sourceWindow?.Close();

                return(false);
            }

            string audioOutputDeviceName;

            if (speakerResult.Result.Count == 0 || string.IsNullOrEmpty(configManager.AudioInfo?.AudioOutPutDevice) || !deviceNameAccessor.TryGetSingleName(DeviceName.Speaker, out audioOutputDeviceName) || !speakerResult.Result.Any(speaker => speaker == audioOutputDeviceName))
            {
                errorMsg = "放音设备未设置!";
                MessageQueueManager.Instance.AddInfo(errorMsg);

                AudioSettingView audioSettingView = new AudioSettingView();
                audioSettingView.Show();

                sourceWindow?.Close();

                return(false);
            }


            return(true);
        }