private void Create_Click(object sender, RoutedEventArgs e) { List<Card> cards = _selectedCards.Select(x => { var cardInfo = Library.GetCardInfo(x.Name); return new Card(cardInfo.Item1, cardInfo.Item2, x.Count); }).ToList(); Deck deck = new Deck(this.deckName.Text, cards); _callback(deck); this.Close(); }
private void InitializeDeck(string deckName) { // Clone instead so we don't have to reset state? if (currentDeck != null) currentDeck.Reset(); currentDeck = deckCollection.GetDeck(deckName); this.Dispatcher.Invoke((Action)(() => { this.cardCollection.ItemsSource = currentDeck.Cards; this.deckControl.ItemsSource = new List<Deck> { currentDeck }; })); }
public void AddDeck(Deck deck) { _collection[deck.Name] = deck; }