private async Task AnimateAllCardsBackToDeck(double duration = Double.MaxValue) { CountControl.Hide(); if (duration == Double.MaxValue) { duration = MainPage.AnimationSpeeds.Medium; } // flip the cards and then move them for a nice affect List <Task <object> > list = new List <Task <object> >(); GridPlayer.FlipAllCards(CardOrientation.FaceDown, list); GridPlayer.MoveAllCardsToTarget(GridDeck, list, duration); GridCrib.FlipAllCards(CardOrientation.FaceDown, list); GridCrib.MoveAllCardsToTarget(GridDeck, list, duration); GridPlayedCards.FlipAllCards(CardOrientation.FaceDown, list); GridPlayedCards.MoveAllCardsToTarget(GridDeck, list, duration); GridComputer.FlipAllCards(CardOrientation.FaceDown, list); GridComputer.MoveAllCardsToTarget(GridDeck, list, duration); foreach (CardView card in GridDeck.Items) { card.Reset(); } GridDeck.UpdateCardLayout(list, duration, false); await Task.WhenAll(list); }
private async Task AnimateCribCardsToOwner(PlayerType owner) { CardContainer cribOwner = GridPlayer; if (owner == PlayerType.Computer) { cribOwner = GridComputer; } List <Task <Object> > tasks = new List <Task <object> >(); // // return player and computer cards to the deck GridPlayer.FlipAllCards(CardOrientation.FaceDown, tasks); GridPlayer.MoveAllCardsToTarget(GridDeck, tasks, MainPage.AnimationSpeeds.Medium, true); GridComputer.FlipAllCards(CardOrientation.FaceDown, tasks); GridComputer.MoveAllCardsToTarget(GridDeck, tasks, MainPage.AnimationSpeeds.Medium, true); // // move crib cards back to player GridCrib.MoveAllCardsToTarget(cribOwner, tasks, MainPage.AnimationSpeeds.Medium, true); cribOwner.FlipAllCards(CardOrientation.FaceUp, tasks); await Task.WhenAll(tasks); }