Пример #1
0
        public static DeviceOrientation GetDeviceOrientation(this Window window)
        {
            DeviceOrientation orientation = DeviceOrientation.Other;
            var isPortraitDevice          = Forms.NaturalOrientation.IsPortrait();

            switch (window.Rotation)
            {
            case 0:
            case 180:
                orientation = isPortraitDevice ? DeviceOrientation.Portrait : DeviceOrientation.Landscape;
                break;

            case 90:
            case 270:
                orientation = isPortraitDevice ? DeviceOrientation.Landscape : DeviceOrientation.Portrait;
                break;
            }
            return(orientation);
        }
Пример #2
0
        Xamarin.Forms.Internals.DeviceOrientation GetDeviceOrientation()
        {
            Xamarin.Forms.Internals.DeviceOrientation orientation = Xamarin.Forms.Internals.DeviceOrientation.Other;
            var isPortraitDevice = Xamarin.Forms.Platform.Tizen.Forms.NaturalOrientation.IsPortrait();

            switch (Window.Rotation)
            {
            case 0:
            case 180:
                orientation = isPortraitDevice ? Xamarin.Forms.Internals.DeviceOrientation.Portrait : Xamarin.Forms.Internals.DeviceOrientation.Landscape;
                break;

            case 90:
            case 270:
                orientation = isPortraitDevice ? Xamarin.Forms.Internals.DeviceOrientation.Landscape : Xamarin.Forms.Internals.DeviceOrientation.Portrait;
                break;
            }
            return(orientation);
        }