Paint.AppDelegate.SetOrientation C# (CSharp) Méthode

SetOrientation() private méthode

Sets the orientation of the device.
private SetOrientation ( PictureOrientation requiredOrientation ) : void
requiredOrientation PictureOrientation /// The desired orientation. ///
Résultat void
        private void SetOrientation(PictureOrientation requiredOrientation)
        {
            if (this.orientationSetter == null)
            {
                this.orientationSetter = new Selector("setOrientation:");
            }

            bool changeResolution = false;
            UIInterfaceOrientation newOrientation = UIInterfaceOrientation.Portrait;

            if (requiredOrientation == PictureOrientation.Landscape)
            {
                if (UIDevice.CurrentDevice.Orientation != UIDeviceOrientation.LandscapeLeft &&
                    UIDevice.CurrentDevice.Orientation != UIDeviceOrientation.LandscapeRight)
                {
                    newOrientation = UIInterfaceOrientation.LandscapeLeft;
                    changeResolution = true;
                }
            }
            else
            {
                if (UIDevice.CurrentDevice.Orientation != UIDeviceOrientation.Portrait &&
                    UIDevice.CurrentDevice.Orientation != UIDeviceOrientation.PortraitUpsideDown)
                {
                    newOrientation = UIInterfaceOrientation.Portrait;
                    changeResolution = true;
                }
            }

            if (changeResolution)
            {
                Messaging.void_objc_msgSend_int(UIDevice.CurrentDevice.Handle, this.orientationSetter.Handle, (int)newOrientation);
            }
        }