public MainWindow()
        {
            InitializeComponent();

            Globals.LogBox = LogBox;

            _lastFocusedTextBox = PlayingTopLineFormatTextBox;

            _notifyIcon = new NotifyIcon {
                Text = "iTunesRichPresence", Visible = false, Icon = System.Drawing.Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location)
            };
            _notifyIcon.MouseDoubleClick += (sender, args) => {
                SetVisibility(true);
            };

            // Thanks Markyparky#5435 from Discord!
            ThemeComboBox.ItemsSource  = Settings.Default.AccentsKr;
            ThemeComboBox.SelectedItem = Settings.Default.AccentsKr[Settings.Default.AccentsEn.IndexOf(Settings.Default.Accent)];

            ThemeManager.ChangeAppStyle(Application.Current,
                                        ThemeManager.GetAccent(Settings.Default.Accent),
                                        ThemeManager.GetAppTheme("BaseLight"));

            RunOnStartupCheckBox.IsChecked      = Settings.Default.RunOnStartup;
            PlayingTopLineFormatTextBox.Text    = Settings.Default.PlayingTopLine;
            PlayingBottomLineFormatTextBox.Text = Settings.Default.PlayingBottomLine;
            PausedTopLineFormatTextBox.Text     = Settings.Default.PausedTopLine;
            PausedBottomLineFormatTextBox.Text  = Settings.Default.PausedBottomLine;
            PlaybackDurationCheckBox.IsChecked  = Settings.Default.DisplayPlaybackDuration;
            ClearOnPauseCheckBox.IsChecked      = Settings.Default.ClearOnPause;
            ExperimentsCheckBox.IsChecked       = Settings.Default.ExperimentsEnabled;
            MinimizeOnStartupCheckBox.IsChecked = Settings.Default.MinimizeOnStartup;
            ExperimentsButton.Visibility        =
                Settings.Default.ExperimentsEnabled ? Visibility.Visible : Visibility.Collapsed;

            AppNameComboBox.Items.Add("iTunes");
            AppNameComboBox.Items.Add("Apple Music");
            try
            {
                CreateBridge();
            }
            catch (COMException)
            {
                _bridge = null;
            }



            AppNameComboBox.SelectedItem = Settings.Default.AppName;

            try
            {
                var gitHubClient = new GitHubClient(new ProductHeaderValue("iTunesRichPresence"));
                _latestRelease = gitHubClient.Repository.Release.GetLatest("nint8835", "iTunesRichPresence").Result;
                if (!Assembly.GetExecutingAssembly().GetName().Version.ToString().StartsWith(_latestRelease.Name.Substring(1)))
                {
                    UpdateButton.Visibility = Visibility.Visible;
                }
            }
            catch
            {
                // Occurs when it fails to check for updates, so we can safely ignore it
            }


#if DEBUG
            PatreonEmailLabel.Visibility   = Visibility.Visible;
            PatreonEmailTextBox.Visibility = Visibility.Visible;
            PatreonStatusLabel.Visibility  = Visibility.Visible;
            AlbumArtCheckBox.Visibility    = Visibility.Visible;
#else
            PatreonEmailLabel.Visibility   = Visibility.Hidden;
            PatreonEmailTextBox.Visibility = Visibility.Hidden;
            PatreonStatusLabel.Visibility  = Visibility.Hidden;
            AlbumArtCheckBox.Visibility    = Visibility.Hidden;
#endif

            PopulateToolbox();

            if (Settings.Default.MinimizeOnStartup)
            {
                SetVisibility(false);
            }
        }
 private void CreateBridge()
 {
     _bridge?.Shutdown();
     _bridge = (string)AppNameComboBox.SelectedItem == "iTunes" ? new DiscordBridge("383816327850360843") : new DiscordBridge("529435150472183819");
 }