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


C# SimpleOrientation类代码示例

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


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

示例1: DisplayOrientation

 /// <summary>
 /// Helper method to display the device orientation in the specified text box.
 /// </summary>
 /// <param name="tb">
 /// The text box receiving the orientation value.
 /// </param>
 /// <param name="orientation">
 /// The orientation value.
 /// </param>
 private void DisplayOrientation(TextBlock tb, SimpleOrientation orientation)
 {
     switch (orientation)
     {
         case SimpleOrientation.NotRotated:
             tb.Text = "Not Rotated";
             break;
         case SimpleOrientation.Rotated90DegreesCounterclockwise:
             tb.Text = "Rotated 90 Degrees Counterclockwise";
             break;
         case SimpleOrientation.Rotated180DegreesCounterclockwise:
             tb.Text = "Rotated 180 Degrees Counterclockwise";
             break;
         case SimpleOrientation.Rotated270DegreesCounterclockwise:
             tb.Text = "Rotated 270 Degrees Counterclockwise";
             break;
         case SimpleOrientation.Faceup:
             tb.Text = "Faceup";
             break;
         case SimpleOrientation.Facedown:
             tb.Text = "Facedown";
             break;
         default:
             tb.Text = "Unknown orientation";
             break;
     }
 }
开发者ID:ckc,项目名称:WinApp,代码行数:36,代码来源:Scenario2_Polling.xaml.cs

示例2: ShowOrientationText

 private void ShowOrientationText(SimpleOrientation simpleOrientation)
 {
     switch (simpleOrientation)
     {
         case SimpleOrientation.NotRotated:
             AlertBox.Text = "Not Rotated";
             break;
         case SimpleOrientation.Rotated90DegreesCounterclockwise:
             AlertBox.Text = "90 Degrees CounterClockwise";
             break;
         case SimpleOrientation.Rotated180DegreesCounterclockwise:
             AlertBox.Text = "180 Degrees Rotated";
             break;
         case SimpleOrientation.Rotated270DegreesCounterclockwise:
             AlertBox.Text = "270 Degrees Rotated CounterClockwise";
             break;
         case SimpleOrientation.Facedown:
             AlertBox.Text = "Face Down";
             break;
         case SimpleOrientation.Faceup:
             AlertBox.Text = "Face Up";
             break;
         default:
             AlertBox.Text = "Unknown";
             break;
     }
 }
开发者ID:Jxperez,项目名称:31DaysOfWindows8,代码行数:27,代码来源:MainPage.xaml.cs

示例3: GetVideoRotation

 private VideoRotation GetVideoRotation(SimpleOrientation orientation)
 {
     switch (orientation)
     {
         case SimpleOrientation.Rotated90DegreesCounterclockwise:
             return VideoRotation.Clockwise270Degrees;
         case SimpleOrientation.Rotated180DegreesCounterclockwise:
             return VideoRotation.Clockwise180Degrees;
         case SimpleOrientation.Rotated270DegreesCounterclockwise:
             return VideoRotation.Clockwise90Degrees;
         default:
             return VideoRotation.None;
     }
 }
开发者ID:alexhardwicke,项目名称:Auth,代码行数:14,代码来源:CodeViewModelBase.cs

示例4: ConvertSimpleOrientationToVideoRotation

 private static VideoRotation ConvertSimpleOrientationToVideoRotation(SimpleOrientation orientation)
 {
     switch (orientation)
     {
         case SimpleOrientation.Rotated90DegreesCounterclockwise:
             return VideoRotation.Clockwise270Degrees;
         case SimpleOrientation.Rotated180DegreesCounterclockwise:
             return VideoRotation.Clockwise180Degrees;
         case SimpleOrientation.Rotated270DegreesCounterclockwise:
             return VideoRotation.Clockwise90Degrees;
         case SimpleOrientation.NotRotated:
         default:
             return VideoRotation.None;
     }
 }
开发者ID:yinyue200,项目名称:Windows-universal-samples,代码行数:15,代码来源:CameraRotationHelper.cs

示例5: SubtractOrientations

 private static SimpleOrientation SubtractOrientations(SimpleOrientation a, SimpleOrientation b)
 {
     var aRot = ConvertSimpleOrientationToClockwiseDegrees(a);
     var bRot = ConvertSimpleOrientationToClockwiseDegrees(b);
     // Add 360 to ensure the modulus operator does not operate on a negative
     var result = (360 + (aRot - bRot)) % 360;
     return ConvertClockwiseDegreesToSimpleOrientation(result);
 }
开发者ID:yinyue200,项目名称:Windows-universal-samples,代码行数:8,代码来源:CameraRotationHelper.cs

示例6: OrientationSensor_OrientationChanged

        /// <summary>
        /// Event handler for orientation sensor changes.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void OrientationSensor_OrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
        {
            if (args.Orientation != SimpleOrientation.Faceup && args.Orientation != SimpleOrientation.Facedown)
            {
                _deviceOrientation = args.Orientation;
            }

            // Update the UI button orientation
            UpdateButtonOrientation();
        }
开发者ID:d1vanloon,项目名称:replay,代码行数:15,代码来源:MainPage.xaml.cs

示例7: ConvertDeviceOrientationToDegrees

 /// <summary>
 /// Converts the given orientation of the device in space to the corresponding rotation in degrees
 /// </summary>
 /// <param name="orientation">The orientation of the device in space</param>
 /// <returns>An orientation in degrees</returns>
 private static int ConvertDeviceOrientationToDegrees(SimpleOrientation orientation)
 {
     switch (orientation)
     {
         case SimpleOrientation.Rotated90DegreesCounterclockwise:
             return 90;
         case SimpleOrientation.Rotated180DegreesCounterclockwise:
             return 180;
         case SimpleOrientation.Rotated270DegreesCounterclockwise:
             return 270;
         case SimpleOrientation.NotRotated:
         default:
             return 0;
     }
 }
开发者ID:t-angma,项目名称:Windows-universal-samples,代码行数:20,代码来源:mainpage.xaml.cs

示例8: OrientationSensor_OrientationChanged

        /// <summary>
        /// Occurs each time the simple orientation sensor reports a new sensor reading.
        /// </summary>
        /// <param name="sender">The event source.</param>
        /// <param name="args">The event data.</param>
        private async void OrientationSensor_OrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
        {
            if (args.Orientation != SimpleOrientation.Faceup && args.Orientation != SimpleOrientation.Facedown)
            {
                // Only update the current orientation if the device is not parallel to the ground. This allows users to take pictures of documents (FaceUp)
                // or the ceiling (FaceDown) in portrait or landscape, by first holding the device in the desired orientation, and then pointing the camera
                // either up or down, at the desired subject.
                //Note: This assumes that the camera is either facing the same way as the screen, or the opposite way. For devices with cameras mounted
                //      on other panels, this logic should be adjusted.
                _deviceOrientation = args.Orientation;

                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => UpdateButtonOrientation());
            }
        }
开发者ID:t-angma,项目名称:Windows-universal-samples,代码行数:19,代码来源:mainpage.xaml.cs

示例9: OrientationSensor_OrientationChanged

 private void OrientationSensor_OrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
 {
     if (args.Orientation != SimpleOrientation.Faceup && args.Orientation != SimpleOrientation.Facedown)
     {
         _deviceOrientation = args.Orientation;
     }
 }
开发者ID:mateusz-szczepanski,项目名称:BLStreamPatronage2016,代码行数:7,代码来源:Photo.cs

示例10: OrientationSensor_OrientationChanged

 private void OrientationSensor_OrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
 {
     if (args.Orientation != SimpleOrientation.Faceup && args.Orientation != SimpleOrientation.Facedown)
     {
         // Only update the current orientation if the device is not parallel to the ground. This allows users to take pictures of documents (FaceUp)    
         deviceOrientation = args.Orientation;
     }
 }
开发者ID:karolinadub,项目名称:Patronage2016,代码行数:8,代码来源:CameraView.xaml.cs

示例11: OnOrientationSensorOrientationChanged

 void OnOrientationSensorOrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
 {
     // Only update orientatino if the device is not parallel to the ground
     if (args.Orientation != SimpleOrientation.Faceup && args.Orientation != SimpleOrientation.Facedown)
     {
         deviceOrientation = args.Orientation;
     }
 }
开发者ID:berlamont,项目名称:xamarin-forms-samples,代码行数:8,代码来源:CameraPageRenderer.cs

示例12: ConvertOrientationToPhotoOrientation

        private object ConvertOrientationToPhotoOrientation(SimpleOrientation orientation)
        {
            //     if (_mirroringPreview == true)
            //      {
            switch (orientation)
            {
                case SimpleOrientation.Rotated90DegreesCounterclockwise:
                    return PhotoOrientation.Rotate90;
                case SimpleOrientation.Rotated180DegreesCounterclockwise:
                    return PhotoOrientation.Rotate180;
                case SimpleOrientation.Rotated270DegreesCounterclockwise:
                    return PhotoOrientation.Rotate270;
                case SimpleOrientation.NotRotated:
                default:
                    return PhotoOrientation.Normal;
            }
            //        }
            //else
            //{
            //    switch (orientation)
            //    {
            //        case SimpleOrientation.Rotated90DegreesCounterclockwise:
            //            return PhotoOrientation.Rotate90;
            //        case SimpleOrientation.Rotated180DegreesCounterclockwise:
            //            return PhotoOrientation.Rotate180;
            //        case SimpleOrientation.Rotated270DegreesCounterclockwise:
            //            return PhotoOrientation.Rotate270;
            //        case SimpleOrientation.NotRotated:
            //        default:
            //            return PhotoOrientation.Normal;
            //    }
            //}

        }
开发者ID:dengtuo,项目名称:XiyouLibProject,代码行数:34,代码来源:RCode_M.xaml.cs

示例13: InitializeCameraAsync

 protected override async void OnNavigatedTo(NavigationEventArgs e)
 {
     if (orientationSensor != null)
     {
         deviceOrientation = orientationSensor.GetCurrentOrientation();
     }
     await InitializeCameraAsync();
     RegisterEventHandlers();
 }
开发者ID:karolinadub,项目名称:Patronage2016,代码行数:9,代码来源:CameraView.xaml.cs

示例14: ajustes

        private async void ajustes()
        {
            var qualifiers = Windows.ApplicationModel.Resources.Core.ResourceContext.GetForCurrentView().QualifierValues;
            deviceFamily = qualifiers["DeviceFamily"];

            double Width = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().VisibleBounds.Width;
            double Height = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().VisibleBounds.Height;

            _displayOrientation = _displayInformation.CurrentOrientation;
            if (_orientationSensor != null)
            {
                _deviceOrientation = _orientationSensor.GetCurrentOrientation();
            }

            if (deviceFamily == "Mobile")
            {
                //Content.Visibility = Visibility.Collapsed;

                MainGrid.ColumnDefinitions[0].Width = new GridLength(1577 + 723);
                MainGrid.ColumnDefinitions[1].Width = new GridLength(0);
                MainGrid.RowDefinitions[0].Height = new GridLength(1106);
                MainGrid.RowDefinitions[1].Height = new GridLength(2990);

                Page.SetValue(Grid.ColumnProperty, 0);
                Page.SetValue(Grid.RowProperty, 1);
                Page.Margin = new Thickness(Width * 0.026);

                age_genre.FontSize = 80;
                age_genre.Foreground = new SolidColorBrush(Colors.White);
            }
            else
            {
                //MainGrid.ColumnDefinitions[0].Width = new GridLength(Width * 0.27);
                //MainGrid.ColumnDefinitions[1].Width = new GridLength(Width * 0.72);
                //MainGrid.RowDefinitions[0].Height = new GridLength(Height * 0.27);
                //MainGrid.RowDefinitions[1].Height = new GridLength(Height * 0.72);

                //GridLength minWidth = new GridLength(300);
                //GridLength mg = MainGrid.ColumnDefinitions[0].Width;

                //if (mg.Value < minWidth.Value)
                //{
                //    MainGrid.ColumnDefinitions[0].Width = minWidth;
                //    HoldCamera.Margin = new Thickness(300 * 0.026);
                //    LeftPanel.Margin = new Thickness(300 * 0.026);
                //}

                //HoldCamera.Margin = new Thickness(Width * 0.026);
                //LeftPanel.Margin = new Thickness(Width * 0.026);
                //ProductImage.Margin = new Thickness(Width * 0.026);
                //Content.Margin = new Thickness(Width * 0.026);
                //ProductName.Margin = new Thickness(Width * 0.015625, Height * 0.027777, Width * 0.15625, Height * 0.925925);
                //Price.Margin = new Thickness(Width * 0.3125, Height * 0.027777, Width * 0.015625, Height * 0.185185);
                //logoStore.Margin = new Thickness(Width * 0.3125, Height * 0.185185, Width * 0.015625, Height * 0.027777);
            }

            RegisterEventHandlers();
            await InitContiniousRecognition();
        }
开发者ID:lcarli,项目名称:IntelliMarketing,代码行数:59,代码来源:MainPage.xaml.cs

示例15: RegisterOrientationEventHandlers

        private void RegisterOrientationEventHandlers()
        {
            if (_orientationSensor != null)
            {
                _orientationSensor.OrientationChanged += OrientationSensor_OrientationChanged;
                _deviceOrientation = _orientationSensor.GetCurrentOrientation();
            }

            _displayInformation.OrientationChanged += DisplayInformation_OrientationChanged;
            _displayOrientation = _displayInformation.CurrentOrientation;
        }
开发者ID:mateusz-szczepanski,项目名称:BLStreamPatronage2016,代码行数:11,代码来源:Photo.cs


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