private void ButtonUseDeck_Click(object sender, RoutedEventArgs e) { if (ComboBoxDecks.SelectedItem.ToString() == "Create New") { MessageBox.Show("Save and/or select a deck first"); return; } if (BtnSaveDeck.Content.ToString().Contains("*")) { if ( MessageBox.Show("Save deck first?", "Deck not saved", MessageBoxButton.YesNo, MessageBoxImage.Asterisk) == MessageBoxResult.Yes) { SaveDeck(); } } var firstOrDefault = _deckList.DecksList.FirstOrDefault(x => x.Name != null && x.Name.Equals(ComboBoxDecks.SelectedItem.ToString())); if (firstOrDefault != null) { var deck = firstOrDefault.Cards; if (deck != null) { Dispatcher.BeginInvoke(new Action(() => { _hearthstone.PlayerHandCount = 0; _hearthstone.EnemyCards.Clear(); _hearthstone.EnemyHandCount = 0; })); _hearthstone.SetPremadeDeck(deck); _logReader.Reset(); // _previousSize = 0; } } }
private void UseDeck(Deck selected) { if (selected == null) { return; } _hearthstone.SetPremadeDeck(selected.Cards); _overlay.Dispatcher.BeginInvoke(new Action(_overlay.SortViews)); Dispatcher.BeginInvoke(new Action(() => { _hearthstone.PlayerHandCount = 0; _hearthstone.EnemyCards.Clear(); _hearthstone.EnemyHandCount = 0; })); _logReader.Reset(false); }