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

C# DisplayOrientations类代码示例

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

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



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

示例1: OnNavigatedTo

        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            _dataTransferManager = DataTransferManager.GetForCurrentView();
            _dataTransferManager.DataRequested += OnDataRequested;

            _navigationHelper.OnNavigatedTo(e);

            if (InstagramModel != null)
            {
                await InstagramModel.LoadItemsAsync();
                InstagramModel.SelectItem(e.Parameter);

                InstagramModel.ViewType = ViewTypes.Detail;
            }
            DataContext = this;

            // Allow this page to rotate
            _currentOrientations = DisplayInformation.AutoRotationPreferences;
            DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait
                                                        | DisplayOrientations.Landscape
                                                        | DisplayOrientations.LandscapeFlipped
                                                        | DisplayOrientations.PortraitFlipped;

            // Handle orientation changes
            DisplayInformation.GetForCurrentView().OrientationChanged += this.OnOrientationChanged;
            this.TransitionStoryboardState();
        }
开发者ID:Hackaju,项目名称:App_Hackaju_WP,代码行数:27,代码来源:InstagramDetailPage.xaml.cs


示例2: CameraCaptureUIPage

 public CameraCaptureUIPage()
 {
   previous = DisplayInformation.AutoRotationPreferences;
   DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;
     this.Loaded += CameraCaptureUIPage_Loaded;
     this.Unloaded += CameraCaptureUIPage_Unloaded;
     this.InitializeComponent();
 }
开发者ID:Lotpath,项目名称:Xamarin.Plugins,代码行数:8,代码来源:CameraCaptureUiPage.xaml.cs


示例3: OnNavigatedTo

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.currentDisplayOrientations = DisplayInformation.AutoRotationPreferences;
            DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait;
            string id = e.Parameter as string;
            this.OpenScript(id);

            base.OnNavigatedTo(e);
        }
开发者ID:mbsabbanban,项目名称:baby-mayas-adventures,代码行数:9,代码来源:TouchDevelopPlayer.xaml.cs


示例4: ConvertDisplayOrientationToDegrees

 private static int ConvertDisplayOrientationToDegrees(DisplayOrientations orientation)
 {
     switch (orientation)
     {
         case DisplayOrientations.Portrait:
             return 90;
         case DisplayOrientations.LandscapeFlipped:
             return 180;
         case DisplayOrientations.PortraitFlipped:
             return 270;
         case DisplayOrientations.Landscape:
         default:
             return 0;
     }
 }
开发者ID:fengweijp,项目名称:Win2D,代码行数:15,代码来源:CameraEffectExample.xaml.cs


示例5: OnNavigatedTo

        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            _autoRotation = DisplayInformation.AutoRotationPreferences;
            DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;
            // TODO: Prepare page for display here.
            await InitializeAsync();

            // TODO: If your application contains multiple pages, ensure that you are
            // handling the hardware Back button by registering for the
            // Windows.Phone.UI.Input.HardwareButtons.BackPressed event.
            // If you are using the NavigationHelper provided by some templates,
            // this event is handled for you.

   
        }
开发者ID:lcarli,项目名称:VideoScanZXingWinRT,代码行数:20,代码来源:BarcodePage.xaml.cs


示例6: OnNavigatedTo

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            LoadState(e.Parameter);
            if (HasPortrait)
            {
                _currentOrientations = DisplayInformation.AutoRotationPreferences;
                DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait
                                                            | DisplayOrientations.Landscape
                                                            | DisplayOrientations.LandscapeFlipped
                                                            | DisplayOrientations.PortraitFlipped;

                // Handle orientation changes
                DisplayInformation.GetForCurrentView().OrientationChanged += this.OnOrientationChanged;
                this.TransitionStoryboardState();
            }
        }
开发者ID:goldenskygiang,项目名称:NANConfessionClient,代码行数:16,代码来源:PageBase.cs


示例7: OnNavigatedTo

        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            _dataTransferManager = DataTransferManager.GetForCurrentView();
            _dataTransferManager.DataRequested += OnDataRequested;

            _navigationHelper.OnNavigatedTo(e);

            if (YouTubeChannelModel != null)
            {
                await YouTubeChannelModel.LoadItemsAsync();
                YouTubeChannelModel.SelectItem(e.Parameter);

                YouTubeChannelModel.ViewType = ViewTypes.Detail;
            }

            ytViewer.OnNavigatedTo();

            // Allow this page to rotate
            _currentOrientations = DisplayInformation.AutoRotationPreferences;
            DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait
                                                        | DisplayOrientations.Landscape
                                                        | DisplayOrientations.LandscapeFlipped
                                                        | DisplayOrientations.PortraitFlipped;
        }
开发者ID:ProjectsInChasz,项目名称:DjangoDjangoFunApp,代码行数:24,代码来源:YouTubeChannelDetailPage.xaml.cs


示例8: IsAspectChanging

        /// <summary>
        /// Gets a value that indicates if the aspect ratio is changing as part of the orientation change.
        /// </summary>
        /// <param name="oldOrientation">
        /// The old orientation.
        /// </param>
        /// <param name="newOrientation">
        /// The new orientation.
        /// </param>
        /// <returns>
        /// <c>true</c> if the aspect ratio is changing as part of the orientation change; otherwise <c>false</c>.
        /// </returns>
        public static bool IsAspectChanging(DisplayOrientations oldOrientation, DisplayOrientations newOrientation)
        {
            // Going from landscape to portrait?
            if ((oldOrientation == DisplayOrientations.Landscape) ||
                (oldOrientation == DisplayOrientations.LandscapeFlipped))
            {
                if ((newOrientation == DisplayOrientations.Portrait) ||
                    (newOrientation == DisplayOrientations.PortraitFlipped))
                {
                    return true;
                }
            }

            // Going from portrait to landscape?
            if ((oldOrientation == DisplayOrientations.Portrait) ||
                (oldOrientation == DisplayOrientations.PortraitFlipped))
            {
                if ((newOrientation == DisplayOrientations.Landscape) ||
                    (newOrientation == DisplayOrientations.LandscapeFlipped))
                {
                    return true;
                }
            }

            // Nope
            return false;
        }
开发者ID:jessejjohnson,项目名称:iot-devices,代码行数:39,代码来源:GraphicsTools.cs


示例9: ConvertDisplayOrientationToSimpleOrientation

        private SimpleOrientation ConvertDisplayOrientationToSimpleOrientation(DisplayOrientations orientation)
        {
            SimpleOrientation result;
            switch (orientation)
            {
                case DisplayOrientations.Landscape:
                    result = SimpleOrientation.NotRotated;
                    break;
                case DisplayOrientations.PortraitFlipped:
                    result = SimpleOrientation.Rotated90DegreesCounterclockwise;
                    break;
                case DisplayOrientations.LandscapeFlipped:
                    result = SimpleOrientation.Rotated180DegreesCounterclockwise;
                    break;
                case DisplayOrientations.Portrait:
                default:
                    result = SimpleOrientation.Rotated270DegreesCounterclockwise;
                    break;
            }

            // Above assumes landscape; offset is needed if native orientation is portrait
            if (_displayInformation.NativeOrientation == DisplayOrientations.Portrait)
            {
                result = AddOrientations(result, SimpleOrientation.Rotated90DegreesCounterclockwise);
            }

            return result;
        }
开发者ID:yinyue200,项目名称:Windows-universal-samples,代码行数:28,代码来源:CameraRotationHelper.cs


示例10: ToOrientation

        private static DisplayOrientation ToOrientation(DisplayOrientations orientations)
        {
            var result = DisplayOrientation.Default;
            if ((orientations & DisplayOrientations.Landscape) != 0)
                result |= DisplayOrientation.LandscapeLeft;
            if ((orientations & DisplayOrientations.LandscapeFlipped) != 0)
                result |= DisplayOrientation.LandscapeRight;
            if ((orientations & DisplayOrientations.Portrait) != 0)
                result |= DisplayOrientation.Portrait;
            if ((orientations & DisplayOrientations.PortraitFlipped) != 0)
                result |= DisplayOrientation.PortraitDown;

            return result;
        }
开发者ID:Zodge,项目名称:MonoGame,代码行数:14,代码来源:UAPGameWindow.cs


示例11: VideoRotationLookup

 /// <summary>
 /// finds the degree of rotation to rotate the image/video preview
 /// </summary>
 /// <param name="displayOrientation"></param>
 /// the current phone orientation
 /// <param name="counterclockwise"></param>
 /// checks if rotation should be done clockwise or counterclockwise
 /// <returns></returns>
 private VideoRotation VideoRotationLookup(DisplayOrientations displayOrientation, bool counterclockwise)
 {
     switch (displayOrientation)
     {
         case DisplayOrientations.Landscape:
             return VideoRotation.None;
         case DisplayOrientations.Portrait:
             return (counterclockwise) ? VideoRotation.Clockwise270Degrees : VideoRotation.Clockwise90Degrees;
         case DisplayOrientations.LandscapeFlipped:
             return VideoRotation.Clockwise180Degrees;
         case DisplayOrientations.PortraitFlipped:
             return (counterclockwise) ? VideoRotation.Clockwise90Degrees :
             VideoRotation.Clockwise270Degrees;
         default:
             return VideoRotation.None;
     }
 }
开发者ID:MSRCCS,项目名称:AppSuite,代码行数:25,代码来源:MainPage.xaml.cs


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


示例13: GetPreviewStreamRectInControl

        /// <summary>
        /// Calculates the size and location of the rectangle that contains the preview stream within the preview control, when the scaling mode is Uniform
        /// </summary>
        /// <param name="previewResolution">The resolution at which the preview is running</param>
        /// <param name="previewControl">The control that is displaying the preview using Uniform as the scaling mode</param>
        /// <param name="displayOrientation">The orientation of the display, to account for device rotation and changing of the CaptureElement display ratio compared to the camera stream</param>
        /// <returns></returns>
        public static Rect GetPreviewStreamRectInControl(VideoEncodingProperties previewResolution, CaptureElement previewControl, DisplayOrientations displayOrientation)
        {
            var result = new Rect();

            // In case this function is called before everything is initialized correctly, return an empty result
            if (previewControl == null || previewControl.ActualHeight < 1 || previewControl.ActualWidth < 1 ||
                previewResolution == null || previewResolution.Height == 0 || previewResolution.Width == 0)
            {
                return result;
            }

            var streamWidth = previewResolution.Width;
            var streamHeight = previewResolution.Height;

            // For portrait orientations, the width and height need to be swapped
            if (displayOrientation == DisplayOrientations.Portrait || displayOrientation == DisplayOrientations.PortraitFlipped)
            {
                streamWidth = previewResolution.Height;
                streamHeight = previewResolution.Width;
            }

            // Start by assuming the preview display area in the control spans the entire width and height both (this is corrected in the next if for the necessary dimension)
            result.Width = previewControl.ActualWidth;
            result.Height = previewControl.ActualHeight;

            // If UI is "wider" than preview, letterboxing will be on the sides
            if ((previewControl.ActualWidth / previewControl.ActualHeight > streamWidth / (double)streamHeight))
            {
                var scale = previewControl.ActualHeight / streamHeight;
                var scaledWidth = streamWidth * scale;

                result.X = (previewControl.ActualWidth - scaledWidth) / 2.0;
                result.Width = scaledWidth;
            }
            else // Preview stream is "wider" than UI, so letterboxing will be on the top+bottom
            {
                var scale = previewControl.ActualWidth / streamWidth;
                var scaledHeight = streamHeight * scale;

                result.Y = (previewControl.ActualHeight - scaledHeight) / 2.0;
                result.Height = scaledHeight;
            }

            return result;
        }
开发者ID:nksato,项目名称:Windows-universal-samples,代码行数:52,代码来源:MainPage.xaml.cs


示例14: UpdateVisibility

 private void UpdateVisibility(DisplayOrientations orientation)
 {
     if (HideOnLandscape)
     {
         if (orientation == Windows.Graphics.Display.DisplayOrientations.Landscape ||
            orientation == Windows.Graphics.Display.DisplayOrientations.LandscapeFlipped)
         {
             this.Visibility = Visibility.Collapsed;
         }
         else if (orientation == Windows.Graphics.Display.DisplayOrientations.Portrait ||
                 orientation == Windows.Graphics.Display.DisplayOrientations.PortraitFlipped)
         {
             this.Visibility = Visibility.Visible;
         }
     }
 }
开发者ID:rodrigorodriguessilva,项目名称:ContosoApp,代码行数:16,代码来源:ActionsCommandBar.cs


示例15: 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();
        }
开发者ID:t-angma,项目名称:Windows-universal-samples,代码行数:24,代码来源:mainpage.xaml.cs


示例16: GetDeviceOrientation

		static DeviceOrientation GetDeviceOrientation(DisplayOrientations orientations)
		{
			switch (orientations)
			{
				case DisplayOrientations.Landscape:
				case DisplayOrientations.LandscapeFlipped:
					return DeviceOrientation.Landscape;

				case DisplayOrientations.Portrait:
				case DisplayOrientations.PortraitFlipped:
					return DeviceOrientation.Portrait;

				default:
				case DisplayOrientations.None:
					return DeviceOrientation.Other;
			}
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:17,代码来源:WindowsDeviceInfo.cs


示例17: UWPMediaSink

 /// <summary>
 /// Initializes a new DetectorVideoSink.
 /// </summary>
 /// <param name="detector">The CaptureSourceMarkerDetector to use.</param>
 public UWPMediaSink(CaptureSourceMarkerDetector detector)
 {
     this.detector = detector;
     listener.ConnectionReceived += Listener_ConnectionReceived;
     displayOrientation = displayInformation.CurrentOrientation;
     displayInformation.OrientationChanged += DisplayInformation_OrientationChanged;
 }
开发者ID:amoldeshpande,项目名称:slartoolkit,代码行数:11,代码来源:UWPMediaSink.cs


示例18: DisplayInformation_OrientationChanged

 private void DisplayInformation_OrientationChanged(DisplayInformation sender, Object args)
 {
     displayOrientation = sender.CurrentOrientation;
     if (capturing)
     {
         setPreviewRotation();
     }
 }
开发者ID:amoldeshpande,项目名称:slartoolkit,代码行数:8,代码来源:MainPage.xaml.cs


示例19: PageLoaded

		private async void PageLoaded(object sender, RoutedEventArgs e)
		{
			_displayOrientation = _displayInformation.CurrentOrientation;
			await InitializeCameraAsync();
			StorageFile sf = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///wordlist.txt", UriKind.Absolute));
			var _words = await FileIO.ReadLinesAsync(sf);
			propertySet["tolerance"] = 0.78;
			propertySet["hue"] = 320;
			propertySet["dictionary"] = _words;
			await _mediaCapture.AddVideoEffectAsync(new VideoEffectDefinition(typeof(TresholdVideoEffect).FullName, propertySet), MediaStreamType.VideoPreview);
			var timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(400) };
			var textblockes = new List<TextBlock>();
			timer.Tick += (s, agrs) =>
			{
				List<Point> centers = new List<Point>();
				if (propertySet.ContainsKey("result"))
					Result.Text = propertySet["result"].ToString();
				if (propertySet.ContainsKey("centers"))
					centers = propertySet["centers"] as List<Point>;
				centers = centers.ToList();
				if (!centers.Any())
					return;
				if (textblockes.Count == centers.Count)
				{
					for (int i = 0; i < centers.Count; i++)
					{
						textblockes[i].Margin = new Thickness(0, centers[i].Y, centers[i].X, 0);
					}
				}
				else
				{
					foreach(TextBlock text in textblockes)
					{
						canvas.Children.Remove(text);
					}

					textblockes.Clear();

					for (int i = 0; i < centers.Count; i++)
					{
						var textblock = new TextBlock
						{
							Text = i.ToString(),
							Foreground = new SolidColorBrush(Colors.White),
							FontSize = 24,
							Margin = new Thickness(0, centers[i].Y, centers[i].X, 0)
						};
						canvas.Children.Add(textblock);
						textblockes.Add(textblock);
					}
				}


			};
			timer.Start();
		}
开发者ID:Kerego,项目名称:ArucoSharp,代码行数:56,代码来源:MainPage.xaml.cs


示例20: DisplayInformation_OrientationChanged

        private async void DisplayInformation_OrientationChanged(DisplayInformation sender, object args)
        {
            _displayOrientation = sender.CurrentOrientation;

            if (_isPreviewing)
            {
                await SetPreviewRotationAsync();
            }
        }
开发者ID:lcarli,项目名称:IntelliMarketing,代码行数:9,代码来源:MainPage.xaml.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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