public MainWindow()
        {
            InitializeComponent();
            Trace.Listeners.Add(new TextBoxTraceListener(Options.OptionsTrackerLogging.TextBoxLog));
            EnableMenuItems(false);
            TagControlEdit.StackPanelFilterOptions.Visibility       = Collapsed;
            TagControlEdit.GroupBoxSortingAllConstructed.Visibility = Collapsed;
            TagControlEdit.GroupBoxSortingArena.Visibility          = Collapsed;
            SortFilterDecksFlyout.HideStuffToCreateNewTag();
            FlyoutNotes.ClosingFinished += (sender, args) => DeckNotesEditor.SaveDeck();
            WarningFlyout.OnComplete    += () =>
            {
                FlyoutWarnings.IsOpen = false;
                Config.Instance.CheckConfigWarnings();
            };
#if (DEBUG)
            Title += " [DEBUG]";
#endif
#if (DEV)
            StatusBarDev.Visibility = Visible;
#endif
            Config.Instance.OnConfigWarning += warning =>
            {
                WarningFlyout.SetConfigWarning(warning);
                FlyoutWarnings.IsOpen = true;
            };
            Config.Instance.CheckConfigWarnings();
        }
        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);
            }
        }
        public MainWindow()
        {
            InitializeComponent();
            Trace.Listeners.Add(new TextBoxTraceListener(Options.OptionsTrackerLogging.TextBoxLog));
            TagControlEdit.StackPanelFilterOptions.Visibility       = Collapsed;
            TagControlEdit.GroupBoxSortingAllConstructed.Visibility = Collapsed;
            TagControlEdit.GroupBoxSortingArena.Visibility          = Collapsed;
            SortFilterDecksFlyout.HideStuffToCreateNewTag();
            FlyoutNotes.ClosingFinished += (sender, args) => DeckNotesEditor.SaveDeck();
            WarningFlyout.OnComplete    += () =>
            {
                FlyoutWarnings.IsOpen = false;
                Config.Instance.CheckConfigWarnings();
            };
#if (DEBUG)
            Title += " [DEBUG]";
#endif
#if (DEV)
            StatusBarDev.Visibility = Visible;
#endif
            Config.Instance.OnConfigWarning += warning =>
            {
                WarningFlyout.SetConfigWarning(warning);
                FlyoutWarnings.IsOpen = true;
            };
            Config.Instance.CheckConfigWarnings();

            HsReplayDataManager.Decks.OnLoaded += () =>
            {
                DeckPickerList.RefreshDisplayedDecks();
                OnPropertyChanged(nameof(HsReplayButtonVisibility));
                Influx.OnHsReplayDataLoaded();
            };
        }
Esempio n. 4
0
 public MainWindow()
 {
     InitializeComponent();
     Trace.Listeners.Add(new TextBoxTraceListener(Options.OptionsTrackerLogging.TextBoxLog));
     EnableMenuItems(false);
     TagControlEdit.StackPanelFilterOptions.Visibility       = Collapsed;
     TagControlEdit.GroupBoxSortingAllConstructed.Visibility = Collapsed;
     TagControlEdit.GroupBoxSortingArena.Visibility          = Collapsed;
     SortFilterDecksFlyout.HideStuffToCreateNewTag();
     FlyoutNotes.ClosingFinished += (sender, args) => DeckNotesEditor.SaveDeck();
 }
        internal void ShowDeckNotesDialog(Deck deck)
        {
            if (deck == null)
            {
                return;
            }
            DeckNotesEditor.SetDeck(deck);
            var flyoutHeader = deck.Name.Length >= 20 ? string.Join("", deck.Name.Take(17)) + "..." : deck.Name;

            FlyoutNotes.Header = flyoutHeader;
            FlyoutNotes.IsOpen = true;
        }
        public MainWindow()
        {
            InitializeComponent();
            TagControlEdit.StackPanelFilterOptions.Visibility       = Collapsed;
            TagControlEdit.GroupBoxSortingAllConstructed.Visibility = Collapsed;
            TagControlEdit.GroupBoxSortingArena.Visibility          = Collapsed;
            SortFilterDecksFlyout.HideStuffToCreateNewTag();
            FlyoutNotes.ClosingFinished += (sender, args) => DeckNotesEditor.SaveDeck();
            WarningFlyout.OnComplete    += () =>
            {
                FlyoutWarnings.IsOpen = false;
                Config.Instance.CheckConfigWarnings();
            };
#if (DEBUG)
            Title += " [DEBUG]";
#endif
#if (DEV)
            StatusBarDev.Visibility = Visible;
#endif
            Config.Instance.OnConfigWarning += warning =>
            {
                WarningFlyout.SetConfigWarning(warning);
                FlyoutWarnings.IsOpen = true;
            };
            Config.Instance.CheckConfigWarnings();

            HsReplayDataManager.Decks.OnLoaded += () =>
            {
                DeckPickerList.RefreshDisplayedDecks();
                OnPropertyChanged(nameof(HsReplayButtonVisibility));
                Influx.OnHsReplayDataLoaded();
            };

            HSReplayNetOAuth.Authenticated += ActivateWindow;

            RemoteConfig.Instance.Loaded += data =>
            {
                OnPropertyChanged(nameof(CollectionSyncingBannerVisbiility));
                OnPropertyChanged(nameof(CollectionSyncingBannerRemovable));
            };

            HSReplayNetHelper.CollectionUploaded += () =>
            {
                OnPropertyChanged(nameof(CollectionSyncingBannerRemovable));
            };

            HSReplayNetOAuth.LoggedOut += () =>
            {
                OnPropertyChanged(nameof(CollectionSyncingBannerVisbiility));
                OnPropertyChanged(nameof(CollectionSyncingBannerRemovable));
            };
        }
Esempio n. 7
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);
        }