本文整理汇总了C#中SimpleOrientation类的典型用法代码示例。如果您正苦于以下问题:C# SimpleOrientation类的具体用法?C# SimpleOrientation怎么用?C# SimpleOrientation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleOrientation类属于命名空间,在下文中一共展示了SimpleOrientation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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);
}
示例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();
}
示例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;
}
}
示例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());
}
}
示例9: OrientationSensor_OrientationChanged
private void OrientationSensor_OrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
{
if (args.Orientation != SimpleOrientation.Faceup && args.Orientation != SimpleOrientation.Facedown)
{
_deviceOrientation = args.Orientation;
}
}
示例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;
}
}
示例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;
}
}
示例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;
// }
//}
}
示例13: InitializeCameraAsync
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
if (orientationSensor != null)
{
deviceOrientation = orientationSensor.GetCurrentOrientation();
}
await InitializeCameraAsync();
RegisterEventHandlers();
}
示例14: 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();
}
示例15: RegisterOrientationEventHandlers
private void RegisterOrientationEventHandlers()
{
if (_orientationSensor != null)
{
_orientationSensor.OrientationChanged += OrientationSensor_OrientationChanged;
_deviceOrientation = _orientationSensor.GetCurrentOrientation();
}
_displayInformation.OrientationChanged += DisplayInformation_OrientationChanged;
_displayOrientation = _displayInformation.CurrentOrientation;
}