Esempio n. 1
0
        /// <summary>
        /// Обновить вид таблицы.
        /// </summary>
        public void RefreshView()
        {
            List <Card> cards = _tableau.GetList();

            for (int i = 0; i < cards.Count; i++)
            {
                var card = cards[i];

                CardView cardView;
                if (i < _cardViews.Count)
                {
                    cardView      = _cardViews[i];
                    cardView.Card = card;
                }
                else
                {
                    cardView = new CardView();
                    AddCard(cardView, card, i);
                    cardView.Animate(CardView.AnimFadeIn);
                }
            }
            // Удаляем лишнее
            for (int i = _cardViews.Count - 1; i >= cards.Count; i--)
            {
                CardView v = _cardViews[i];
                RootView.Children.Remove(v);
                _cardViews.Remove(v);
            }
        }
Esempio n. 2
0
        public void SetTableau(Tableau tableau)
        {
            this._tableau = tableau;

            List <Card> cards = tableau.GetList();

            RootView.Children.Add(Util.CreateCardPlace('K'));
            for (int i = 0; i < cards.Count; i++)
            {
                var card     = cards[i];
                var cardView = new CardView();
                AddCard(cardView, card, i);
            }
        }