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);
            }
        }
예제 #2
0
        private void SelectedDeckChanged(DeckPicker sender, Deck deck)
        {
            if (!_initialized)
            {
                return;
            }
            if (deck != null)
            {
                //set up notes
                Helper.MainWindow.DeckNotesEditor.SetDeck(deck);
                var flyoutHeader = deck.Name.Length >= 20 ? string.Join("", deck.Name.Take(17)) + "..." : deck.Name;
                Helper.MainWindow.FlyoutNotes.Header       = flyoutHeader;
                Helper.MainWindow.FlyoutDeckOptions.Header = flyoutHeader;
                Helper.MainWindow.FlyoutDeckStats.Header   = "Stats: " + deck.Name;
                Helper.MainWindow.DeckStatsFlyout.SetDeck(deck);

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

                //set and save last used deck for class
                while (Helper.MainWindow.DeckList.LastDeckClass.Any(ldc => ldc.Class == deck.Class))
                {
                    var lastSelected = Helper.MainWindow.DeckList.LastDeckClass.FirstOrDefault(ldc => ldc.Class == deck.Class);
                    if (lastSelected != null)
                    {
                        Helper.MainWindow.DeckList.LastDeckClass.Remove(lastSelected);
                    }
                    else
                    {
                        break;
                    }
                }
                Helper.MainWindow.DeckList.LastDeckClass.Add(new DeckInfo {
                    Class = deck.Class, Name = deck.Name
                });
                Helper.MainWindow.WriteDecks();
                Helper.MainWindow.EnableDeckButtons(true);
                Helper.MainWindow.ManaCurveMyDecks.SetDeck(deck);
                Helper.MainWindow.TagControlMyDecks.SetSelectedTags(deck.Tags);
            }
            else
            {
                Helper.MainWindow.EnableDeckButtons(false);
            }
        }
예제 #3
0
		private void DeckPickerList_OnSelectedDeckChanged(DeckPicker sender, Deck deck)
		{
			if(!_initialized) return;
			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();
				MenuItemEdit.IsEnabled = true;
				MenuItemExport.IsEnabled = true;
				ManaCurveMyDecks.SetDeck(deck);
				TagControlEdit.SetSelectedTags(deck.Tags);
			}
			else
			{
				MenuItemEdit.IsEnabled = false;
				MenuItemExport.IsEnabled = false;
			}
		}
		private void DeckPickerListOnSelectedDeckChanged(DeckPicker sender, Deck deck)
		{
			if (!_initialized) return;
			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;
				FlyoutDeckOptions.Header = flyoutHeader;

				//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();
				EnableDeckButtons(true);
				ManaCurveMyDecks.SetDeck(deck);
				TagControlMyDecks.SetSelectedTags(deck.Tags);
			}
			else
			{
				EnableDeckButtons(false);
			}
		}
        private void SelectedDeckChanged(DeckPicker sender, Deck deck)
        {
            if(!_initialized) return;
            if(deck != null)
            {
                //set up notes
                Helper.MainWindow.DeckNotesEditor.SetDeck(deck);
                var flyoutHeader = deck.Name.Length >= 20 ? string.Join("", deck.Name.Take(17)) + "..." : deck.Name;
                Helper.MainWindow.FlyoutNotes.Header = flyoutHeader;
                Helper.MainWindow.FlyoutDeckOptions.Header = flyoutHeader;
                if(Config.Instance.StatsInWindow)
                {
                    Helper.MainWindow.StatsWindow.Title = "Stats: " + deck.Name;
                    Helper.MainWindow.StatsWindow.StatsControl.SetDeck(deck);
                }
                else
                {
                    Helper.MainWindow.FlyoutDeckStats.Header = "Stats: " + deck.Name;
                    Helper.MainWindow.DeckStatsFlyout.SetDeck(deck);
                }

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

                //set and save last used deck for class
                while(Helper.MainWindow.DeckList.LastDeckClass.Any(ldc => ldc.Class == deck.Class))
                {
                    var lastSelected = Helper.MainWindow.DeckList.LastDeckClass.FirstOrDefault(ldc => ldc.Class == deck.Class);
                    if(lastSelected != null)
                        Helper.MainWindow.DeckList.LastDeckClass.Remove(lastSelected);
                    else
                        break;
                }
                Helper.MainWindow.DeckList.LastDeckClass.Add(new DeckInfo {Class = deck.Class, Name = deck.Name});
                Helper.MainWindow.WriteDecks();
                Helper.MainWindow.EnableDeckButtons(true);
                Helper.MainWindow.ManaCurveMyDecks.SetDeck(deck);
                Helper.MainWindow.TagControlMyDecks.SetSelectedTags(deck.Tags);
            }
            else
                Helper.MainWindow.EnableDeckButtons(false);
        }