public void MoveCardToTarget(CardView card, CardContainer target, List <Task <object> > taskList, double animationDuration = Double.MaxValue, bool rotate = false, bool transferCard = true) { if (animationDuration == Double.MaxValue) { animationDuration = MainPage.AnimationSpeeds.Medium; } Point ptTo = SetupCardForMove(card, target, rotate, transferCard); card.AnimateToTaskList(ptTo, rotate, animationDuration, taskList); if (transferCard) { this.UpdateCardLayout(taskList); } }
public void MoveCardToTarget(List <Task <object> > taskList, CardView card, CardContainer target, double animationDuration = Double.MaxValue, bool rotate = false, bool transferCard = true) { if (this.Items.Contains(card) == false) { //Debug.WriteLine("Attempting to move Card {0} from {1} to {2} and it is not in {1}", card.CardName, this.FriendlyName, target.FriendlyName); return; } if (animationDuration == Double.MaxValue) { animationDuration = MainPage.AnimationSpeeds.Medium; } Point ptTo = SetupCardForMove(card, target, rotate, transferCard); card.AnimateToTaskList(ptTo, rotate, animationDuration, taskList); }
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()); } }
public void UpdateCardLayout(List <Task <object> > taskList, double animationDuration = Double.MaxValue, bool rotate = false) { if (animationDuration == Double.MaxValue) { animationDuration = 50; } if (this.Items.Count == 0) { return; } 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 (rotate) { card.AnimateRotation += 360; } if (_layout == CardLayout.PlayedOverlapped) { Canvas.SetZIndex(card, prevZIndex++); } } this.UpdateLayout(); }