public async Task MoveAllCardsToTarget(CardContainer target, MoveCardOptions moveOptions = MoveCardOptions.MoveAllAtSameTime, double animationDuration = Double.MaxValue, bool rotate = false, bool transferCard = true)
        {
            if (moveOptions == MoveCardOptions.MoveAllAtSameTime)
            {
                List <Task <object> > localList = new List <Task <object> >();
                MoveAllCardsToTarget(target, localList, animationDuration, rotate, transferCard);
                await Task.WhenAll(localList);

                return;
            }

            for (int i = this.Items.Count - 1; i >= 0; i--)
            {
                CardView card = this.Items[i];
                await MoveCardToTarget(card, target, animationDuration, rotate, transferCard);
            }
        }
        public async Task UpdateCardLayout(MoveCardOptions options, List <Task <object> > tasks, double animationDuration, bool rotate)
        {
            if (animationDuration == Double.MaxValue)
            {
                animationDuration = 250;
            }

            if (this.Items.Count == 0)
            {
                return;
            }

            bool localWhenAll = false;
            List <Task <object> > taskList = tasks;

            if (tasks == null && options == MoveCardOptions.MoveAllAtSameTime)
            {
                localWhenAll = true;
                taskList     = new List <Task <object> >();
            }

            int prevZIndex = Canvas.GetZIndex(this.Items[0]);

            for (int i = 0; i < this.Items.Count; i++)
            {
                CardView         card = this.Items[i];
                GeneralTransform gt   = this.TransformToVisual(card);
                Point            ptTo = gt.TransformPoint(this.GetCardTopLeft(i));
                card.AnimationPosition = ptTo;
                card.AnimateToTaskList(ptTo, false, animationDuration, taskList);
                if (_layout == CardLayout.PlayedOverlapped)
                {
                    Canvas.SetZIndex(card, prevZIndex++);
                }
            }

            if (options == MoveCardOptions.MoveAllAtSameTime && localWhenAll)
            {
                await Task.WhenAll(taskList);
            }
            else if (options == MoveCardOptions.MoveOneAtATime)
            {
                Task.WaitAll(taskList.ToArray());
            }
        }