private void BtnDeckStats_Click(object sender, RoutedEventArgs e)
        {
            var deck = DeckPickerList.SelectedDeck;

            if (Config.Instance.StatsInWindow)
            {
                StatsWindow.StatsControl.SetDeck(deck);
                StatsWindow.WindowState = WindowState.Normal;
                StatsWindow.Show();
                StatsWindow.Activate();
            }
            else
            {
                DeckStatsFlyout.SetDeck(deck);
                FlyoutDeckStats.IsOpen = true;
            }
        }
Пример #2
0
        public void ShowStats()
        {
            var deck = DeckPickerList.SelectedDecks.FirstOrDefault() ?? DeckList.Instance.ActiveDeck;

            if (Config.Instance.StatsInWindow)
            {
                Core.Windows.StatsWindow.StatsControl.SetDeck(deck);
                Core.Windows.StatsWindow.WindowState = WindowState.Normal;
                Core.Windows.StatsWindow.Show();
                Core.Windows.StatsWindow.Activate();
            }
            else
            {
                DeckStatsFlyout.SetDeck(deck);
                FlyoutDeckStats.IsOpen = true;
            }
        }
Пример #3
0
        private void MenuItemQuickFilter_Click(object sender, EventArgs e)
        {
            var tag       = ((TextBlock)sender).Text;
            var actualTag = SortFilterDecksFlyout.Tags.FirstOrDefault(t => t.Name.ToUpperInvariant() == tag);

            if (actualTag != null)
            {
                var tags = new List <string> {
                    actualTag.Name
                };
                SortFilterDecksFlyout.SetSelectedTags(tags);
                Config.Instance.SelectedTags = tags;
                Config.Save();
                DeckPickerList.UpdateDecks();
                Core.Windows.StatsWindow.StatsControl.LoadOverallStats();
                DeckStatsFlyout.LoadOverallStats();
            }
        }
        private void LoadConfig()
        {
            if (Config.Instance.TrackerWindowTop.HasValue)
            {
                Top = Config.Instance.TrackerWindowTop.Value;
            }
            if (Config.Instance.TrackerWindowLeft.HasValue)
            {
                Left = Config.Instance.TrackerWindowLeft.Value;
            }

            if (Config.Instance.WindowHeight < 0)
            {
                Config.Instance.Reset("WindowHeight");
            }
            Height = Config.Instance.WindowHeight;
            if (Config.Instance.WindowWidth < 0)
            {
                Config.Instance.Reset("WindowWidth");
            }
            Width = Config.Instance.WindowWidth;
            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);



            Application.Current.Resources["GrayTextColorBrush"] = theme.Name == "BaseLight"
                                                                                           ? new SolidColorBrush((Color)Application.Current.Resources["GrayTextColor1"])
                                                                                           : new SolidColorBrush((Color)Application.Current.Resources["GrayTextColor2"]);

            Options.Load();


            Game.HighlightCardsInHand       = Config.Instance.HighlightCardsInHand;
            Game.HighlightDiscarded         = Config.Instance.HighlightDiscarded;
            CheckboxDeckDetection.IsChecked = Config.Instance.AutoDeckDetection;
            SetContextMenuProperty("autoSelectDeck", "Checked", (bool)CheckboxDeckDetection.IsChecked);

            // Don't select the 'archived' class on load
            var selectedClasses = Config.Instance.SelectedDeckPickerClasses.Where(c => c.ToString() != "Archived").ToList();

            if (selectedClasses.Count == 0)
            {
                selectedClasses.Add(HeroClassAll.All);
            }

            DeckPickerList.SelectClasses(selectedClasses);
            DeckPickerList.SelectDeckType(Config.Instance.SelectedDeckType, true);

            SortFilterDecksFlyout.LoadTags(DeckList.Instance.AllTags);

            UpdateQuickFilterItemSource();

            SortFilterDecksFlyout.SetSelectedTags(Config.Instance.SelectedTags);

            TagControlEdit.LoadTags(DeckList.Instance.AllTags.Where(tag => tag != "All" && tag != "None").ToList());
            SortFilterDecksFlyout.OperationSwitch.IsChecked = Config.Instance.TagOperation == TagFilerOperation.And;

            SortFilterDecksFlyout.ComboboxDeckSorting.SelectedItem      = Config.Instance.SelectedDeckSorting;
            SortFilterDecksFlyout.CheckBoxSortByClass.IsChecked         = Config.Instance.SortDecksByClass;
            SortFilterDecksFlyout.ComboboxDeckSortingArena.SelectedItem = Config.Instance.SelectedDeckSortingArena;
            SortFilterDecksFlyout.CheckBoxSortByClassArena.IsChecked    = Config.Instance.SortDecksByClassArena;

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

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

            ManaCurveMyDecks.Visibility = Config.Instance.ManaCurveMyDecks ? Visibility.Visible : Visibility.Collapsed;
            //ManaCurveMyDecks.ListViewStatType.SelectedIndex = (int)Config.Instance.ManaCurveFilter;

            CheckboxClassCardsFirst.IsChecked = Config.Instance.CardSortingClassFirst;
            SetContextMenuProperty("classCardsFirst", "Checked", (bool)CheckboxClassCardsFirst.IsChecked);
            SetContextMenuProperty("useNoDeck", "Checked", DeckList.Instance.ActiveDeck == null);


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

            MenuItemCheckBoxSyncOnStart.IsChecked        = Config.Instance.HearthStatsSyncOnStart;
            MenuItemCheckBoxAutoUploadDecks.IsChecked    = Config.Instance.HearthStatsAutoUploadNewDecks;
            MenuItemCheckBoxAutoUploadGames.IsChecked    = Config.Instance.HearthStatsAutoUploadNewGames;
            MenuItemCheckBoxAutoSyncBackground.IsChecked = Config.Instance.HearthStatsAutoSyncInBackground;
            MenuItemCheckBoxAutoDeleteDecks.IsChecked    = Config.Instance.HearthStatsAutoDeleteDecks;
            MenuItemCheckBoxAutoDeleteGames.IsChecked    = Config.Instance.HearthStatsAutoDeleteMatches;
        }
Пример #5
0
        public void SelectDeck(Deck deck, bool setActive)
        {
            if (DeckList.Instance.ActiveDeck != null)
            {
                DeckPickerList.ClearFromCache(DeckList.Instance.ActiveDeck);
            }
            if (deck != null)
            {
                //set up notes
                DeckNotesEditor.SetDeck(deck);
                var flyoutHeader = deck.Name.Length >= 20 ? string.Join("", deck.Name.Take(17)) + "..." : deck.Name;
                FlyoutNotes.Header = flyoutHeader;

                //set up tags
                TagControlEdit.SetSelectedTags(DeckPickerList.SelectedDecks);
                MenuItemQuickSetTag.ItemsSource = TagControlEdit.Tags;
                MenuItemQuickSetTag.Items.Refresh();
                DeckPickerList.MenuItemQuickSetTag.ItemsSource = TagControlEdit.Tags;
                DeckPickerList.MenuItemQuickSetTag.Items.Refresh();


                //set and save last used deck for class
                if (setActive)
                {
                    while (DeckList.Instance.LastDeckClass.Any(ldc => ldc.Class == deck.Class))
                    {
                        var lastSelected = DeckList.Instance.LastDeckClass.FirstOrDefault(ldc => ldc.Class == deck.Class);
                        if (lastSelected != null)
                        {
                            DeckList.Instance.LastDeckClass.Remove(lastSelected);
                        }
                        else
                        {
                            break;
                        }
                    }
                    DeckList.Instance.LastDeckClass.Add(new DeckInfo {
                        Class = deck.Class, Name = deck.Name, Id = deck.DeckId
                    });
                    DeckList.Save();

                    Log.Info("Switched to deck: " + deck.Name);

                    int useNoDeckMenuItem = Core.TrayIcon.NotifyIcon.ContextMenu.MenuItems.IndexOfKey(TrayIcon.UseNoDeckMenuItemName);
                    Core.TrayIcon.NotifyIcon.ContextMenu.MenuItems[useNoDeckMenuItem].Checked = false;
                }
            }
            else
            {
                Core.Game.IsUsingPremade = false;

                if (DeckList.Instance.ActiveDeck != null)
                {
                    DeckList.Instance.ActiveDeck.IsSelectedInGui = false;
                }

                DeckList.Instance.ActiveDeck = null;
                if (setActive)
                {
                    DeckPickerList.DeselectDeck();
                }

                var useNoDeckMenuItem = Core.TrayIcon.NotifyIcon.ContextMenu.MenuItems.IndexOfKey(TrayIcon.UseNoDeckMenuItemName);
                Core.TrayIcon.NotifyIcon.ContextMenu.MenuItems[useNoDeckMenuItem].Checked = true;
            }

            //set up stats
            var statsTitle = $"Stats{(deck == null ? "" : ": " + deck.Name)}";

            Core.Windows.StatsWindow.Title = statsTitle;
            FlyoutDeckStats.Header         = statsTitle;
            Core.Windows.StatsWindow.StatsControl.SetDeck(deck);
            DeckStatsFlyout.SetDeck(deck);

            if (setActive)
            {
                UseDeck(deck);
            }
            UpdateDeckList(deck);
            EnableMenuItems(deck != null);
            ManaCurveMyDecks.SetDeck(deck);
            UpdatePanelVersionComboBox(deck);
            if (setActive)
            {
                Core.Overlay.ListViewPlayer.Items.Refresh();
                Core.Windows.PlayerWindow.ListViewPlayer.Items.Refresh();
            }
            DeckManagerEvents.OnDeckSelected.Execute(deck);
        }
        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();
        }
Пример #7
0
        private void LoadConfig()
        {
            if (Config.Instance.TrackerWindowTop.HasValue)
            {
                Top = Config.Instance.TrackerWindowTop.Value;
            }
            if (Config.Instance.TrackerWindowLeft.HasValue)
            {
                Left = Config.Instance.TrackerWindowLeft.Value;
            }

            if (Config.Instance.WindowHeight < 0)
            {
                Config.Instance.Reset("WindowHeight");
            }
            Height = Config.Instance.WindowHeight;
            if (Config.Instance.WindowWidth < 0)
            {
                Config.Instance.Reset("WindowWidth");
            }
            Width = Config.Instance.WindowWidth;
            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;


            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.CheckboxAdvancedWindowSearch.IsChecked      = Config.Instance.AdvancedWindowSearch;
            Options.CheckboxDeleteDeckKeepStats.IsChecked       = Config.Instance.KeepStatsWhenDeletingDeck;
            Options.CheckboxNoteDialog.IsChecked                = Config.Instance.ShowNoteDialogAfterGame;
            Options.CheckboxAutoClear.IsChecked                 = Config.Instance.AutoClearDeck;
            Options.CheckboxLogTab.IsChecked                 = Config.Instance.ShowLogTab;
            Options.CheckboxTimerAlert.IsChecked             = Config.Instance.TimerAlert;
            Options.CheckboxRecordSpectator.IsChecked        = Config.Instance.RecordSpectator;
            Options.CheckboxHideOverlayInSpectator.IsChecked = Config.Instance.HideOverlayInSpectator;
            Options.TextboxExportDelay.Text = Config.Instance.ExportStartDelay.ToString();
            Options.CheckboxDiscardZeroTurnGame.IsChecked     = Config.Instance.DiscardZeroTurnGame;
            Options.CheckboxSaveHSLogIntoReplayFile.IsChecked = Config.Instance.SaveHSLogIntoReplay;
            Options.CheckboxNoteDialogDelayed.IsChecked       = Config.Instance.NoteDialogDelayed;
            Options.CheckboxNoteDialogDelayed.IsEnabled       = Config.Instance.ShowNoteDialogAfterGame;
            Options.CheckboxStartWithWindows.IsChecked        = Config.Instance.StartWithWindows;
            Options.CheckboxOverlayCardMarkToolTips.IsChecked = Config.Instance.OverlayCardMarkToolTips;
            Options.ComboBoxLogLevel.SelectedValue            = Config.Instance.LogLevel.ToString();
            Options.CheckBoxForceExtraFeatures.IsChecked      = Config.Instance.ForceMouseHook;
            Options.CheckBoxForceExtraFeatures.IsEnabled      = Config.Instance.ExtraFeatures;
            Options.CheckboxAutoGrayoutSecrets.IsChecked      = Config.Instance.AutoGrayoutSecrets;
            Options.CheckboxImportNetDeck.IsChecked           = Config.Instance.NetDeckClipboardCheck ?? false;
            Options.CheckboxAutoSaveOnImport.IsChecked        = Config.Instance.AutoSaveOnImport;

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

            DeckPickerList.SelectClasses(Config.Instance.SelectedDeckPickerClasses.ToList());
            DeckPickerList.SelectDeckType(Config.Instance.SelectedDeckType, true);

            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.Instance.AllTags);

            UpdateQuickFilterItemSource();

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


            TagControlEdit.LoadTags(DeckList.Instance.AllTags.Where(tag => tag != "All" && tag != "None").ToList());
            //DeckPickerList.SetTagOperation(Config.Instance.TagOperation);
            SortFilterDecksFlyout.OperationSwitch.IsChecked = Config.Instance.TagOperation == TagFilerOperation.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;

            CheckboxClassCardsFirst.IsChecked = Config.Instance.CardSortingClassFirst;

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

            MenuItemImportArena.IsEnabled = Config.Instance.ShowArenaImportMessage;

            MenuItemCheckBoxSyncOnStart.IsChecked        = Config.Instance.HearthStatsSyncOnStart;
            MenuItemCheckBoxAutoUploadDecks.IsChecked    = Config.Instance.HearthStatsAutoUploadNewDecks;
            MenuItemCheckBoxAutoUploadGames.IsChecked    = Config.Instance.HearthStatsAutoUploadNewGames;
            MenuItemCheckBoxAutoSyncBackground.IsChecked = Config.Instance.HearthStatsAutoSyncInBackground;
            MenuItemCheckBoxAutoDeleteDecks.IsChecked    = Config.Instance.HearthStatsAutoDeleteDecks;
            MenuItemCheckBoxAutoDeleteGames.IsChecked    = Config.Instance.HearthStatsAutoDeleteMatches;

            UpdatePanelVersionComboBox(DeckList.Instance.ActiveDeck);
            if (DeckList.Instance.ActiveDeck != null && Overlay.ListViewPlayer.ItemsSource != Game.PlayerDeck)
            {
                Overlay.ListViewPlayer.ItemsSource = Game.PlayerDeck;
                Overlay.ListViewPlayer.Items.Refresh();
                PlayerWindow.ListViewPlayer.ItemsSource = Game.PlayerDeck;
                PlayerWindow.ListViewPlayer.Items.Refresh();
                Logger.WriteLine("Set player itemsource as playerdeck", "Tracker");
            }
            ManaCurveMyDecks.SetDeck(DeckList.Instance.ActiveDeck);
            EnableMenuItems(DeckList.Instance.ActiveDeck != null);
        }
        internal void LoadConfigSettings()
        {
            if (Config.Instance.TrackerWindowTop.HasValue)
            {
                Top = Config.Instance.TrackerWindowTop.Value;
            }
            if (Config.Instance.TrackerWindowLeft.HasValue)
            {
                Left = Config.Instance.TrackerWindowLeft.Value;
            }

            if (Config.Instance.WindowHeight < 0)
            {
                Config.Instance.Reset("WindowHeight");
            }
            Height = Config.Instance.WindowHeight;
            if (Config.Instance.WindowWidth < 0)
            {
                Config.Instance.Reset("WindowWidth");
            }
            Width = Config.Instance.WindowWidth;
            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();
                }
            }

            Options.Load(Core.Game);
            Help.TxtblockVersion.Text = "v" + Helper.GetCurrentVersion().ToVersionString();

            Core.TrayIcon.SetContextMenuProperty("autoSelectDeck", "Checked", Config.Instance.AutoDeckDetection);

            // Don't select the 'archived' class on load
            var selectedClasses = Config.Instance.SelectedDeckPickerClasses.Where(c => c.ToString() != "Archived").ToList();

            if (selectedClasses.Count == 0)
            {
                selectedClasses.Add(HeroClassAll.All);
            }

            DeckPickerList.SelectClasses(selectedClasses);
            DeckPickerList.SelectDeckType(Config.Instance.SelectedDeckType, true);
            DeckPickerList.UpdateAutoSelectToggleButton();

            SortFilterDecksFlyout.LoadTags(DeckList.Instance.AllTags);

            SortFilterDecksFlyout.SetSelectedTags(Config.Instance.SelectedTags);

            TagControlEdit.LoadTags(DeckList.Instance.AllTags.Where(tag => tag != "All" && tag != "None").ToList());
            SortFilterDecksFlyout.OperationSwitch.IsChecked = Config.Instance.TagOperation == TagFilerOperation.And;

            SortFilterDecksFlyout.ComboboxDeckSorting.SelectedItem      = Config.Instance.SelectedDeckSorting;
            SortFilterDecksFlyout.CheckBoxSortByClass.IsChecked         = Config.Instance.SortDecksByClass;
            SortFilterDecksFlyout.ComboboxDeckSortingArena.SelectedItem = Config.Instance.SelectedDeckSortingArena;
            SortFilterDecksFlyout.CheckBoxSortByClassArena.IsChecked    = Config.Instance.SortDecksByClassArena;

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

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

            ManaCurveMyDecks.Visibility = Config.Instance.ManaCurveMyDecks ? Visibility.Visible : Visibility.Collapsed;

            Core.TrayIcon.SetContextMenuProperty("classCardsFirst", "Checked", Config.Instance.CardSortingClassFirst);
            Core.TrayIcon.SetContextMenuProperty("useNoDeck", "Checked", DeckList.Instance.ActiveDeck == null);


            DeckStatsFlyout.LoadConfig();
            GameDetailsFlyout.LoadConfig();
            Core.Windows.StatsWindow.StatsControl.LoadConfig();
            Core.Windows.StatsWindow.GameDetailsFlyout.LoadConfig();

            MenuItemCheckBoxSyncOnStart.IsChecked        = Config.Instance.HearthStatsSyncOnStart;
            MenuItemCheckBoxAutoUploadDecks.IsChecked    = Config.Instance.HearthStatsAutoUploadNewDecks;
            MenuItemCheckBoxAutoUploadGames.IsChecked    = Config.Instance.HearthStatsAutoUploadNewGames;
            MenuItemCheckBoxAutoSyncBackground.IsChecked = Config.Instance.HearthStatsAutoSyncInBackground;
            MenuItemCheckBoxAutoDeleteDecks.IsChecked    = Config.Instance.HearthStatsAutoDeleteDecks;
            MenuItemCheckBoxAutoDeleteGames.IsChecked    = Config.Instance.HearthStatsAutoDeleteMatches;
        }
        private void DeckPickerList_OnSelectedDeckChanged(DeckPicker sender, Deck deck)
        {
            if (deck != null)
            {
                //set up notes
                DeckNotesEditor.SetDeck(deck);
                var flyoutHeader = deck.Name.Length >= 20 ? string.Join("", deck.Name.Take(17)) + "..." : deck.Name;
                FlyoutNotes.Header = flyoutHeader;
                if (Config.Instance.StatsInWindow)
                {
                    StatsWindow.Title = "Stats: " + deck.Name;
                    StatsWindow.StatsControl.SetDeck(deck);
                }
                else
                {
                    FlyoutDeckStats.Header = "Stats: " + deck.Name;
                    DeckStatsFlyout.SetDeck(deck);
                }

                UseDeck(deck);
                Game.IsUsingPremade = true;
                //change player deck itemsource
                if (Overlay.ListViewPlayer.ItemsSource != Game.PlayerDeck)
                {
                    Overlay.ListViewPlayer.ItemsSource = Game.PlayerDeck;
                    Overlay.ListViewPlayer.Items.Refresh();
                    PlayerWindow.ListViewPlayer.ItemsSource = Game.PlayerDeck;
                    PlayerWindow.ListViewPlayer.Items.Refresh();
                    Logger.WriteLine("Set player itemsource as playerdeck");
                }
                UpdateDeckList(deck);
                Logger.WriteLine("Switched to deck: " + deck.Name);

                //set and save last used deck for class
                while (DeckList.LastDeckClass.Any(ldc => ldc.Class == deck.Class))
                {
                    var lastSelected = DeckList.LastDeckClass.FirstOrDefault(ldc => ldc.Class == deck.Class);
                    if (lastSelected != null)
                    {
                        DeckList.LastDeckClass.Remove(lastSelected);
                    }
                    else
                    {
                        break;
                    }
                }
                DeckList.LastDeckClass.Add(new DeckInfo {
                    Class = deck.Class, Name = deck.Name
                });
                WriteDecks();
                EnableMenuItems(true);
                ManaCurveMyDecks.SetDeck(deck);
                TagControlEdit.SetSelectedTags(deck.Tags);
                MenuItemQuickSetTag.ItemsSource = TagControlEdit.Tags;
                MenuItemQuickSetTag.Items.Refresh();
                MenuItemUpdateDeck.IsEnabled = !string.IsNullOrEmpty(deck.Url);
            }
            else
            {
                EnableMenuItems(false);
            }
        }