本文整理汇总了C#中DisplayInformation类的典型用法代码示例。如果您正苦于以下问题:C# DisplayInformation类的具体用法?C# DisplayInformation怎么用?C# DisplayInformation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DisplayInformation类属于命名空间,在下文中一共展示了DisplayInformation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: displayInformation_OrientationChanged
/// <summary>
/// Invoked when there is a change in the display orientation.
/// </summary>
/// <param name="sender">
/// DisplayInformation object from which the new Orientation can be determined
/// </param>
/// <param name="e"></param>
void displayInformation_OrientationChanged(DisplayInformation sender, object args)
{
if (null != accelerometerReadingTransform)
{
accelerometerReadingTransform.ReadingTransform = sender.CurrentOrientation;
}
}
示例2: WindowsDeviceInfo
public WindowsDeviceInfo()
{
// TODO: Screen size and DPI can change at any time
_information = DisplayInformation.GetForCurrentView();
_information.OrientationChanged += OnOrientationChanged;
CurrentOrientation = GetDeviceOrientation(_information.CurrentOrientation);
}
示例3: OnDisplayContentsInvalidated
private void OnDisplayContentsInvalidated(DisplayInformation sender, object args)
{
Debug.WriteLine("CompositionImageLoader - Display Contents Invalidated");
//
// This will trigger the device lost event
//
CanvasDevice.GetSharedDevice();
}
示例4: DisplayInformation_OrientationChanged
private void DisplayInformation_OrientationChanged(DisplayInformation sender, Object args)
{
displayOrientation = sender.CurrentOrientation;
if (capturing)
{
setPreviewRotation();
}
}
示例5: UpdateDpi
private void UpdateDpi(DisplayInformation displayInformation)
{
if (displayInformation != null)
{
LogicalDpi = displayInformation.LogicalDpi.ToString();
Scale = (displayInformation.RawPixelsPerViewPixel * 100.0).ToString();
}
}
示例6: DisplayInformation_OrientationChanged
private void DisplayInformation_OrientationChanged(DisplayInformation sender, object args)
{
var strategy = GetHighlightStrategyForOrientation(DisplayInformation.GetForCurrentView().CurrentOrientation);
if (_viewModel.ChangeHighlightStrategyCommand.CanExecute(strategy))
{
_viewModel.ChangeHighlightStrategyCommand.Execute(strategy);
}
}
示例7: MainPage_OrientationChanged
private async void MainPage_OrientationChanged(DisplayInformation sender, object args) {
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) {
var flag = sender.CurrentOrientation != DisplayOrientations.Portrait;
StatusBar statusBar = StatusBar.GetForCurrentView();
if (flag)
await statusBar.HideAsync();
else
await statusBar.ShowAsync();
}
}
示例8: OrientationChanged
private void OrientationChanged(DisplayInformation sender, object args)
{
if (sender.CurrentOrientation == DisplayOrientations.Landscape || sender.CurrentOrientation == DisplayOrientations.LandscapeFlipped)
{
ShellViewModel.SetHamburguerButtonProperties(Visibility.Collapsed);
}
else
{
ShellViewModel.SetHamburguerButtonProperties(Visibility.Visible);
}
}
示例9: DisplayInfo_OrientationChanged
private void DisplayInfo_OrientationChanged(DisplayInformation sender, object args)
{
if (mediaCapture != null)
{
mediaCapture.SetPreviewRotation(frontCam
? VideoRotationLookup(sender.CurrentOrientation, true)
: VideoRotationLookup(sender.CurrentOrientation, false));
var rotation = VideoRotationLookup(sender.CurrentOrientation, false);
mediaCapture.SetRecordRotation(rotation);
}
}
示例10: OnOrientationChanged
private void OnOrientationChanged(DisplayInformation sender, object args)
{
if (sender.CurrentOrientation == DisplayOrientations.Portrait)
{
this.SetDisplayForWidth(this.currentViewHeight);
}
else
{
this.SetDisplayForWidth(this.currentViewWidth);
}
}
示例11: DisplayInfoOrientationChanged
private void DisplayInfoOrientationChanged(DisplayInformation sender, object args)
{
var orientation = sender.CurrentOrientation;
if (orientation == DisplayOrientations.Landscape || orientation == DisplayOrientations.LandscapeFlipped)
{
var res = VisualStateManager.GoToState(this, "Landscape", true);
}
if (orientation == DisplayOrientations.Portrait || orientation == DisplayOrientations.PortraitFlipped)
{
var res = VisualStateManager.GoToState(this, "Portrait", false);
}
}
示例12: Scenario4_OrientationChanged
public Scenario4_OrientationChanged()
{
this.InitializeComponent();
// Get two instances of the accelerometer:
// One that returns the raw accelerometer data
accelerometerOriginal = Accelerometer.GetDefault();
// Other on which the 'ReadingTransform' is updated so that data returned aligns with the request transformation.
accelerometerReadingTransform = Accelerometer.GetDefault();
if(accelerometerOriginal == null || accelerometerReadingTransform == null)
{
rootPage.NotifyUser("No accelerometer found", NotifyType.ErrorMessage);
}
displayInformation = DisplayInformation.GetForCurrentView();
}
示例13: AppViewHelper_OrientationChanged
private static async void AppViewHelper_OrientationChanged(DisplayInformation sender, object args)
{
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
var statusBar = StatusBar.GetForCurrentView();
if (sender.CurrentOrientation == DisplayOrientations.Landscape ||
sender.CurrentOrientation == DisplayOrientations.LandscapeFlipped)
{
await statusBar.HideAsync();
}
else
{
await statusBar.ShowAsync();
}
}
}
示例14: OrientationChanged
partial void OrientationChanged(DisplayInformation info, object sender)
{
switch (info.CurrentOrientation)
{
case DisplayOrientations.Landscape:
case DisplayOrientations.LandscapeFlipped:
PivotGrid(X, Y);
break;
case DisplayOrientations.Portrait:
case DisplayOrientations.PortraitFlipped:
PivotGrid(Y, X);
break;
}
}
示例15: OnNavigatedTo
protected override void OnNavigatedTo(NavigationEventArgs e)
{
// Get two instances of the accelerometer:
// One that returns the raw accelerometer data
accelerometerOriginal = Accelerometer.GetDefault();
// Other on which the 'ReadingTransform' is updated so that data returned aligns with the request transformation.
accelerometerReadingTransform = Accelerometer.GetDefault();
if(accelerometerOriginal == null || accelerometerReadingTransform == null)
{
rootPage.NotifyUser("No accelerometer found", NotifyType.ErrorMessage);
}
else
{
ScenarioEnableButton.IsEnabled = true;
}
// Register for orientation change
displayInformation = DisplayInformation.GetForCurrentView();
displayInformation.OrientationChanged += displayInformation_OrientationChanged;
}