Пример #1
0
        public void Dispose()
        {
            touchForwarder.Enabled = true;

            closeButton.TouchUpInside -= HandleTouchUpInside;

            if (animationComplete != null)
            {
                animationComplete.Dispose();
                animationComplete = null;
            }

            indicatorView.RemoveFromSuperview();
            indicatorView.Dispose();
            webView.LoadFinished -= HandleLoadFinished;
            webView.RemoveFromSuperview();
            webView.Dispose();
            webView = null;
            closeButton.RemoveFromSuperview();
            closeButton.Dispose();
            closeButton = null;
            view.RemoveFromSuperview();
            view.Dispose();
            view = null;
        }
Пример #2
0
        public static void MoveWithRotationAndFadeOut(FrameworkElement element, Point to, double rotationAngle, double seconds, AnimationCompletedDelegate callback)
        {
            TransformGroup transformGroup = new TransformGroup();
            transformGroup.Children.Add(new RotateTransform(rotationAngle, element.Width / 2, element.Height / 2));

            Duration duration = new Duration(TimeSpan.FromSeconds(seconds));
            DoubleAnimation animationX = new DoubleAnimation(to.X, duration);
            DoubleAnimation animationY = new DoubleAnimation(to.Y, duration);
            DoubleAnimation fadeOutAnimation = new DoubleAnimation
            {
                From = 1,
                To = 0.4,
                Duration = duration,
                FillBehavior = FillBehavior.Stop
            };

            animationX.Completed += (sender, _) => callback(sender, _);

            TranslateTransform trans = new TranslateTransform();
            element.RenderTransform = transformGroup;

            trans.BeginAnimation(TranslateTransform.XProperty, animationX);
            trans.BeginAnimation(TranslateTransform.YProperty, animationY);

            element.Opacity = 0.4;
            element.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation);
            transformGroup.Children.Add(trans);
        }
Пример #3
0
 public FloatingLayoutContainer(UpdateTimer mainTimer, LayoutContainer childLayout, float animationDuration, AnimationCompletedDelegate animationComplete)
 {
     this.mainTimer         = mainTimer;
     this.childLayout       = childLayout;
     this.animationDuration = animationDuration;
     this.animationComplete = animationComplete;
 }
Пример #4
0
 public static void Move(DependencyProperty dependencyProperty, UIElement element, double from, double to, double seconds, AnimationCompletedDelegate callback)
 {
     DoubleAnimation moveAnimation = new DoubleAnimation
     {
         From = from,
         To = to,
         Duration = new Duration(TimeSpan.FromSeconds(seconds))
     };
     if (callback != null)
     {
         moveAnimation.Completed += (sender, _) => callback(sender, _);
     }
     if (element.RenderTransform == null)
     {
         element.RenderTransform = new TranslateTransform();
     }
     element.RenderTransform.BeginAnimation(dependencyProperty, moveAnimation);
 }
Пример #5
0
        void HandleTouchUpInside(object sender, EventArgs e)
        {
            closeButton.TouchUpInside -= HandleTouchUpInside;

            CGRect frame = view.Frame;

            frame.Y = frame.Height;

            UIView.BeginAnimations("slideAnimation");
            UIView.SetAnimationDuration(AnimationDuration);
            UIView.SetAnimationCurve(UIViewAnimationCurve.EaseIn);
            UIView.SetAnimationRepeatCount(0);
            UIView.SetAnimationRepeatAutoreverses(false);
            animationComplete = new AnimationCompletedDelegate(this);
            UIView.SetAnimationDelegate(animationComplete);
            UIView.SetAnimationDidStopSelector(new Selector("slideAnimationFinished"));

            view.Frame = frame;

            UIView.CommitAnimations();
        }
Пример #6
0
        public static void MoveWithRotationAndFadeOut(FrameworkElement element, Point to, double rotationAngle, double seconds, AnimationCompletedDelegate callback)
        {
            TransformGroup transformGroup = new TransformGroup();

            transformGroup.Children.Add(new RotateTransform(rotationAngle, element.Width / 2, element.Height / 2));

            Duration        duration         = new Duration(TimeSpan.FromSeconds(seconds));
            DoubleAnimation animationX       = new DoubleAnimation(to.X, duration);
            DoubleAnimation animationY       = new DoubleAnimation(to.Y, duration);
            DoubleAnimation fadeOutAnimation = new DoubleAnimation
            {
                From         = 1,
                To           = 0.4,
                Duration     = duration,
                FillBehavior = FillBehavior.Stop
            };

            animationX.Completed += (sender, _) => callback(sender, _);

            TranslateTransform trans = new TranslateTransform();

            element.RenderTransform = transformGroup;

            trans.BeginAnimation(TranslateTransform.XProperty, animationX);
            trans.BeginAnimation(TranslateTransform.YProperty, animationY);

            element.Opacity = 0.4;
            element.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation);
            transformGroup.Children.Add(trans);
        }
Пример #7
0
 public static void Move(UIElement element, Point from, Point to, double seconds, AnimationCompletedDelegate callback)
 {
     Move(TranslateTransform.XProperty, element, from.X, to.X, seconds, null);
     Move(TranslateTransform.YProperty, element, from.Y, to.Y, seconds, callback);
 }
Пример #8
0
        public static void Move(DependencyProperty dependencyProperty, UIElement element, double from, double to, double seconds, AnimationCompletedDelegate callback)
        {
            DoubleAnimation moveAnimation = new DoubleAnimation
            {
                From     = from,
                To       = to,
                Duration = new Duration(TimeSpan.FromSeconds(seconds))
            };

            if (callback != null)
            {
                moveAnimation.Completed += (sender, _) => callback(sender, _);
            }
            if (element.RenderTransform == null)
            {
                element.RenderTransform = new TranslateTransform();
            }
            element.RenderTransform.BeginAnimation(dependencyProperty, moveAnimation);
        }
Пример #9
0
        public static void Opacity(UIElement element, double from, double to, double seconds, AnimationCompletedDelegate callback)
        {
            DoubleAnimation fadeOutAnimation = new DoubleAnimation
            {
                From         = from,
                To           = to,
                Duration     = new Duration(TimeSpan.FromSeconds(seconds)),
                FillBehavior = FillBehavior.Stop
            };

            element.Opacity = to;
            if (callback != null)
            {
                fadeOutAnimation.Completed += (sender, _) => callback(sender, _);
            }
            element.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation);
        }
Пример #10
0
 public static void Opacity(UIElement element, double from, double to, double seconds, AnimationCompletedDelegate callback)
 {
     DoubleAnimation fadeOutAnimation = new DoubleAnimation
     {
         From = from,
         To = to,
         Duration = new Duration(TimeSpan.FromSeconds(seconds)),
         FillBehavior = FillBehavior.Stop
     };
     element.Opacity = to;
     if (callback != null)
     {
         fadeOutAnimation.Completed += (sender, _) => callback(sender, _);
     }
     element.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation);
 }
Пример #11
0
 public static void Move(UIElement element, Point from, Point to, double seconds, AnimationCompletedDelegate callback)
 {
     Move(TranslateTransform.XProperty, element, from.X, to.X, seconds, null);
     Move(TranslateTransform.YProperty, element, from.Y, to.Y, seconds, callback);
 }