Completed adding WP8 support

This commit is contained in:
EddyVerbruggen 2015-05-13 20:17:14 +02:00
parent 6ef264c1eb
commit 6c975278ea
2 changed files with 10 additions and 4 deletions

View File

@ -2,7 +2,7 @@
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
id="net.yoik.cordova.plugins.screenorientation" id="net.yoik.cordova.plugins.screenorientation"
version="1.3.3"> version="1.3.4">
<name>Screen Orientation</name> <name>Screen Orientation</name>
<description>Adds Screen Orientation API lock and unlock functions to the global screen object in android, iOS and BB10.</description> <description>Adds Screen Orientation API lock and unlock functions to the global screen object in android, iOS and BB10.</description>

View File

@ -43,10 +43,15 @@ namespace WPCordovaClassLib.Cordova.Commands
public class YoikScreenOrientation : BaseCommand public class YoikScreenOrientation : BaseCommand
{ {
#region Static members #region Static members
private const string UNLOCKED = "unlocked"; private const string UNLOCKED = "unlocked";
private const string PORTRAIT = "portrait"; private const string PORTRAIT = "portrait";
private const string PORTRAIT_PRIMARY = "portrait-primary";
private const string PORTRAIT_SECONDARY = "portrait-secondary";
private const string LANDSCAPE = "landscape"; private const string LANDSCAPE = "landscape";
private const string LANDSCAPE_PRIMARY = "landscape-primary";
private const string LANDSCAPE_SECONDARY = "landscape-secondary";
#endregion #endregion
@ -93,11 +98,12 @@ namespace WPCordovaClassLib.Cordova.Commands
if (TryCast(Application.Current.RootVisual, out frame) && if (TryCast(Application.Current.RootVisual, out frame) &&
TryCast(frame.Content, out page)) TryCast(frame.Content, out page))
{ {
if (orientation == PORTRAIT) if (orientation == PORTRAIT || orientation == PORTRAIT_PRIMARY || orientation == PORTRAIT_SECONDARY)
{ {
page.SupportedOrientations = SupportedPageOrientation.Portrait; page.SupportedOrientations = SupportedPageOrientation.Portrait;
} }
else if (orientation == LANDSCAPE)
else if (orientation == LANDSCAPE || orientation == LANDSCAPE_PRIMARY || orientation == LANDSCAPE_SECONDARY)
{ {
page.SupportedOrientations = SupportedPageOrientation.Landscape; page.SupportedOrientations = SupportedPageOrientation.Landscape;
} }