コード例 #1
0
		private async void MetroWindow_Loaded(object sender, RoutedEventArgs e)
		{
			var presentationsource = PresentationSource.FromVisual(this);
			if(presentationsource != null) // make sure it's connected
			{
				Helper.DpiScalingX = presentationsource.CompositionTarget.TransformToDevice.M11;
				Helper.DpiScalingY = presentationsource.CompositionTarget.TransformToDevice.M22;
			}
			ManaCurveMyDecks.UpdateValues();
			if(_updatedVersion != null)
				await this.ShowUpdateNotesMessage();

			if(!_foundHsDirectory)
				await this.ShowHsNotInstalledMessage();
			else if(_updatedLogConfig)
			{
				await
					this.ShowMessage("Restart Hearthstone",
					                 "This is either your first time starting the tracker or the log.config file has been updated. Please restart Heartstone once, for the tracker to work properly.");
			}

			if(!Config.Instance.ResolvedDeckStatsIds)
			{
				if(ResolveDeckStatsIds())
					await Restart();
			}
			if(Config.Instance.HearthStatsSyncOnStart && HearthStatsAPI.IsLoggedIn)
				HearthStatsManager.SyncAsync(background: true);
		}
コード例 #2
0
        private void ComboBoxDeckVersion_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!_initialized || DeckPickerList.ChangedSelection)
            {
                return;
            }
            var deck = DeckPickerList.SelectedDecks.FirstOrDefault();

            if (deck == null)
            {
                return;
            }
            var version = ComboBoxDeckVersion.SelectedItem as SerializableVersion;

            if (version == null || deck.SelectedVersion == version)
            {
                return;
            }
            deck.SelectVersion(version);
            DeckList.Save();
            DeckPickerList.UpdateDecks(forceUpdate: new[] { deck });
            UpdateDeckList(deck);
            ManaCurveMyDecks.UpdateValues();
            if (deck.Equals(DeckList.Instance.ActiveDeck))
            {
                UseDeck(deck);
            }
            Console.WriteLine(version);
        }
コード例 #3
0
        private void RemoveCardFromDeck(Card card)
        {
            if (card == null)
            {
                return;
            }
            if (card.Count > 1)
            {
                card.Count--;
            }
            else
            {
                _newDeck.Cards.Remove(card);
            }

            UpdateCardCount();
            Helper.SortCardCollection(ListViewDeck.Items, Config.Instance.CardSortingClassFirst);
            ManaCurveMyDecks.UpdateValues();
            try
            {
                TextBoxDBFilter.Focus();
                TextBoxDBFilter.Select(0, TextBoxDBFilter.Text.Length);
            }
            catch
            {
            }
            UpdateExpansionIcons();
        }
コード例 #4
0
        public void DeselectDeck()
        {
            Logger.WriteLine("set player item source as drawn");
            Overlay.ListViewPlayer.ItemsSource      = Game.PlayerDrawn;
            PlayerWindow.ListViewPlayer.ItemsSource = Game.PlayerDrawn;
            Game.IsUsingPremade = false;

            if (Config.Instance.StatsInWindow)
            {
                StatsWindow.Title = "Stats";
                StatsWindow.StatsControl.SetDeck(null);
            }
            else
            {
                FlyoutDeckStats.Header = "Stats";
                DeckStatsFlyout.SetDeck(null);
            }

            if (DeckPickerList.SelectedDeck != null)
            {
                DeckPickerList.SelectedDeck.IsSelectedInGui = false;
            }

            DeckPickerList.SelectedDeck  = null;
            DeckPickerList.SelectedIndex = -1;
            DeckPickerList.ListboxPicker.Items.Refresh();

            UpdateDeckList(null);
            UseDeck(null);
            EnableMenuItems(false);
            ManaCurveMyDecks.ClearDeck();
        }
コード例 #5
0
        private async void CreateNewDeck(string hero)
        {
            _newDeck = new Deck {
                Class = hero
            };

            var result =
                await
                this.ShowMessageAsync("Deck type?", "Please select a deck type.", MessageDialogStyle.AffirmativeAndNegative,
                                      new MessageDialogs.Settings {
                AffirmativeButtonText = "constructed", NegativeButtonText = "arena run"
            });

            if (result == MessageDialogResult.Negative)
            {
                _newDeck.IsArenaDeck = true;
            }

            SelectDeck(null, false);
            ExpandNewDeck();
            ListViewDeck.ItemsSource = _newDeck.Cards;
            UpdateDeckHistoryPanel(_newDeck, true);
            ManaCurveMyDecks.SetDeck(_newDeck);
            UpdateDbListView();
        }
コード例 #6
0
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            var presentationsource = PresentationSource.FromVisual(this);

            if (presentationsource != null)            // make sure it's connected
            {
                Helper.DpiScalingX = presentationsource.CompositionTarget.TransformToDevice.M11;
                Helper.DpiScalingY = presentationsource.CompositionTarget.TransformToDevice.M22;
            }
            if (!_foundHsDirectory)
            {
                this.ShowHsNotInstalledMessage();
                return;
            }
            if (NewVersion != null)
            {
                ShowNewUpdateMessage();
            }
            if (_updatedVersion != null)
            {
                this.ShowUpdateNotesMessage();
            }

            if (_updatedLogConfig)
            {
                this.ShowMessage("Restart Hearthstone",
                                 "This is either your first time starting the tracker or the log.config file has been updated. Please restart Heartstone once, for the tracker to work properly.");
            }

            ManaCurveMyDecks.UpdateValues();
        }
コード例 #7
0
        private void ComboBoxDeckVersion_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!_initialized || DeckPickerList.ChangedSelection)
            {
                return;
            }
            var deck = DeckPickerList.SelectedDecks.FirstOrDefault() ?? DeckList.Instance.ActiveDeck;

            if (deck == null)
            {
                return;
            }
            var version = ComboBoxDeckVersion.SelectedItem as SerializableVersion;

            if (version == null || deck.SelectedVersion == version)
            {
                return;
            }
            deck.SelectVersion(version);
            DeckList.Save();
            DeckPickerList.UpdateDecks(forceUpdate: new[] { deck });
            UpdateDeckList(deck);
            ManaCurveMyDecks.UpdateValues();
            OnPropertyChanged(nameof(HsReplayButtonVisibility));
            if (deck.Equals(DeckList.Instance.ActiveDeck))
            {
                UseDeck(deck);
            }
            DeckCharts.SetDeck(deck);
            HsReplayDeckInfo.SetDeck(deck);
        }
コード例 #8
0
        public void SetNewDeck(Deck deck, bool editing = false)
        {
            if (deck == null)
            {
                return;
            }
            ClearNewDeckSection();
            SelectDeck(null, false);
            EditingDeck = editing;
            if (editing)
            {
                _editedDeckName = deck.Name;
                _originalDeck   = deck;
            }
            _newDeck = (Deck)deck.Clone();

            _newDeck.Cards.Clear();
            foreach (var card in deck.GetSelectedDeckVersion().Cards)
            {
                _newDeck.Cards.Add(card.Clone() as Card);
            }
            _newDeck.SelectedVersion = _newDeck.Version;
            UpdateExpansionIcons();

            ListViewDeck.ItemsSource = _newDeck.Cards;
            Helper.SortCardCollection(ListViewDeck.ItemsSource, false);
            TextBoxDeckName.Text = _newDeck.Name;
            BorderConstructedCardLimits.Visibility  = _newDeck.IsArenaDeck ? Collapsed : Visible;
            CheckBoxConstructedCardLimits.IsChecked = true;
            UpdateDeckHistoryPanel(deck, !editing);
            UpdateDbListView();
            ExpandNewDeck();
            UpdateCardCount();
            ManaCurveMyDecks.SetDeck(_newDeck);
        }
コード例 #9
0
        private async void CreateNewDeck(string hero)
        {
            _newDeck = new Deck {
                Class = hero
            };

            var result =
                await
                this.ShowMessageAsync("Deck type?", "Please select a deck type.", MessageDialogStyle.AffirmativeAndNegativeAndSingleAuxiliary,
                                      new MessageDialogs.Settings {
                AffirmativeButtonText = "constructed", NegativeButtonText = "arena run", FirstAuxiliaryButtonText = "cancel"
            });

            if (result == MessageDialogResult.FirstAuxiliary)
            {
                return;
            }
            if (result == MessageDialogResult.Negative)
            {
                _newDeck.IsArenaDeck = true;
            }

            BorderConstructedCardLimits.Visibility  = _newDeck.IsArenaDeck ? Collapsed : Visible;
            CheckBoxConstructedCardLimits.IsChecked = true;
            SelectDeck(null, false);
            ExpandNewDeck();
            ListViewDeck.ItemsSource = _newDeck.Cards;
            UpdateDeckHistoryPanel(_newDeck, true);
            ManaCurveMyDecks.SetDeck(_newDeck);
            UpdateDbListView();
        }
コード例 #10
0
        private async void CreateNewDeck(string hero)
        {
            _newDeck = new Deck {
                Class = hero
            };
            var type = await this.ShowDeckTypeDialog();

            if (type == null)
            {
                return;
            }
            if (type == DeckType.Arena)
            {
                _newDeck.IsArenaDeck = true;
            }
            else if (type == DeckType.Brawl)
            {
                if (!DeckList.Instance.AllTags.Contains("Brawl"))
                {
                    DeckList.Instance.AllTags.Add("Brawl");
                    DeckList.Save();
                    Core.MainWindow?.ReloadTags();
                }
                _newDeck.Tags.Add("Brawl");
            }

            BorderConstructedCardLimits.Visibility  = _newDeck.IsArenaDeck ? Collapsed : Visible;
            CheckBoxConstructedCardLimits.IsChecked = true;
            SelectDeck(null, false);
            ExpandNewDeck();
            ListViewDeck.ItemsSource = _newDeck.Cards;
            UpdateDeckHistoryPanel(_newDeck, true);
            ManaCurveMyDecks.SetDeck(_newDeck);
            UpdateDbListView();
        }
コード例 #11
0
        private void AddCardToDeck(Card card)
        {
            if (card == null)
            {
                return;
            }
            var cardInDeck = _newDeck.Cards.FirstOrDefault(c => c.Name == card.Name);

            if (cardInDeck != null)
            {
                if (!_newDeck.IsArenaDeck && (cardInDeck.Count >= 2 || cardInDeck.Rarity == "Legendary" && cardInDeck.Count >= 1))
                {
                    return;
                }
                cardInDeck.Count++;
            }
            else
            {
                _newDeck.Cards.Add(card);
            }

            UpdateCardCount();
            Helper.SortCardCollection(ListViewDeck.Items, Config.Instance.CardSortingClassFirst);
            ManaCurveMyDecks.UpdateValues();
            try
            {
                TextBoxDBFilter.Focus();
                TextBoxDBFilter.Select(0, TextBoxDBFilter.Text.Length);
            }
            catch
            {
            }
        }
コード例 #12
0
        public void SetNewDeck(Deck deck, bool editing = false)
        {
            if (deck != null)
            {
                ClearNewDeckSection();
                SelectDeck(null);
                EditingDeck = editing;
                if (editing)
                {
                    editedDeckName = deck.Name;
                    _originalDeck  = deck;
                }
                _newDeck = (Deck)deck.Clone();

                _newDeck.Cards.Clear();
                foreach (var card in deck.GetSelectedDeckVersion().Cards)
                {
                    _newDeck.Cards.Add(card.Clone() as Card);
                }
                _newDeck.SelectedVersion = _newDeck.Version;

                ListViewDeck.ItemsSource = _newDeck.Cards;
                Helper.SortCardCollection(ListViewDeck.ItemsSource, false);
                TextBoxDeckName.Text = _newDeck.Name;
                UpdateDeckHistoryPanel(deck, !editing);
                UpdateDbListView();
                ExpandNewDeck();
                UpdateCardCount();
                ManaCurveMyDecks.SetDeck(_newDeck);
            }
        }
コード例 #13
0
        private void AddCardToDeck(Card card)
        {
            if (card == null)
            {
                return;
            }
            if (_newDeck.Cards.Contains(card))
            {
                var cardInDeck = _newDeck.Cards.First(c => c.Name == card.Name);
                cardInDeck.Count++;
            }
            else
            {
                _newDeck.Cards.Add(card);
            }

            UpdateTitle();
            Helper.SortCardCollection(ListViewDeck.Items, Config.Instance.CardSortingClassFirst);
            ManaCurveMyDecks.UpdateValues();
            try
            {
                TextBoxDBFilter.Focus();
                TextBoxDBFilter.Select(0, TextBoxDBFilter.Text.Length);
            }
            catch
            {
            }
        }
コード例 #14
0
        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);
                }

                //change player deck itemsource
                if (Overlay.ListViewPlayer.ItemsSource != Game.PlayerDeck)
                {
                    Overlay.ListViewPlayer.ItemsSource      = Game.PlayerDeck;
                    PlayerWindow.ListViewPlayer.ItemsSource = Game.PlayerDeck;
                    Logger.WriteLine("Set player itemsource as playerdeck");
                }
                Game.IsUsingPremade = true;
                UpdateDeckList(deck);
                UseDeck(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);
            }
        }
コード例 #15
0
 public void LoadAndUpdateDecks()
 {
     UpdateDeckList(DeckList.Instance.ActiveDeck);
     UpdateDbListView();
     SelectDeck(DeckList.Instance.ActiveDeck, true);
     Helper.SortCardCollection(ListViewDeck.Items, Config.Instance.CardSortingClassFirst);
     DeckPickerList.PropertyChanged += DeckPickerList_PropertyChanged;
     DeckPickerList.UpdateDecks();
     DeckPickerList.UpdateArchivedClassVisibility();
     ManaCurveMyDecks.UpdateValues();
 }
コード例 #16
0
 private void CreateNewDeck(string hero)
 {
     DeselectDeck();
     ExpandNewDeck();
     _newDeck = new Deck {
         Class = hero
     };
     ListViewDeck.ItemsSource = _newDeck.Cards;
     ManaCurveMyDecks.SetDeck(_newDeck);
     UpdateDbListView();
 }
コード例 #17
0
        private async void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            var presentationsource = PresentationSource.FromVisual(this);

            if (presentationsource != null)            // make sure it's connected
            {
                Helper.DpiScalingX = presentationsource.CompositionTarget.TransformToDevice.M11;
                Helper.DpiScalingY = presentationsource.CompositionTarget.TransformToDevice.M22;
            }
            ManaCurveMyDecks.UpdateValues();
            if (_updatedVersion != null)
            {
                FlyoutUpdateNotes.IsOpen = true;
                UpdateNotesControl.LoadUpdateNotes();
                //await this.ShowUpdateNotesMessage();
            }

            if (!_foundHsDirectory)
            {
                await this.ShowHsNotInstalledMessage();
            }
            else if (_updatedLogConfig && _game.IsRunning)
            {
                await
                this.ShowMessage("Restart Hearthstone",
                                 "This is either your first time starting HDT or the log.config file has been updated. Please restart Hearthstone, for HDT to work properly.");
            }

            if (!Config.Instance.FixedDuplicateMatches)
            {
                RemoveDuplicateMatches(false);
            }

            if (!Config.Instance.ResolvedOpponentNames)
            {
                ResolveOpponentNames();
            }
            if (!Config.Instance.ResolvedDeckStatsIds)
            {
                ResolveDeckStatsIds();
                //Restart();
            }
            if (Config.Instance.HearthStatsSyncOnStart && HearthStatsAPI.IsLoggedIn)
            {
                HearthStatsManager.SyncAsync(background: true);
            }

            //SetupProtocol(); turn on later
        }
コード例 #18
0
        private void RemoveCardFromDeck(Card card)
        {
            if (card == null)
            {
                return;
            }
            if (card.Count > 1)
            {
                card.Count--;
            }
            else
            {
                _newDeck.Cards.Remove(card);
            }

            UpdateTitle();
            Helper.SortCardCollection(ListViewDeck.Items, Config.Instance.CardSortingClassFirst);
            ManaCurveMyDecks.UpdateValues();
        }
コード例 #19
0
 public void SetNewDeck(Deck deck, bool editing = false)
 {
     if (deck != null)
     {
         ClearNewDeckSection();
         DeselectDeck();
         EditingDeck = editing;
         if (editing)
         {
             editedDeckName = deck.Name;
         }
         _newDeck = (Deck)deck.Clone();
         ListViewDeck.ItemsSource = _newDeck.Cards;
         Helper.SortCardCollection(ListViewDeck.ItemsSource, false);
         TextBoxDeckName.Text = _newDeck.Name;
         UpdateDbListView();
         ExpandNewDeck();
         UpdateTitle();
         ManaCurveMyDecks.SetDeck(deck);
     }
 }
コード例 #20
0
        private void DeselectDeck()
        {
            Logger.WriteLine("set player item source as drawn");
            Overlay.ListViewPlayer.ItemsSource      = Game.PlayerDrawn;
            PlayerWindow.ListViewPlayer.ItemsSource = Game.PlayerDrawn;
            Game.IsUsingPremade = false;

            if (DeckPickerList.SelectedDeck != null)
            {
                DeckPickerList.SelectedDeck.IsSelectedInGui = false;
            }

            DeckPickerList.SelectedDeck  = null;
            DeckPickerList.SelectedIndex = -1;
            DeckPickerList.ListboxPicker.Items.Refresh();

            UpdateDeckList(null);
            UseDeck(null);
            EnableMenuItems(false);
            ManaCurveMyDecks.ClearDeck();
        }
コード例 #21
0
        internal async void BtnUpdateDeck_Click(object sender, RoutedEventArgs e)
        {
            var selectedDeck = DeckPickerList.SelectedDecks.FirstOrDefault();

            if (selectedDeck == null || string.IsNullOrEmpty(selectedDeck.Url))
            {
                return;
            }
            var deck = await DeckImporter.Import(selectedDeck.Url);

            if (deck == null)
            {
                await this.ShowMessageAsync("Error", "Could not load deck from specified url.");

                return;
            }
            //this could be expanded to check against the last version of the deck that was not modified after downloading
            if (deck.Cards.All(c1 => selectedDeck.GetSelectedDeckVersion().Cards.Any(c2 => c1.Name == c2.Name && c1.Count == c2.Count)))
            {
                await this.ShowMessageAsync("Already up to date.", "No changes found.");

                return;
            }

            SetNewDeck(selectedDeck, true);
            TextBoxDeckName.Text = deck.Name;
            _newDeck.Cards.Clear();
            foreach (var card in deck.Cards)
            {
                _newDeck.Cards.Add(card);
            }
            _newDeck.Edited();

            UpdateCardCount();
            Helper.SortCardCollection(ListViewDeck.Items, Config.Instance.CardSortingClassFirst);
            ManaCurveMyDecks.UpdateValues();

            TagControlEdit.SetSelectedTags(deck.Tags);
        }
コード例 #22
0
        private async void BtnUpdateDeck_Click(object sender, RoutedEventArgs e)
        {
            var selectedDeck = DeckPickerList.SelectedDeck;

            if (selectedDeck == null || string.IsNullOrEmpty(selectedDeck.Url))
            {
                return;
            }
            var deck = await DeckImporter.Import(selectedDeck.Url);

            if (deck == null)
            {
                await this.ShowMessageAsync("Error", "Could not load deck from specified url.");

                return;
            }
            if (deck.Cards.All(c1 => selectedDeck.Cards.Any(c2 => c1.Name == c2.Name && c1.Count == c2.Count)))
            {
                await this.ShowMessageAsync("Already up to date.", "No changes found.");

                return;
            }

            SetNewDeck(selectedDeck, true);
            TextBoxDeckName.Text = deck.Name;
            _newDeck.Cards.Clear();
            foreach (var card in deck.Cards)
            {
                _newDeck.Cards.Add(card);
            }

            UpdateTitle();
            Helper.SortCardCollection(ListViewDeck.Items, Config.Instance.CardSortingClassFirst);
            ManaCurveMyDecks.UpdateValues();

            TagControlEdit.SetSelectedTags(deck.Tags);
        }
コード例 #23
0
        internal async void UpdateDeckFromWeb(Deck existingDeck)
        {
            if (existingDeck == null || string.IsNullOrEmpty(existingDeck.Url))
            {
                return;
            }
            var deck = await DeckImporter.Import(existingDeck.Url);

            if (deck == null)
            {
                await this.ShowMessageAsync("Error", "Could not load deck from specified url.");

                return;
            }
            //this could be expanded to check against the last version of the deck that was not modified after downloading
            if (deck.Cards.All(c1 => existingDeck.GetSelectedDeckVersion().Cards.Any(c2 => c1.Name == c2.Name && c1.Count == c2.Count)) && deck.Name == existingDeck.Name)
            {
                await this.ShowMessageAsync("Already up to date.", "No changes found.");

                return;
            }

            var imported = (Deck)existingDeck.Clone();

            imported.Name = deck.Name;
            imported.Cards.Clear();
            foreach (var card in deck.Cards)
            {
                imported.Cards.Add(card);
            }
            ShowDeckEditorFlyout(imported, false);
            Helper.SortCardCollection(ListViewDeck.Items, Config.Instance.CardSortingClassFirst);
            ManaCurveMyDecks.UpdateValues();

            TagControlEdit.SetSelectedTags(deck.Tags);
        }
コード例 #24
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);
        }
コード例 #25
0
        public void SelectDeck(Deck deck, bool setActive)
        {
            if (DeckList.Instance.ActiveDeck != null)
            {
                DeckPickerList.ClearFromCache(DeckList.Instance.ActiveDeck);
            }
            if (deck != null)
            {
                //set up tags
                TagControlEdit.SetSelectedTags(DeckPickerList.SelectedDecks);
                DeckPickerList.MenuItemQuickSetTag.ItemsSource = TagControlEdit.Tags;
                DeckPickerList.MenuItemQuickSetTag.Items.Refresh();

                OnPropertyChanged(nameof(HsReplayButtonVisibility));

                //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;
                        }
                    }
                    if (Core.Initialized)
                    {
                        DeckList.Instance.LastDeckClass.Add(new DeckInfo {
                            Class = deck.Class, Name = deck.Name, Id = deck.DeckId
                        });
                        DeckList.Save();
                    }

                    Log.Info($"Switched to deck: {deck.Name} ({deck.SelectedVersion.ShortVersionString})");
                    Core.TrayIcon.MenuItemUseNoDeck.Checked = false;
                }

                if (FlyoutDeckScreenshot.IsOpen)
                {
                    DeckScreenshotFlyout.Deck = deck.GetSelectedDeckVersion();
                }
                if (FlyoutDeckExport.IsOpen)
                {
                    DeckExportFlyout.Deck = deck.GetSelectedDeckVersion();
                }

                if (FlyoutDeckHistory.IsOpen)
                {
                    if (deck.HasVersions)
                    {
                        DeckHistoryFlyout.Deck = deck;
                    }
                    else
                    {
                        FlyoutDeckHistory.IsOpen = false;
                    }
                }
            }
            else
            {
                Core.Game.IsUsingPremade = false;

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

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

                Core.TrayIcon.MenuItemUseNoDeck.Checked = true;
            }

            if (setActive)
            {
                UseDeck(deck);
            }
            DeckPickerList.SelectDeck(deck);
            UpdateDeckList(deck);
            ManaCurveMyDecks.SetDeck(deck);
            UpdatePanelVersionComboBox(deck);
            GroupBoxHsReplayDeckInfo.Visibility = deck?.IsArenaDeck == true ? Collapsed : Visible;
            if (setActive)
            {
                Core.Overlay.ListViewPlayer.Items.Refresh();
                Core.Windows.PlayerWindow.ListViewPlayer.Items.Refresh();
            }
            DeckManagerEvents.OnDeckSelected.Execute(deck);
        }
コード例 #26
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;
                        }
                    }
                    if (Core.Initialized)
                    {
                        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;
            }

            if (setActive)
            {
                UseDeck(deck);
            }
            DeckPickerList.SelectDeck(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);
        }