• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# OrientationChangedEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: PhoneApplicationPage_OrientationChanged

 private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
 {
     if (e.Orientation == PageOrientation.LandscapeLeft || e.Orientation == PageOrientation.LandscapeRight)
     {
         wrapPanelLayout.Width = (btnMap.Width * 3);
     }
     else
         wrapPanelLayout.Width = this.ActualWidth;
 }
开发者ID:kluesman,项目名称:Freeway,代码行数:9,代码来源:MainPage.xaml.cs


示例17: OnOrientationChanged

        protected override void OnOrientationChanged(OrientationChangedEventArgs e)
        {
            if ((e.Orientation & PageOrientation.Portrait) == PageOrientation.Portrait)
            {
                NavigationService.Navigate(new Uri("/View/Portrait/MapView.xaml", UriKind.Relative));
            }

            base.OnOrientationChanged(e);
        }
开发者ID:pawelsawicz,项目名称:PeregrinWP,代码行数:9,代码来源:MapView.xaml.cs


示例18: _frame_OrientationChanged

 private void _frame_OrientationChanged(object sender, OrientationChangedEventArgs e)
 {
     if (_popup != null && _popup.Child is FrameworkElement && _frame != null)
     {
         var container = _popup.Child as FrameworkElement;
         container.Width = _frame.ActualWidth;
         container.Height = _frame.ActualHeight;
     }
 }
开发者ID:jorik041,项目名称:CrossChat,代码行数:9,代码来源:PopupController.cs


示例19: OnOrientationChanged

 override protected void OnOrientationChanged(OrientationChangedEventArgs args)
 {
     base.OnOrientationChanged(args);
     if (m_d3dInterop != null)
     {
         DisplayOrientations orientation = ConvertToNativeOrientation(args.Orientation);
         m_d3dInterop.OnOrientationChanged(orientation);
     }
 }
开发者ID:triompha,项目名称:Cocos3dSamples,代码行数:9,代码来源:MainPage.xaml.cs


示例20: NotifyOrientationChange

 /// <summary>
 /// Send orientation change message through MessagingCenter
 /// </summary>
 /// <param name="e">Orientation changed event args</param>
 public static void NotifyOrientationChange(OrientationChangedEventArgs e)
 {
     bool isLandscape = (e.Orientation & PageOrientation.Landscape) == PageOrientation.Landscape;
     var msg = new DeviceOrientationChangeMessage()
     {
         Orientation = isLandscape ? DeviceOrientations.Landscape : DeviceOrientations.Portrait
     };
     MessagingCenter.Send<DeviceOrientationChangeMessage>(msg, DeviceOrientationChangeMessage.MessageId);
 }
开发者ID:tohosnet,项目名称:Xamarin.Plugins-4,代码行数:13,代码来源:DeviceOrientationImplementation.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Orleans类代码示例发布时间:2022-05-24
下一篇:
C# Orientation类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap