private void LoadConfig()
        {
            if (Config.Instance.TrackerWindowTop.HasValue)
            {
                Top = Config.Instance.TrackerWindowTop.Value;
            }
            if (Config.Instance.TrackerWindowLeft.HasValue)
            {
                Left = Config.Instance.TrackerWindowLeft.Value;
            }

            var titleBarCorners = new[]
            {
                new Point((int)Left + 5, (int)Top + 5),
                new Point((int)(Left + Width) - 5, (int)Top + 5),
                new Point((int)Left + 5, (int)(Top + TitlebarHeight) - 5),
                new Point((int)(Left + Width) - 5, (int)(Top + TitlebarHeight) - 5)
            };

            if (!Screen.AllScreens.Any(s => titleBarCorners.Any(c => s.WorkingArea.Contains(c))))
            {
                Top  = 100;
                Left = 100;
            }

            if (Config.Instance.StartMinimized)
            {
                WindowState = WindowState.Minimized;
                if (Config.Instance.MinimizeToTray)
                {
                    MinimizeToTray();
                }
            }

            var theme = string.IsNullOrEmpty(Config.Instance.ThemeName)
                                                        ? ThemeManager.DetectAppStyle().Item1
                                                        : ThemeManager.AppThemes.First(t => t.Name == Config.Instance.ThemeName);
            var accent = string.IsNullOrEmpty(Config.Instance.AccentName)
                                                         ? ThemeManager.DetectAppStyle().Item2
                                                         : ThemeManager.Accents.First(a => a.Name == Config.Instance.AccentName);

            ThemeManager.ChangeAppStyle(Application.Current, accent, theme);
            Options.ComboboxTheme.SelectedItem  = theme;
            Options.ComboboxAccent.SelectedItem = accent;


            Height = Config.Instance.WindowHeight;
            Width  = Config.Instance.WindowWidth;
            Game.HighlightCardsInHand = Config.Instance.HighlightCardsInHand;
            Game.HighlightDiscarded   = Config.Instance.HighlightDiscarded;
            Options.CheckboxHideOverlayInBackground.IsChecked         = Config.Instance.HideInBackground;
            Options.CheckboxHideOpponentCardAge.IsChecked             = Config.Instance.HideOpponentCardAge;
            Options.CheckboxHideOpponentCardMarks.IsChecked           = Config.Instance.HideOpponentCardMarks;
            Options.CheckboxHideOverlayInMenu.IsChecked               = Config.Instance.HideInMenu;
            Options.CheckboxHighlightCardsInHand.IsChecked            = Config.Instance.HighlightCardsInHand;
            Options.CheckboxHideOverlay.IsChecked                     = Config.Instance.HideOverlay;
            Options.CheckboxHideDecksInOverlay.IsChecked              = Config.Instance.HideDecksInOverlay;
            Options.CheckboxKeepDecksVisible.IsChecked                = Config.Instance.KeepDecksVisible;
            Options.CheckboxMinimizeTray.IsChecked                    = Config.Instance.MinimizeToTray;
            Options.CheckboxWindowsTopmost.IsChecked                  = Config.Instance.WindowsTopmost;
            Options.CheckboxPlayerWindowOpenAutomatically.IsChecked   = Config.Instance.PlayerWindowOnStart;
            Options.CheckboxOpponentWindowOpenAutomatically.IsChecked = Config.Instance.OpponentWindowOnStart;
            Options.CheckboxTimerTopmost.IsChecked                    = Config.Instance.TimerWindowTopmost;
            Options.CheckboxTimerWindow.IsChecked                     = Config.Instance.TimerWindowOnStartup;
            Options.CheckboxTimerTopmostHsForeground.IsChecked        = Config.Instance.TimerWindowTopmostIfHsForeground;
            Options.CheckboxTimerTopmostHsForeground.IsEnabled        = Config.Instance.TimerWindowTopmost;
            Options.CheckboxSameScaling.IsChecked                     = Config.Instance.UseSameScaling;
            CheckboxDeckDetection.IsChecked = Config.Instance.AutoDeckDetection;
            Options.CheckboxWinTopmostHsForeground.IsChecked = Config.Instance.WindowsTopmostIfHsForeground;
            Options.CheckboxWinTopmostHsForeground.IsEnabled = Config.Instance.WindowsTopmost;
            Options.CheckboxAutoSelectDeck.IsEnabled         = Config.Instance.AutoDeckDetection;
            Options.CheckboxAutoSelectDeck.IsChecked         = Config.Instance.AutoSelectDetectedDeck;
            Options.CheckboxExportName.IsChecked             = Config.Instance.ExportSetDeckName;
            Options.CheckboxPrioGolden.IsChecked             = Config.Instance.PrioritizeGolden;
            Options.CheckboxBringHsToForegorund.IsChecked    = Config.Instance.BringHsToForeground;
            Options.CheckboxFlashHs.IsChecked                   = Config.Instance.FlashHsOnTurnStart;
            Options.CheckboxHideSecrets.IsChecked               = Config.Instance.HideSecrets;
            Options.CheckboxHighlightDiscarded.IsChecked        = Config.Instance.HighlightDiscarded;
            Options.CheckboxRemoveCards.IsChecked               = Config.Instance.RemoveCardsFromDeck;
            Options.CheckboxHighlightLastDrawn.IsChecked        = Config.Instance.HighlightLastDrawn;
            Options.CheckboxStartMinimized.IsChecked            = Config.Instance.StartMinimized;
            Options.CheckboxShowPlayerGet.IsChecked             = Config.Instance.ShowPlayerGet;
            Options.ToggleSwitchExtraFeatures.IsChecked         = Config.Instance.ExtraFeatures;
            Options.CheckboxCheckForUpdates.IsChecked           = Config.Instance.CheckForUpdates;
            Options.CheckboxRecordArena.IsChecked               = Config.Instance.RecordArena;
            Options.CheckboxRecordCasual.IsChecked              = Config.Instance.RecordCasual;
            Options.CheckboxRecordFriendly.IsChecked            = Config.Instance.RecordFriendly;
            Options.CheckboxRecordOther.IsChecked               = Config.Instance.RecordOther;
            Options.CheckboxRecordPractice.IsChecked            = Config.Instance.RecordPractice;
            Options.CheckboxRecordRanked.IsChecked              = Config.Instance.RecordRanked;
            Options.CheckboxFullTextSearch.IsChecked            = Config.Instance.UseFullTextSearch;
            Options.CheckboxDiscardGame.IsChecked               = Config.Instance.DiscardGameIfIncorrectDeck;
            Options.CheckboxExportPasteClipboard.IsChecked      = Config.Instance.ExportPasteClipboard;
            Options.CheckboxGoldenFeugen.IsChecked              = Config.Instance.OwnsGoldenFeugen;
            Options.CheckboxGoldenStalagg.IsChecked             = Config.Instance.OwnsGoldenStalagg;
            Options.CheckboxCloseWithHearthstone.IsChecked      = Config.Instance.CloseWithHearthstone;
            Options.CheckboxStatsInWindow.IsChecked             = Config.Instance.StatsInWindow;
            Options.CheckboxOverlaySecretToolTipsOnly.IsChecked = Config.Instance.OverlaySecretToolTipsOnly;
            Options.CheckboxTagOnImport.IsChecked               = Config.Instance.TagDecksOnImport;
            Options.CheckboxConfigSaveAppData.IsChecked         = Config.Instance.SaveConfigInAppData;
            Options.CheckboxDataSaveAppData.IsChecked           = Config.Instance.SaveDataInAppData;

            Options.SliderOverlayOpacity.Value         = Config.Instance.OverlayOpacity;
            Options.SliderOpponentOpacity.Value        = Config.Instance.OpponentOpacity;
            Options.SliderPlayerOpacity.Value          = Config.Instance.PlayerOpacity;
            Options.SliderOverlayPlayerScaling.Value   = Config.Instance.OverlayPlayerScaling;
            Options.SliderOverlayOpponentScaling.Value = Config.Instance.OverlayOpponentScaling;

            DeckPickerList.ShowAll = Config.Instance.ShowAllDecks;
            DeckPickerList.SetSelectedTags(Config.Instance.SelectedTags);

            Options.CheckboxHideTimers.IsChecked = Config.Instance.HideTimers;

            var delay = Config.Instance.DeckExportDelay;

            Options.ComboboxExportSpeed.SelectedIndex = delay < 40 ? 0 : delay < 60 ? 1 : delay < 100 ? 2 : delay < 150 ? 3 : 4;

            SortFilterDecksFlyout.LoadTags(DeckList.AllTags);

            SortFilterDecksFlyout.SetSelectedTags(Config.Instance.SelectedTags);
            DeckPickerList.SetSelectedTags(Config.Instance.SelectedTags);

            var tags = new List <string>(DeckList.AllTags);

            tags.Remove("All");
            TagControlEdit.LoadTags(tags);
            DeckPickerList.SetTagOperation(Config.Instance.TagOperation);
            SortFilterDecksFlyout.OperationSwitch.IsChecked = Config.Instance.TagOperation == Operation.And;

            SortFilterDecksFlyout.ComboboxDeckSorting.SelectedItem = Config.Instance.SelectedDeckSorting;

            Options.ComboboxWindowBackground.SelectedItem = Config.Instance.SelectedWindowBackground;
            Options.TextboxCustomBackground.IsEnabled     = Config.Instance.SelectedWindowBackground == "Custom";
            Options.TextboxCustomBackground.Text          = string.IsNullOrEmpty(Config.Instance.WindowsBackgroundHex)
                                                                                                           ? "#696969"
                                                                                                           : Config.Instance.WindowsBackgroundHex;
            Options.UpdateAdditionalWindowsBackground();

            if (Helper.LanguageDict.Values.Contains(Config.Instance.SelectedLanguage))
            {
                Options.ComboboxLanguages.SelectedItem = Helper.LanguageDict.First(x => x.Value == Config.Instance.SelectedLanguage).Key;
            }

            if (!EventKeys.Contains(Config.Instance.KeyPressOnGameStart))
            {
                Config.Instance.KeyPressOnGameStart = "None";
            }
            Options.ComboboxKeyPressGameStart.SelectedValue = Config.Instance.KeyPressOnGameStart;

            if (!EventKeys.Contains(Config.Instance.KeyPressOnGameEnd))
            {
                Config.Instance.KeyPressOnGameEnd = "None";
            }
            Options.ComboboxKeyPressGameEnd.SelectedValue = Config.Instance.KeyPressOnGameEnd;

            Options.CheckboxHideManaCurveMyDecks.IsChecked = Config.Instance.ManaCurveMyDecks;
            ManaCurveMyDecks.Visibility = Config.Instance.ManaCurveMyDecks ? Visibility.Visible : Visibility.Collapsed;

            Options.CheckboxTrackerCardToolTips.IsChecked           = Config.Instance.TrackerCardToolTips;
            Options.CheckboxWindowCardToolTips.IsChecked            = Config.Instance.WindowCardToolTips;
            Options.CheckboxOverlayCardToolTips.IsChecked           = Config.Instance.OverlayCardToolTips;
            Options.CheckboxOverlayAdditionalCardToolTips.IsEnabled = Config.Instance.OverlayCardToolTips;
            Options.CheckboxOverlayAdditionalCardToolTips.IsChecked = Config.Instance.AdditionalOverlayTooltips;

            Options.CheckboxDeckSortingClassFirst.IsChecked = Config.Instance.CardSortingClassFirst;

            DeckStatsFlyout.LoadConfig();
            GameDetailsFlyout.LoadConfig();
            StatsWindow.StatsControl.LoadConfig();
            StatsWindow.GameDetailsFlyout.LoadConfig();
        }