Beispiel #1
0
        public static void Animate(this FrameworkElement target, int[] times, double maxWidth, double maxHeight, bool autoReverse = true)
        {
            var top  = Canvas.GetTop(target);
            var left = Canvas.GetLeft(target);

            // var storyboards = new List<Storyboard>();
            foreach (var time in times)
            {
                var storyboard = new Storyboard {
                    AutoReverse = autoReverse, RepeatBehavior = RepeatBehavior.Forever
                };
                target.Animate(storyboard, time, top, ops[random.Next(2)](top, time, maxHeight), "(Canvas.Top)");
                target.Animate(storyboard, time, left, ops[random.Next(2)](left, time, maxWidth), "(Canvas.Left)");
                storyboard.Begin();
                // target.Tapped += (sender, e) =>
                // {
                //     if (target.Tag.Equals(Playing))
                //     {
                //         target.Tag = Paused;
                //         storyboard.Pause();
                //     }
                //     else
                //     {
                //         target.Tag = Playing;
                //         storyboard.Resume();
                //     }
                // };
                // storyboards.Add(storyboard);
            }

            // target.Tag = storyboards;
        }
 private void ShowPhotoEditor(int photoSeqNo)
 {
     this.imageEditor.Show(this.VM.TotalCount, this.VM.AlbumId, this.VM.TotalCount - photoSeqNo - 1, (int ind) => Enumerable.FirstOrDefault <FrameworkElement>(this.GetPhotoById(ind)) as Image, delegate(int ind, bool show)
     {
         List <FrameworkElement> photoById = this.GetPhotoById(ind);
         FrameworkElement frameworkElement = Enumerable.FirstOrDefault <FrameworkElement>(photoById);
         if (frameworkElement != null)
         {
             frameworkElement.Opacity = ((double)(show ? 1 : 0));
         }
         if (photoById.Count > 1)
         {
             using (IEnumerator <FrameworkElement> enumerator = Enumerable.Skip <FrameworkElement>(photoById, 1).GetEnumerator())
             {
                 while (enumerator.MoveNext())
                 {
                     FrameworkElement current = enumerator.Current;
                     current.Animate(current.Opacity, (double)(show ? 1 : 0), UIElement.OpacityProperty, 150, new int?(0), null, null);
                 }
             }
         }
     }, this);
 }
        private void Banner_ImageOpened(object sender, RoutedEventArgs e)
        {
            FrameworkElement elemet = sender as FrameworkElement;

            elemet.Animate(0, 1, "Opacity", 600, new int?());
        }