本文整理汇总了C#中PageOrientation.HasFlag方法的典型用法代码示例。如果您正苦于以下问题:C# PageOrientation.HasFlag方法的具体用法?C# PageOrientation.HasFlag怎么用?C# PageOrientation.HasFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageOrientation
的用法示例。
在下文中一共展示了PageOrientation.HasFlag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetRotation
private void SetRotation(PageOrientation orientation)
{
if (orientation.HasFlag(PageOrientation.LandscapeLeft))
{
BufferRotate = 0;
}
else if (orientation.HasFlag(PageOrientation.LandscapeRight))
{
BufferRotate = 180;
}
else if (orientation.HasFlag(PageOrientation.PortraitUp))
{
//The back camera renders upsidedown so use a different rotate
if (Capture != null && Capture.SensorLocation == CameraSensorLocation.Front)
{
BufferRotate = 270;
}
else if (Capture != null && Capture.SensorLocation == CameraSensorLocation.Back)
{
BufferRotate = 90;
}
else
{
BufferRotate = 270;
}
}
else if (orientation.HasFlag(PageOrientation.PortraitDown))
{
//The back camera renders upsidedown so use a different rotate
if (Capture != null && Capture.SensorLocation == CameraSensorLocation.Front)
{
BufferRotate = 90;
}
else if (Capture != null && Capture.SensorLocation == CameraSensorLocation.Back)
{
BufferRotate = 270;
}
else
{
BufferRotate = 90;
}
}
if (Preview != null)
{
Preview.Rotate(BufferRotate);
}
}
示例2: ApplyOrientation
/// <summary>
/// Apply orientation specific layout.
/// </summary>
/// <param name="orientation">Page orientation</param>
private void ApplyOrientation(PageOrientation orientation)
{
if (orientation.HasFlag(PageOrientation.Portrait))
{
TitleImage.Visibility = Visibility.Visible;
Pivot.Margin = new Thickness(0);
}
else
{
TitleImage.Visibility = Visibility.Collapsed;
Pivot.Margin = new Thickness(0, -16, 0, 0);
}
}