Convert Simple Orientation To Clockwise Degrees - CSharp Windows.Devices.Sensors

CSharp examples for Windows.Devices.Sensors:SimpleOrientation

Description

Convert Simple Orientation To Clockwise Degrees

Demo Code


using Windows.Storage.FileProperties;
using Windows.Media.Capture;
using Windows.Graphics.Display;
using Windows.Devices.Sensors;
using Windows.Devices.Enumeration;
using System;/*from w w w  . j a v  a2  s  . c o m*/

public class Main{
        public static int ConvertSimpleOrientationToClockwiseDegrees(SimpleOrientation orientation)
        {
            switch (orientation)
            {
                case SimpleOrientation.Rotated90DegreesCounterclockwise:
                    return 270;
                case SimpleOrientation.Rotated180DegreesCounterclockwise:
                    return 180;
                case SimpleOrientation.Rotated270DegreesCounterclockwise:
                    return 90;
                case SimpleOrientation.NotRotated:
                default:
                    return 0;
            }
        }
}

Related Tutorials