private void RemoveResultCard(object sender, SearchCardIdEventArgs e) { _unsaved = true; Deck.Element element = ActiveSection.Cards.FirstOrDefault(c => c.Card.Id == e.CardId); if (element == null) { return; } element.Quantity -= 1; if (element.Quantity == 0) { ActiveSection.Cards.Remove(element); } }
private void RemoveResultCard(object sender, SearchCardIdEventArgs e) { _unsaved = true; var element = ActiveSection.Cards.FirstOrDefault(c => c.Id == e.CardId); if (element == null) { return; } element.Quantity -= 1; if (element.Quantity <= 0) { ActiveSection.Cards.RemoveCard(element); } this.InvalidateVisual(); }
private void AddResultCard(object sender, SearchCardIdEventArgs e) { _unsaved = true; var element = ActiveSection.Cards.FirstOrDefault(c => c.Id == e.CardId); if (element != null) { element.Quantity += 1; } else { var card = Game.GetCardById(e.CardId); ActiveSection.Cards.AddCard(card.ToMultiCard()); this.InvalidateVisual(); } }
private void AddResultCard(object sender, SearchCardIdEventArgs e) { _unsaved = true; Deck.Element element = ActiveSection.Cards.FirstOrDefault(c => c.Card.Id == e.CardId); if (element != null) { element.Quantity += 1; } else { CardModel Card = Game.GetCardById(e.CardId); if (Card.isDependent()) { MessageBox.Show("Unable to add " + Card.Name + "to the deck. It is marked as dependent, which implies it is the alternate version of another card. Please try to add the original instead.", "Warning: Add dependent card failed.", MessageBoxButton.OK); } ActiveSection.Cards.Add(new Deck.Element { Card = Game.GetCardById(e.CardId), Quantity = 1 }); } }
private void RemoveResultCard(object sender, SearchCardIdEventArgs e) { _unsaved = true; Deck.Element element = ActiveSection.Cards.FirstOrDefault(c => c.Card.Id == e.CardId); if (element == null) return; element.Quantity -= 1; if (element.Quantity == 0) ActiveSection.Cards.Remove(element); }
private void AddResultCard(object sender, SearchCardIdEventArgs e) { _unsaved = true; Deck.Element element = ActiveSection.Cards.FirstOrDefault(c => c.Card.Id == e.CardId); if (element != null) element.Quantity += 1; else { CardModel Card = Game.GetCardById(e.CardId); if (Card.isDependent()) { MessageBox.Show("Unable to add " + Card.Name + "to the deck. It is marked as dependent, which implies it is the alternate version of another card. Please try to add the original instead.", "Warning: Add dependent card failed.", MessageBoxButton.OK); } ActiveSection.Cards.Add(new Deck.Element { Card = Game.GetCardById(e.CardId), Quantity = 1 }); } }
private void AddResultCard(object sender, SearchCardIdEventArgs e) { unsaved = true; var element = ActiveSection.Cards.FirstOrDefault(c => c.Card.Id == e.CardId); if (element != null) element.Quantity += 1; else ActiveSection.Cards.Add(new Deck.Element { Card = Game.GetCardById(e.CardId), Quantity = 1 }); }