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


C# DisplayOrientations类代码示例

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


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

示例12: DisplayInformation_OrientationChanged

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

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

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

示例15: StartPreviewAsync

        private async Task StartPreviewAsync()
        {
            // Prevent the device from sleeping while the preview is running
            _displayRequest.RequestActive();

            // Set the preview source in the UI and mirror it if necessary
            HoldCamera.Source = mc;
            HoldCamera.FlowDirection = _mirroringPreview ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;

            // Start the preview
            try
            {
                await mc.StartPreviewAsync();
                _isPreviewing = true;
                _previewProperties = mc.VideoDeviceController.GetMediaStreamProperties(MediaStreamType.VideoPreview);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Exception when starting the preview: {0}", ex.ToString());
            }

            // Initialize the preview to the current orientation
            if (_previewProperties != null)
            {
                _displayOrientation = _displayInformation.CurrentOrientation;

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


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