private void AddItem(CardViewModel card) { Button button = new Button () { Text = card.Name }; button.Clicked += (object sender2, EventArgs e2) => this.gamePageModel.InvokeCard (card); ViewModelDispatcher.BeginInvoke (new Action (() => { this.stackLayout.Children.Add (button); })); this.mapper [card] = button; }
private void RemoveItem(CardViewModel card) { Button button; if (this.mapper.TryGetValue (card, out button)) { this.mapper.Remove (card); ViewModelDispatcher.BeginInvoke (new Action (() => { this.stackLayout.Children.Remove (button); })); } }
private void ShowCardDetails(CardViewModel card) { if (card != null) { this.CardDetailsPopup.DataContext = card.CardInfo; this.CardDetailsPopup.Visibility = Visibility.Visible; } }
public CustomCardSet(IEnumerable<CardViewModel> cards, CardViewModel bane) { base.cardCollection = new ObservableCollection<CardModel>(); foreach (CardViewModel c in cards) { base.cardCollection.Add(c.CardModel); } if (bane != null) { this.BaneCard = bane.CardModel; } }
private void InsertSorted(ObservableCollection<CardViewModel> collection, CardViewModel card) { for (int i = 0; i < collection.Count; i++) { if (string.Compare(collection[i].Name, card.Name) > 0) { collection.Insert(i, card); return; } } collection.Add(card); }
public ItemBoughtEventArgs(CardViewModel purchasedCardID, PlayerViewModel purchasingPlayer) { this.PurchasedCard = purchasedCardID; this.PurchasingPlayer = purchasingPlayer; }
public void PerformUIPlayerAction(ActionType actionType, CardViewModel card, PileViewModel pile) { this.uiRequestAction = new PlayerAction(); this.uiRequestAction.ActionType = actionType; this.uiRequestAction.Card = card != null ? card.CardModel : null; this.uiRequestAction.Pile = pile != null ? pile.PileModel : null; this.state = ClientState.WaitingForOpponent; this.uiPlayerActionWaitHandle.Set(); }