Esempio n. 1
0
        private void ScatterCards(List <CardView> cards, double animationTime, List <Task <object> > taskList)
        {
            if (cards.Count == 0)
            {
                Debug.Assert(false, "Called ScatterCards before AddCardsToGrid");
                return;
            }

            Rect   rect          = Window.Current.Bounds;
            Rect   scatterBounds = ViewCallback.ScatterBounds();
            double width         = rect.Width - cards[0].ActualWidth;
            double height        = rect.Height - cards[0].ActualHeight;
            Random rand          = new Random((int)DateTime.Now.Ticks & 0x0000FFFF);
            Point  ptRand;

            foreach (CardView card in cards)
            {
                do
                {
                    ptRand = new Point(rand.NextDouble() * width, rand.NextDouble() * height);
                } while (!scatterBounds.Contains(ptRand));

                card.AnimateToTaskList(ptRand, true, animationTime, taskList);
            }
        }
Esempio n. 2
0
 public Rect ScatterBounds()
 {
     return(ViewCallback.ScatterBounds());
 }