当前位置: 首页>>代码示例>>C#>>正文


C# OrientationChangedEventArgs类代码示例

本文整理汇总了C#中OrientationChangedEventArgs的典型用法代码示例。如果您正苦于以下问题:C# OrientationChangedEventArgs类的具体用法?C# OrientationChangedEventArgs怎么用?C# OrientationChangedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OrientationChangedEventArgs类属于命名空间,在下文中一共展示了OrientationChangedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnOrientationChanged

        protected override void OnOrientationChanged(OrientationChangedEventArgs e)
        {
            base.OnOrientationChanged(e);

            if (_previousOrientation == null)
                return;

            RotateTransition transitionElement = new RotateTransition();

            // counter clockwise rotation
            if (_previousOrientation == PageOrientation.LandscapeRight && e.Orientation == PageOrientation.PortraitUp ||
                _previousOrientation == PageOrientation.PortraitUp && e.Orientation == PageOrientation.LandscapeLeft ||
                _previousOrientation == PageOrientation.LandscapeLeft && e.Orientation == PageOrientation.PortraitDown ||
                _previousOrientation == PageOrientation.PortraitDown && e.Orientation == PageOrientation.LandscapeRight)
                transitionElement.Mode = RotateTransitionMode.In90Counterclockwise;

            // clockwise rotation
            else if (_previousOrientation == PageOrientation.LandscapeLeft && e.Orientation == PageOrientation.PortraitUp ||
                     _previousOrientation == PageOrientation.PortraitDown && e.Orientation == PageOrientation.LandscapeLeft ||
                     _previousOrientation == PageOrientation.LandscapeRight && e.Orientation == PageOrientation.PortraitDown ||
                     _previousOrientation == PageOrientation.PortraitUp && e.Orientation == PageOrientation.LandscapeRight)
                transitionElement.Mode = RotateTransitionMode.In90Clockwise;

            // 180 rotation
            else
                transitionElement.Mode = RotateTransitionMode.In180Clockwise;

            var transition = transitionElement.GetTransition((PhoneApplicationPage)(((PhoneApplicationFrame)Application.Current.RootVisual).Content));
            transition.Completed += delegate { transition.Stop(); };
            transition.Begin();

            _previousOrientation = e.Orientation;
        }
开发者ID:Anheledir,项目名称:authenticator-plus,代码行数:33,代码来源:RotationAnimationPage.cs

示例2: MainPageOrientationChanged

        void MainPageOrientationChanged(object sender, OrientationChangedEventArgs e)
        {
            //var newOrientation = e.Orientation;

            //var transitionElement = new RotateTransition();

            //switch (newOrientation)
            //{
            //    case PageOrientation.Landscape:
            //    case PageOrientation.LandscapeRight:
            //        transitionElement.Mode = _lastOrientation == PageOrientation.PortraitUp ? RotateTransitionMode.In90Counterclockwise : RotateTransitionMode.In180Clockwise;
            //        break;
            //    case PageOrientation.LandscapeLeft:
            //        transitionElement.Mode = _lastOrientation == PageOrientation.LandscapeRight ? RotateTransitionMode.In180Counterclockwise : RotateTransitionMode.In90Clockwise;
            //        break;
            //    case PageOrientation.Portrait:
            //    case PageOrientation.PortraitUp:
            //        transitionElement.Mode = _lastOrientation == PageOrientation.LandscapeLeft ? RotateTransitionMode.In90Counterclockwise : RotateTransitionMode.In90Clockwise;
            //        break;
            //    default:
            //        break;
            //}

            //var phoneApplicationPage = (PhoneApplicationPage)(((PhoneApplicationFrame)Application.Current.RootVisual)).Content;
            //var transition = transitionElement.GetTransition(phoneApplicationPage);
            //transition.Completed += delegate
            //{
            //    transition.Stop();
            //    UpdateOrientation();
            //};
            //transition.Begin();

            //_lastOrientation = newOrientation;
        }
开发者ID:tym32167,项目名称:calculon,代码行数:34,代码来源:MainPage.xaml.cs

示例3: PhoneApplicationPage_OrientationChanged

        private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
        {
            double ScreenWidth;
            double ScreenHeight;
            double AnchoContenido;

            // Switch the placement of the buttons based on an orientation change.
            if ((e.Orientation & PageOrientation.Portrait) == (PageOrientation.Portrait))
            {
                ScreenWidth = Application.Current.Host.Content.ActualWidth;
                ScreenHeight = Application.Current.Host.Content.ActualHeight;

                AnchoContenido = ScreenWidth - 50;
            }
            // If not in portrait, move buttonList content to visible row and column.
            else
            {
                ScreenHeight = Application.Current.Host.Content.ActualWidth;
                ScreenWidth = Application.Current.Host.Content.ActualHeight;

                AnchoContenido = ScreenWidth - 147;
            }

            wbContenido.Width = AnchoContenido;

            stpContenido.Height = ScreenHeight - 20;
            stpContenido.Width = ScreenWidth - 20;

        }
开发者ID:javiermontescarrera,项目名称:Apostolado,代码行数:29,代码来源:Lector.xaml.cs

示例4: AnimateOrientationChange

        /// <summary>
        /// Animates the rectangle on orientation change
        /// </summary>
        /// <param name="e"></param>
        public void AnimateOrientationChange(OrientationChangedEventArgs e)
        {
            // check if new orientation is landscape or portrait
            if (e.Orientation == PageOrientation.Landscape || e.Orientation == PageOrientation.LandscapeLeft || e.Orientation == PageOrientation.LandscapeRight) {
                // if landscape dimensions were not calculated we must do it now
                if (!mAnimationInitialized) {
                    // calculate landscape box size based on screen size
                    mLandscapeWidth = ActualWidth * kLandscapeRatio;
                    mLandscapeHeight = mLandscapeWidth * kAspectRatio;

                    // set animation values for both animations (landcape to portrait and reverse)
                    mP2LWidthAnimation.From = mPortraitHeight;
                    mP2LWidthAnimation.To = mLandscapeWidth;

                    mP2LHeightAnimation.From = mPortraitWidth;
                    mP2LHeightAnimation.To = mLandscapeHeight;

                    mL2PWidthAnimation.From = mLandscapeHeight;
                    mL2PWidthAnimation.To = mPortraitWidth;

                    mL2PHeightAnimation.From = mLandscapeWidth;
                    mL2PHeightAnimation.To = mPortraitHeight;
                    // mark animation as initialized and ready
                    mAnimationInitialized = true;
                }
                // start portrait to landscape animation
                mP2LAnimation.Begin();
            } else {
                // start landscape to portrait animation if all values are calculated
                if (mAnimationInitialized) {
                    mL2PAnimation.Begin();
                }
            }
        }
开发者ID:BlinkID,项目名称:blinkid-windowsPhone,代码行数:38,代码来源:Rectangle.xaml.cs

示例5: OnOrientationChanged

        public void OnOrientationChanged(OrientationChangedEventArgs e)
        {
            if (Camera != null)
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {

                    // LandscapeRight rotation when camera is on back of device.
                    int landscapeRightRotation = 180;

                    // Change LandscapeRight rotation for front-facing camera.
                    if (Camera.CameraType == CameraType.FrontFacing) landscapeRightRotation = -180;

                    // Rotate video brush from camera.
                    if (e.Orientation == PageOrientation.LandscapeRight)
                    {
                        // Rotate for LandscapeRight orientation.
                        CurrentVideoBrush.RelativeTransform =
                            new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = landscapeRightRotation };
                    }
                    else
                    {
                        // Rotate for standard landscape orientation.
                        CurrentVideoBrush.RelativeTransform =
                            new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 0 };
                    }
                });
            }

        }
开发者ID:poedja,项目名称:SpaceTrek,代码行数:30,代码来源:InputStreamService.cs

示例6: OnOrientationChanged

        protected override void OnOrientationChanged(OrientationChangedEventArgs e)
        {
            var RootGrid = this.FindName("LayoutRoot") as Grid;
          //  var RotationGrid = RootGrid.FindName("ScreenFlow") as Grid;

            switch (e.Orientation)
            {
                case PageOrientation.Landscape:
                  //  ((Grid)this.FindName("LayoutRoot")).Margin = new Thickness(120, 0, 0, 0);
                    break;
                case PageOrientation.LandscapeLeft:
                 //   RotationGrid.Margin = new Thickness(60, 0,70, 0);
                    break;
                case PageOrientation.LandscapeRight:
                    break;
                case PageOrientation.None:
                    break;
                case PageOrientation.Portrait:
                    break;
                case PageOrientation.PortraitDown:
                    break;
                case PageOrientation.PortraitUp:
                    break;
                default:
                    break;
            }

            base.OnOrientationChanged(e);
        }
开发者ID:wuchangqi,项目名称:ifixit-microsoft,代码行数:29,代码来源:PageBase.cs

示例7: OnOrientationChanged

 protected override void OnOrientationChanged(OrientationChangedEventArgs e)
 {
     if (!(e.Orientation == PageOrientation.LandscapeRight))
     {
         base.OnOrientationChanged(e);
     }
 }
开发者ID:abraxas4,项目名称:AR-Drone-Project,代码行数:7,代码来源:ConfigPage.xaml.cs

示例8: OnOrientationChanged

        protected override void OnOrientationChanged(OrientationChangedEventArgs e)
        {

            base.OnOrientationChanged(e);
         

            switch (e.Orientation)
            {
                case PageOrientation.Landscape:

                    break;
                case PageOrientation.LandscapeLeft:
                    ContentPanel.Margin = new Thickness(0, 0, 75, 0);
                  
                    break;
                case PageOrientation.LandscapeRight:
                    ContentPanel.Margin = new Thickness(75, 0, 0, 0);
                  
                    break;
                case PageOrientation.None:


                case PageOrientation.Portrait:

                case PageOrientation.PortraitDown:

                case PageOrientation.PortraitUp:


                default:
                    ContentPanel.Margin = new Thickness(0, 0, 0, 0);
                 
                    break;
            }
        }
开发者ID:wuchangqi,项目名称:ifixit-microsoft,代码行数:35,代码来源:Login.xaml.cs

示例9: OnOrientationChanged

        protected override void OnOrientationChanged(OrientationChangedEventArgs e)
        {

            base.OnOrientationChanged(e);
            var orientation = e.Orientation;
            SetOrientation(orientation);
        }
开发者ID:wuchangqi,项目名称:ifixit-microsoft,代码行数:7,代码来源:Details.xaml.cs

示例10: GamePageWP8_OrientationChanged

 private void GamePageWP8_OrientationChanged(object sender, OrientationChangedEventArgs e)
 {
     if (this._game != null)
     {
         (this._game.Window as WindowsPhoneGameWindow).OrientationChanged += GamePage_OrientationChanged;
     }
 }
开发者ID:kbo4sho,项目名称:Swarm,代码行数:7,代码来源:GamePage.xaml.cs

示例11: OnOrientationChanged

 // Ensure that the viewfinder is upright in LandscapeRight.
 protected override void OnOrientationChanged(OrientationChangedEventArgs e)
 {
     if (camera != null)
     {
         // LandscapeRight rotation when camera is on back of phone
         int landscapeRightRotation = 180;
         // Change LandscapeRight rotation for front-facing camera
         if (camera.CameraType == CameraType.FrontFacing)
             landscapeRightRotation = -180;
         // Rotate video brush from camera
         if (e.Orientation == PageOrientation.PortraitUp)
         {
             // Rotate for LandscapeRight orientation
             mainCameraBrush.RelativeTransform = new CompositeTransform()
             {
                 CenterX = 0.5,
                 CenterY = 0.5,
                 Rotation = landscapeRightRotation
             };
         }
         else
         {
             // Rotate for standard landscape orientation
             mainCameraBrush.RelativeTransform = new CompositeTransform()
             {
                 CenterX = 0.5,
                 CenterY = 0.5,
                 Rotation = 0
             };
         }
     }
     base.OnOrientationChanged(e);
 }
开发者ID:gibratim,项目名称:pdis,代码行数:34,代码来源:detect.xaml.cs

示例12: OnOrientationChanged

 protected override void OnOrientationChanged(OrientationChangedEventArgs e)
 {
     if (e.Orientation == PageOrientation.PortraitDown || e.Orientation == PageOrientation.PortraitUp)
     {
         NavigationService.GoBack();
     }
     base.OnOrientationChanged(e);
 }
开发者ID:epyx-src,项目名称:WindMobile-WP7,代码行数:8,代码来源:ChartView.xaml.cs

示例13: OnOrientationChanged

        protected override void OnOrientationChanged(OrientationChangedEventArgs e)
        {
            

            base.OnOrientationChanged(e);
            //vm.OnOrientationChanged(e);
            
        }
开发者ID:poedja,项目名称:SpaceTrek,代码行数:8,代码来源:Camera.xaml.cs

示例14: ResponsiveApp_OrientationChanged

 void ResponsiveApp_OrientationChanged(object sender, OrientationChangedEventArgs e)
 {
     if (frame != null)
     {
         //intial call to setup default styles
         handleChangeEvents(new Size(frame.ActualWidth, frame.ActualHeight),
                            frame.Orientation);
     }
 }
开发者ID:punker76,项目名称:XAMLResponsiveStyles,代码行数:9,代码来源:ResponsiveApp.cs

示例15: PageOrientationChanged

 private void PageOrientationChanged(object sender, OrientationChangedEventArgs e)
 {
     if (e.Orientation == PageOrientation.LandscapeLeft || e.Orientation == PageOrientation.LandscapeRight)
     {
         var temp = ChapterTextContent.Height;
         ChapterTextContent.Height = ChapterTextContent.Width;
         ChapterTextContent.Width = temp;
     }
 }
开发者ID:gracepig,项目名称:SmartReader,代码行数:9,代码来源:ChapterViewPage.xaml.cs


注:本文中的OrientationChangedEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。