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();
        }