Ejemplo n.º 1
0
        private Boolean SendToFoundation( Container container ) {
            var last = container.GetLast();

            // need to have a list to work with the 'canDrop' function
            var cards = new List<Card> { last };

            foreach ( var foundation in this._foundations.Where( foundation => foundation.CanDrop( cards ) ) ) {
                this.MoveCards( cards, foundation );
                this.CheckGameEnd();
                return true;
            }

            return false;
        }
Ejemplo n.º 2
0
        private void MoveCards( List<Card> cards, Container container ) {
            if ( this._drag.HighlightedContainer != null ) {
                this._drag.HighlightedContainer.RemoveDropEffect();
                this._drag.HighlightedContainer = null;
            }

            foreach ( var card in cards ) {
                var parent = card.Parent as Panel;
                parent.Children.Remove( card );
                container.Children.Add( card );
            }

            this._drag.OriginalContainer = null;
            this._drag.CardsDragging.Clear();
            this._drag.IsDragging = false;
        }