protected override void OnClosing(CancelEventArgs e) { AppConfiguration.Instance.ClientX = this.Left; AppConfiguration.Instance.ClientY = this.Top; //save window position base.OnClosing(e); //stop timer _updateTimer.Stop(); Stop(); if (_audioPreview != null) { _audioPreview.StopEncoding(); _audioPreview = null; } _radioOverlayWindow?.Close(); _radioOverlayWindow = null; _dcsAutoConnectListener.Stop(); _dcsAutoConnectListener = null; }
protected override void OnClosing(CancelEventArgs e) { _settings.SetPositionSetting(SettingsKeys.ClientX, Left); _settings.SetPositionSetting(SettingsKeys.ClientY, Top); //save window position base.OnClosing(e); //stop timer _updateTimer.Stop(); Stop(); if (_audioPreview != null) { _audioPreview.StopEncoding(); _audioPreview = null; } _radioOverlayWindow?.Close(); _radioOverlayWindow = null; _awacsRadioOverlay?.Close(); _awacsRadioOverlay = null; _dcsAutoConnectListener.Stop(); _dcsAutoConnectListener = null; }
protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); Stop(); if (_audioPreview != null) { _audioPreview.StopEncoding(); _audioPreview = null; } _radioOverlayWindow?.Close(); _radioOverlayWindow = null; _dcsAutoConnectListener.Stop(); _dcsAutoConnectListener = null; }
public MainWindow() { InitializeComponent(); SetupLogging(); this.Title = this.Title + " - " + UpdaterChecker.VERSION; Logger.Info("Started DCS-SimpleRadio Client " + UpdaterChecker.VERSION); InputManager = new InputDeviceManager(this, ToggleOverlay); Radio1.InputName = "Radio 1"; Radio1.ControlInputBinding = InputBinding.Switch1; Radio1.InputDeviceManager = InputManager; Radio2.InputName = "Radio 2"; Radio2.ControlInputBinding = InputBinding.Switch2; Radio2.InputDeviceManager = InputManager; Radio3.InputName = "Radio 3"; Radio3.ControlInputBinding = InputBinding.Switch3; Radio3.InputDeviceManager = InputManager; PTT.InputName = "Common PTT"; PTT.ControlInputBinding = InputBinding.Ptt; PTT.InputDeviceManager = InputManager; Intercom.InputName = "Intercom Select"; Intercom.ControlInputBinding = InputBinding.Intercom; Intercom.InputDeviceManager = InputManager; RadioOverlay.InputName = "Overlay Toggle"; RadioOverlay.ControlInputBinding = InputBinding.OverlayToggle; RadioOverlay.InputDeviceManager = InputManager; _appConfig = AppConfiguration.Instance; _guid = ShortGuid.NewGuid().ToString(); InitAudioInput(); InitAudioOutput(); ServerIp.Text = _appConfig.LastServer; MicrophoneBoost.Value = _appConfig.MicBoost; SpeakerBoost.Value = _appConfig.SpeakerBoost; // this.boostAmount.Content = "Boost: " + this.microphoneBoost.Value; _audioManager = new AudioManager(_clients); _audioManager.MicBoost = (float)MicrophoneBoost.Value; _audioManager.SpeakerBoost = (float)SpeakerBoost.Value; if (BoostLabel != null && MicrophoneBoost != null) { BoostLabel.Content = (int)(MicrophoneBoost.Value * 100) - 100 + "%"; } if (SpeakerBoostLabel != null && SpeakerBoost != null) { SpeakerBoostLabel.Content = (int)(SpeakerBoost.Value * 100) - 100 + "%"; } UpdaterChecker.CheckForUpdate(); InitRadioEffectsToggle(); InitRadioSwitchIsPTT(); InitRadioClickEffectsToggle(); InitRadioClickEffectsTXToggle(); InitRadioEncryptionEffectsToggle(); InitResample(); _dcsAutoConnectListener = new DCSAutoConnectListener(AutoConnect); }
public MainWindow() { InitializeComponent(); DataContext = this; var client = ClientStateSingleton.Instance; this.WindowStartupLocation = WindowStartupLocation.Manual; this.Left = AppConfiguration.Instance.ClientX; this.Top = AppConfiguration.Instance.ClientY; GCSettings.LatencyMode = GCLatencyMode.SustainedLowLatency; SetupLogging(); Title = Title + " - " + UpdaterChecker.VERSION; Logger.Info("Started DCS-SimpleRadio Client " + UpdaterChecker.VERSION); InitExpandControls(); InitInput(); _appConfig = AppConfiguration.Instance; _guid = ShortGuid.NewGuid().ToString(); InitAudioInput(); InitAudioOutput(); InitMicAudioOutput(); _connectCommand = new DelegateCommand(Connect, () => ServerAddress != null); FavouriteServersViewModel = new FavouriteServersViewModel(new CsvFavouriteServerStore()); InitDefaultAddress(); MicrophoneBoost.Value = _appConfig.MicBoost; SpeakerBoost.Value = _appConfig.SpeakerBoost; _audioManager = new AudioManager(_clients); _audioManager.MicBoost = (float)MicrophoneBoost.Value; _audioManager.SpeakerBoost = (float)SpeakerBoost.Value; if ((BoostLabel != null) && (MicrophoneBoost != null)) { BoostLabel.Content = (int)(MicrophoneBoost.Value * 100) - 100 + "%"; } if ((SpeakerBoostLabel != null) && (SpeakerBoost != null)) { SpeakerBoostLabel.Content = (int)(SpeakerBoost.Value * 100) - 100 + "%"; } UpdaterChecker.CheckForUpdate(); InitRadioSwitchIsPTT(); InitRadioRxEffectsToggle(); InitRadioTxEffectsToggle(); InitRadioEncryptionEffectsToggle(); InitRadioSoundEffects(); InitAutoConnectPrompt(); InitRadioOverlayTaskbarHide(); InitRefocusDCS(); InitAutoSelectPresetChannel(); InitFlowDocument(); _dcsAutoConnectListener = new DCSAutoConnectListener(AutoConnect); _updateTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(100) }; _updateTimer.Tick += UpdateClientCount_VUMeters; _updateTimer.Start(); }
public MainWindow() { GCSettings.LatencyMode = GCLatencyMode.SustainedLowLatency; InitializeComponent(); DataContext = this; var client = ClientStateSingleton.Instance; WindowStartupLocation = WindowStartupLocation.Manual; Left = _settings.GetPositionSetting(SettingsKeys.ClientX).FloatValue; Top = _settings.GetPositionSetting(SettingsKeys.ClientY).FloatValue; Title = Title + " - " + UpdaterChecker.VERSION; if (_settings.GetClientSetting(SettingsKeys.StartMinimised).BoolValue) { Hide(); WindowState = WindowState.Minimized; Logger.Info("Started DCS-SimpleRadio Client " + UpdaterChecker.VERSION + " minimized"); } else { Logger.Info("Started DCS-SimpleRadio Client " + UpdaterChecker.VERSION); } _guid = _settings.GetClientSetting(SettingsKeys.CliendIdShort).StringValue; Analytics.Log("Client", "Startup", _settings.GetClientSetting(SettingsKeys.ClientIdLong).RawValue); InitSettingsScreen(); InitInput(); InitAudioInput(); InitAudioOutput(); InitMicAudioOutput(); _connectCommand = new DelegateCommand(Connect, () => ServerAddress != null); FavouriteServersViewModel = new FavouriteServersViewModel(new CsvFavouriteServerStore()); InitDefaultAddress(); SpeakerBoost.Value = _settings.GetClientSetting(SettingsKeys.SpeakerBoost).DoubleValue; Speaker_VU.Value = -100; Mic_VU.Value = -100; _audioManager = new AudioManager(_clients); _audioManager.SpeakerBoost = VolumeConversionHelper.ConvertVolumeSliderToScale((float)SpeakerBoost.Value); if ((SpeakerBoostLabel != null) && (SpeakerBoost != null)) { SpeakerBoostLabel.Content = VolumeConversionHelper.ConvertLinearDiffToDB(_audioManager.SpeakerBoost); } UpdaterChecker.CheckForUpdate(); InitFlowDocument(); _dcsAutoConnectListener = new DCSAutoConnectListener(AutoConnect); _updateTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(100) }; _updateTimer.Tick += UpdateClientCount_VUMeters; _updateTimer.Start(); }