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