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(); }
private async void OnSaveCommandExecute() { var 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(); } SignalingSettings.AppInsightsEnabled = AppInsightsEnabled; if (NtpServerIp != null) { _localSettings.Values[nameof(NtpServerIp)] = NtpServerIp; } if (SelectedCamera != null) { await _mediaSettings.SetVideoDeviceAsync(SelectedCamera); } if (SelectedMicrophone != null) { await _mediaSettings.SetAudioDeviceAsync(SelectedMicrophone.Id == DefaultAudioDeviceId ?null : SelectedMicrophone); } if (SelectedAudioPlayoutDevice != null) { await _mediaSettings.SetAudioPlayoutDeviceAsync(SelectedAudioPlayoutDevice.Id == DefaultAudioDeviceId ?null : SelectedAudioPlayoutDevice); } if (SelectedVideoCodec != null) { await _mediaSettings.SetVideoCodecAsync(SelectedVideoCodec); _localSettings.Values[nameof(SelectedVideoCodec)] = SelectedVideoCodec.Id; } if (SelectedAudioCodec != null) { await _mediaSettings.SetAudioCodecAsync(SelectedAudioCodec); _localSettings.Values[nameof(SelectedAudioCodec)] = SelectedAudioCodec.Id; } if (SelectedCapFpsItem != null) { await _mediaSettings.SetPreferredVideoCaptureFormatAsync(new VideoCaptureFormat((int)SelectedCapFpsItem.Width, (int)SelectedCapFpsItem.Height, (int)SelectedCapFpsItem.FrameRate)); _localSettings.Values[nameof(SelectedCapResItem)] = SelectedCapResItem; _localSettings.Values[SelectedFrameRateId] = SelectedCapFpsItem?.FrameRate; } var newList = (from iceServerVm in IceServers where iceServerVm.Apply() select iceServerVm.IceServer).ToList(); IceServerSettings.IceServers = newList; _localSettings.Values[nameof(StatsServerPort)] = StatsServerPort; _localSettings.Values[nameof(StatsServerHost)] = StatsServerHost; await _mediaSettings.SetStatsConfigAsync(new StatsConfig { SendStatsToServerEnabled = _statsSendToServerEnabled, StatsServerHost = StatsServerHost, StatsServerPort = StatsServerPort }); OnCloseCommandExecute(); }