コード例 #1
0
        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;
        }
コード例 #2
0
        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);

                }));
            }
        }
コード例 #3
0
ファイル: GamePage.xaml.cs プロジェクト: alanjg/MajorDomo
 private void ShowCardDetails(CardViewModel card)
 {
     if (card != null)
     {
         this.CardDetailsPopup.DataContext = card.CardInfo;
         this.CardDetailsPopup.Visibility = Visibility.Visible;
     }
 }
コード例 #4
0
ファイル: CardSetViewModel.cs プロジェクト: alanjg/MajorDomo
 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;
     }
 }
コード例 #5
0
ファイル: CardSetViewModel.cs プロジェクト: alanjg/MajorDomo
 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);
 }
コード例 #6
0
ファイル: GameViewModel.cs プロジェクト: alanjg/MajorDomo
 public ItemBoughtEventArgs(CardViewModel purchasedCardID, PlayerViewModel purchasingPlayer)
 {
     this.PurchasedCard = purchasedCardID;
     this.PurchasingPlayer = purchasingPlayer;
 }
コード例 #7
0
ファイル: GameViewModel.cs プロジェクト: alanjg/MajorDomo
 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();
 }