示例#1
0
 private void HandleMetroAppAnimatorChanged(TransitionAnimationProvider oldAnimator, TransitionAnimationProvider newAnimator)
 {
     if (oldAnimator != null)
     {
         oldAnimator.LeavingViewCompleted  -= MetroAppAnimator_LeavingViewCompleted;
         oldAnimator.EnteringViewCompleted -= MetroAppAnimator_EnteringViewCompleted;
     }
     SetupMetroAppAnimator(newAnimator);
 }
示例#2
0
 private void HandleTileViewAnimatorChanged(TransitionAnimationProvider oldAnimator, TransitionAnimationProvider newAnimator)
 {
     if (oldAnimator != null)
     {
         oldAnimator.LeavingViewCompleted  -= TileViewAnimator_LeavingViewCompleted;
         oldAnimator.EnteringViewCompleted -= TileViewAnimator_EnteringViewCompleted;
     }
     if (newAnimator != null)
     {
         SetupTileViewAnimator(newAnimator);
     }
 }
示例#3
0
        private void SetupTileViewAnimator(TransitionAnimationProvider animator)
        {
            if (!IsLoaded || animator == null)
            {
                return;
            }

            animator.Bind(TransitionAnimationProvider.DurationProperty, this, AnimationDurationProperty);

            var threeDRect = GetTemplateChild("ThreeDRectangle") as Rectangle2D3D;

            if (threeDRect == null)
            {
                threeDRect = this.GetFirstDescendent <Rectangle2D3D>();
            }

            var threeDAnimator = animator as TransitionAnimation3DProvider;

            if (threeDAnimator != null)
            {
                if (threeDRect != null)
                {
                    threeDAnimator.Container = threeDRect;
                }
                else
                {
                    threeDAnimator.Container = this.GetFirstDescendent <Panel>();
                }
            }
            else
            {
                if (threeDRect != null)
                {
                    animator.Container = threeDRect.Parent as Panel;
                }
                if (animator.Container == null)
                {
                    animator.Container = this.GetFirstDescendent <Panel>();
                }
            }

            animator.Initialize();
            animator.LeavingViewCompleted  += TileViewAnimator_LeavingViewCompleted;
            animator.EnteringViewCompleted += TileViewAnimator_EnteringViewCompleted;
        }
示例#4
0
        private void SetupMetroAppAnimator(TransitionAnimationProvider animator)
        {
            if (animator == null || _ParentShell == null)
            {
                return;
            }

            animator.Bind(TransitionAnimationProvider.DurationProperty, this, AnimationDurationProperty);

            // Metro app here is basically MetroShell. It is content of MetroShell which is being animated.
            // The animation logic has been located here in order to keep all animation properties
            // with MetroStartControl and because without MetroStartControl there would be no need to
            // animate MetroShell content.
            var threeDAnimator = animator as TransitionAnimation3DProvider;

            if (threeDAnimator != null)
            {
                var threeDRectangle = _ParentShell.GetFirstDescendent <Rectangle2D3D>();
                if (threeDRectangle != null)
                {
                    threeDAnimator.Container = threeDRectangle;
                }
                else
                {
                    threeDAnimator.Container = _ParentShell.GetFirstDescendent <Grid>();
                }
            }
            else
            {
                animator.Container = _ParentShell.GetFirstDescendent <Grid>();
            }

            animator.Initialize();
            animator.LeavingViewCompleted  += MetroAppAnimator_LeavingViewCompleted;
            animator.EnteringViewCompleted += MetroAppAnimator_EnteringViewCompleted;
        }