コード例 #1
0
        private void OnSaveCommandExecute()
        {
            bool registrationSettingChanged = false;

            if (SignalingSettings.SignalingServerPort != SignalingServerPort.ToString())
            {
                SignalingSettings.SignalingServerPort = SignalingServerPort.ToString();
                registrationSettingChanged            = true;
            }

            if (SignalingSettings.SignalingServerHost != SignalingServerHost)
            {
                SignalingSettings.SignalingServerHost = SignalingServerHost;
                registrationSettingChanged            = true;
            }
            if (RegistrationSettings.Domain != Domain)
            {
                RegistrationSettings.Domain = Domain;
                registrationSettingChanged  = true;
            }

            if (registrationSettingChanged)
            {
                OnRegistrationSettingsChanged?.Invoke();
            }

#if WIN10
            SignalingSettings.AppInsightsEnabled = AppInsightsEnabled;
#endif

            if (NtpServerIP != null)
            {
                _localSettings.Values[nameof(NtpServerIP)] = NtpServerIP;
            }

            if (RTCTraceServerIp != null)
            {
                _localSettings.Values[nameof(RTCTraceServerIp)] = RTCTraceServerIp;
            }

            if (RTCTraceServerPort != null)
            {
                _localSettings.Values[nameof(RTCTraceServerPort)] = RTCTraceServerPort;
            }

            if (SelectedCamera != null)
            {
                _mediaSettings.SetVideoDevice(SelectedCamera);
                _localSettings.Values[nameof(SelectedCamera)] = SelectedCamera.Id;
            }

            if (SelectedMicrophone != null)
            {
                _mediaSettings.SetAudioDevice(SelectedMicrophone);
                _localSettings.Values[nameof(SelectedMicrophone)] = SelectedMicrophone.Id;
            }

            if (SelectedVideoCodec != null)
            {
                _mediaSettings.SetVideoCodec(SelectedVideoCodec);
                _localSettings.Values[nameof(SelectedVideoCodec)] = SelectedVideoCodec.Id;
            }

            if (SelectedAudioCodec != null)
            {
                _mediaSettings.SetAudioCodec(SelectedAudioCodec);
                _localSettings.Values[nameof(SelectedAudioCodec)] = SelectedAudioCodec.Id;
            }

            if (SelectedCapFPSItem != null)
            {
                _mediaSettings.SetPreferredVideoCaptureFormat(new VideoCaptureFormat((int)SelectedCapFPSItem.Width,
                                                                                     (int)SelectedCapFPSItem.Height,
                                                                                     (int)SelectedCapFPSItem.FrameRate));
                _localSettings.Values[nameof(SelectedCapResItem)] = SelectedCapResItem;
                _localSettings.Values[SelectedFrameRateId]        = (SelectedCapFPSItem != null) ? SelectedCapFPSItem.FrameRate : 0;
            }

            if (SelectedAudioPlayoutDevice != null)
            {
                _localSettings.Values[nameof(SelectedAudioPlayoutDevice)] = SelectedAudioPlayoutDevice.Id;
                _mediaSettings.SetAudioPlayoutDevice(SelectedAudioPlayoutDevice);
            }

            var newList = new List <IceServer>();
            foreach (var iceServerVm in IceServers)
            {
                if (iceServerVm.Apply())
                {
                    newList.Add(iceServerVm.IceServer);
                }
            }
            IceServerSettings.IceServers = newList;

            OnCloseCommandExecute();
        }