public VideoSettingModel(VideoSettingView view)
        {
            _view             = view;
            _cameraDeviceList = new List <VideoDeviceModel>();
            _docDeviceList    = new List <VideoDeviceModel>();
            _s = new InputSimulator();

            _configManager    = new ConfigManager();
            _meetingSdkAgent  = DependencyResolver.Current.GetService <IMeetingSdkAgent>();
            _localDataManager = DependencyResolver.Current.GetService <ILocalDataManager>();

            _deviceNameAccessor = DependencyResolver.Current.GetService <IDeviceNameAccessor>();
            _deviceConfigLoader = DependencyResolver.Current.GetService <IDeviceConfigLoader>();

            CameraDeviceList = new ObservableCollection <string>();
            DocDeviceList    = new ObservableCollection <string>();

            CameraColorSpaces = new ObservableCollection <VideoFormatModel>();
            DocColorSpaces    = new ObservableCollection <VideoFormatModel>();

            VedioParameterVgaList    = new ObservableCollection <string>();
            DocParameterVgaList      = new ObservableCollection <string>();
            VedioParameterRatesList  = new ObservableCollection <int>();
            LoadCommand              = new DelegateCommand(Loading);
            WindowKeyDownCommand     = new DelegateCommand <object>(WindowKeyDownHandler);
            CheckCameraDeviceCommand = DelegateCommand.FromAsyncHandler(CheckCameraDeviceAsync);
            CheckDocDeviceCommand    = DelegateCommand.FromAsyncHandler(CheckDocDeviceAsync);

            //CheckCameraColorSpaceCommand = new DelegateCommand(CheckCameraColorSpace);
            //CheckDocColorSpaceCommand = new DelegateCommand(CheckDocColorSpace);

            GoBackCommand = new DelegateCommand(GoBack);
        }
        private void GotoVideo()
        {
            GlobalData.Instance.CurrentSettingMenu = MainMenuNames.Video;

            var view = new VideoSettingView();

            view.Show();
            _navView.Close();
        }
Beispiel #3
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);
        }