Exemplo n.º 1
0
 public void MoveAllCardsTo(CardCollectionBase collection)
 {
     // TODO: add check for move to self
     while (this.Cards.Count > 0)
     {
         this.Cards.First.Value.moveTo(collection);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// moves the current Card to the specified collection
 /// </summary>
 /// <param name="collection">the targeted collection</param>
 /// <param name="position">position at which the card should be inserted</param>
 public void moveTo(CardCollectionBase collection, int position)
 {
     if (this.collection != null)
     {
         this.collection.PerformMoveFrom();
         this.collection.RemoveCard(this);
         this.collection.PerformMovedFrom();
     }
     collection.PerformMoveTo();
     this.collection = collection;
     this.collection.AddCard(this, position);
     this.collection.PerformMovedTo();
 }
Exemplo n.º 3
0
        // Initializer
        private void Init(T type, CardCollectionBase collection)
        {
            if (type is null)
            {
                throw new ArgumentNullException("type");
            }
            if (collection is null)
            {
                throw new ArgumentNullException("collection");
            }

            this.Type = type;
            this.moveTo(collection);
        }
Exemplo n.º 4
0
 public void moveTo(CardCollectionBase collection)
 {
     this.moveTo(collection, 0);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Generates a new Card with a given type
 /// </summary>
 /// <param name="name">name of the new card</param>
 /// <param name="type">type of the new card</param>
 public Card(T type, CardCollectionBase collection)
 {
     Init(type, collection);
 }