Esempio n. 1
0
 public void RotateAnimation()
 {
     // Keep this?
     // This is the sole root of the game crashing.
     if (_anim && UseRotationAnimation)
     {
         RotateStoryboard.Begin();
     }
 }
Esempio n. 2
0
        // Handle orientation changes
        void MainPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
        {
            _to = e.Orientation;
            if (_from == PageOrientation.None)
            {
                _from = _to;
            }

            System.Diagnostics.Debug.WriteLine("From: " + _from.ToString());
            System.Diagnostics.Debug.WriteLine("To: " + _to.ToString());

            // If in portrait mode...
            if ((e.Orientation & PageOrientation.Portrait) == (PageOrientation.Portrait))
            {
                overlay.LayoutRoot.Height = Browser.Height = Application.Current.Host.Content.ActualHeight - ApplicationBar.DefaultSize;
                overlay.LayoutRoot.Width  = Browser.Width = Application.Current.Host.Content.ActualWidth;
            }
            // If in landscape mode...
            else
            {
                overlay.LayoutRoot.Height = Browser.Height = Application.Current.Host.Content.ActualWidth;
                overlay.LayoutRoot.Width  = Browser.Width = Application.Current.Host.Content.ActualHeight - ApplicationBar.DefaultSize;
            }

            switch (_from)
            {
            case PageOrientation.PortraitUp:
                switch (_to)
                {
                case PageOrientation.LandscapeLeft:
                    RotateAnimation.From = -90;
                    break;

                case PageOrientation.LandscapeRight:
                    RotateAnimation.From = 90;
                    break;

                case PageOrientation.PortraitDown:
                    RotateAnimation.From = 180;
                    break;
                }
                break;

            case PageOrientation.LandscapeLeft:
                switch (_to)
                {
                case PageOrientation.PortraitUp:
                    RotateAnimation.From = 90;
                    break;

                case PageOrientation.PortraitDown:
                    RotateAnimation.From = -90;
                    break;

                case PageOrientation.LandscapeRight:
                    RotateAnimation.From = 180;
                    break;
                }
                break;

            case PageOrientation.LandscapeRight:
                switch (_to)
                {
                case PageOrientation.PortraitUp:
                    RotateAnimation.From = -90;
                    break;

                case PageOrientation.PortraitDown:
                    RotateAnimation.From = 90;
                    break;

                case PageOrientation.LandscapeLeft:
                    RotateAnimation.From = 180;
                    break;
                }
                break;

            case PageOrientation.PortraitDown:
                switch (_to)
                {
                case PageOrientation.PortraitUp:
                    RotateAnimation.From = 180;
                    break;

                case PageOrientation.LandscapeRight:
                    RotateAnimation.From = -90;
                    break;

                case PageOrientation.LandscapeLeft:
                    RotateAnimation.From = 90;
                    break;
                }
                break;
            }
            RotateAnimation.To = 0;
            RotateStoryboard.Begin();
            _from = _to;
        }
Esempio n. 3
0
 private void Rotate(object sender, RoutedEventArgs e)
 {
     RotateStoryboard.Begin();
 }