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

C# SimpleOrientation类代码示例

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

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



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

 private static SimpleOrientation MirrorOrientation(SimpleOrientation orientation)
 {
     // This only affects the 90 and 270 degree cases, because rotating 0 and 180 degrees is the same clockwise and counter-clockwise
     switch (orientation)
     {
         case SimpleOrientation.Rotated90DegreesCounterclockwise:
             return SimpleOrientation.Rotated270DegreesCounterclockwise;
         case SimpleOrientation.Rotated270DegreesCounterclockwise:
             return SimpleOrientation.Rotated90DegreesCounterclockwise;
     }
     return orientation;
 }
开发者ID:yinyue200,项目名称:Windows-universal-samples,代码行数:12,代码来源:CameraRotationHelper.cs


示例14: AddOrientations

 private static SimpleOrientation AddOrientations(SimpleOrientation a, SimpleOrientation b)
 {
     var aRot = ConvertSimpleOrientationToClockwiseDegrees(a);
     var bRot = ConvertSimpleOrientationToClockwiseDegrees(b);
     var result = (aRot + bRot) % 360;
     return ConvertClockwiseDegreesToSimpleOrientation(result);
 }
开发者ID:yinyue200,项目名称:Windows-universal-samples,代码行数:7,代码来源:CameraRotationHelper.cs


示例15: ConvertOrientationToPhotoOrientation

 /// <summary>
 /// Converts the given orientation of the device in space to the metadata that can be added to captured photos
 /// </summary>
 /// <param name="orientation">The orientation of the device in space</param>
 /// <returns></returns>
 private static PhotoOrientation ConvertOrientationToPhotoOrientation(SimpleOrientation orientation)
 {
     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:t-angma,项目名称:Windows-universal-samples,代码行数:20,代码来源:mainpage.xaml.cs


示例16: InitializeCameraAsync

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


示例17: 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


示例18: 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


示例19: Application_Resuming

        private async void Application_Resuming(object sender, object o)
        {
            if (orientationSensor != null)
            {
                deviceOrientation = orientationSensor.GetCurrentOrientation();
            }

            if (Frame.CurrentSourcePageType == typeof(CameraView))
            {
                await InitializeCameraAsync();
            }

            RegisterEventHandlers();
        }
开发者ID:karolinadub,项目名称:Patronage2016,代码行数:14,代码来源:CameraView.xaml.cs


示例20: SetupUiAsync

        /// <summary>
        /// Attempts to lock the page orientation, hide the StatusBar (on Phone) and registers event handlers for hardware buttons and orientation sensors
        /// </summary>
        /// <returns></returns>
        private async Task SetupUiAsync()
        {
            // Attempt to lock page to landscape orientation to prevent the CaptureElement from rotating, as this gives a better experience
            DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;

            // Hide the status bar
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                await Windows.UI.ViewManagement.StatusBar.GetForCurrentView().HideAsync();
            }

            // Populate orientation variables with the current state
            _displayOrientation = _displayInformation.CurrentOrientation;
            if (_orientationSensor != null)
            {
                _deviceOrientation = _orientationSensor.GetCurrentOrientation();
            }
            
            RegisterEventHandlers();

            var picturesLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);
            // Fall back to the local app storage if the Pictures Library is not available
            _captureFolder = picturesLibrary.SaveFolder ?? ApplicationData.Current.LocalFolder;
        }
开发者ID:AJ-COOL,项目名称:Windows-universal-samples,代码行数:28,代码来源:MainPage.xaml.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# SimpleQuery类代码示例发布时间:2022-05-24
下一篇:
C# SimpleJsonSerializer类代码示例发布时间: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