Esempio n. 1
0
        private void SetupAnimationBounds(AdSlideDirection adSlideDirection)
        {
            if (AdRotatorRoot != null)
            {
#if WINDOWS_PHONE
                var bounds = AdRotatorControl.DisplayResolution;
#else
                var bounds = Window.Current.Bounds;
#endif
                switch (adSlideDirection)
                {
                case AdSlideDirection.Left:
                    ((DoubleAnimation)SlideOutLRAdStoryboard.Children[0]).To  = -(bounds.Width * 2);
                    ((DoubleAnimation)SlideInLRAdStoryboard.Children[0]).From = -(bounds.Width * 2);
                    break;

                case AdSlideDirection.Right:
                    ((DoubleAnimation)SlideOutLRAdStoryboard.Children[0]).To  = bounds.Width * 2;
                    ((DoubleAnimation)SlideInLRAdStoryboard.Children[0]).From = bounds.Width * 2;
                    break;

                case AdSlideDirection.Bottom:
                    ((DoubleAnimation)SlideOutUDAdStoryboard.Children[0]).To  = bounds.Height * 2;
                    ((DoubleAnimation)SlideInUDAdStoryboard.Children[0]).From = bounds.Height * 2;
                    break;

                case AdSlideDirection.Top:
                    ((DoubleAnimation)SlideOutUDAdStoryboard.Children[0]).To  = -(bounds.Height * 2);
                    ((DoubleAnimation)SlideInUDAdStoryboard.Children[0]).From = -(bounds.Height * 2);
                    break;

                default:
                    ((DoubleAnimation)SlideOutLRAdStoryboard.Children[0]).To  = 0;
                    ((DoubleAnimation)SlideInLRAdStoryboard.Children[0]).From = 0;
                    ((DoubleAnimation)SlideOutUDAdStoryboard.Children[0]).To  = 0;
                    ((DoubleAnimation)SlideInUDAdStoryboard.Children[0]).From = 0;
                    break;
                }
            }
        }
Esempio n. 2
0
        private void SetupAnimationBounds(AdSlideDirection adSlideDirection)
        {
            double displayOffsetX = 0, displayOffsetY = 0;

            if (AdRotatorRoot != null)
            {
                ((DoubleAnimation)SlideOutLRAdStoryboard.Children[0]).To  = 0;
                ((DoubleAnimation)SlideInLRAdStoryboard.Children[0]).From = 0;
                ((DoubleAnimation)SlideOutUDAdStoryboard.Children[0]).To  = 0;
                ((DoubleAnimation)SlideInUDAdStoryboard.Children[0]).From = 0;

#if WINDOWS_PHONE
                var bounds = AdRotatorControl.DisplayResolution;
#else
                var bounds = Window.Current.Bounds;
#endif
                switch (adSlideDirection)
                {
                case AdSlideDirection.Left:
                    displayOffsetX = -(bounds.Width * 2);
                    break;

                case AdSlideDirection.Right:
                    displayOffsetX = bounds.Width * 2;
                    break;

                case AdSlideDirection.Bottom:
                    displayOffsetY = bounds.Height * 2;
                    break;

                case AdSlideDirection.Top:
                    displayOffsetY = -(bounds.Height * 2);
                    break;
                }
                AdRotatorRoot.RenderTransform = new CompositeTransform()
                {
                    TranslateX = displayOffsetX, TranslateY = displayOffsetY
                };
            }
        }