CB-8750 [wp8]: Rewrite resoultion helper
This commit is contained in:
parent
9549ce3a9d
commit
00e8999eeb
@ -21,39 +21,18 @@ namespace WPCordovaClassLib.Cordova.Commands
|
|||||||
public enum Resolutions { WVGA, WXGA, HD };
|
public enum Resolutions { WVGA, WXGA, HD };
|
||||||
|
|
||||||
public static class ResolutionHelper
|
public static class ResolutionHelper
|
||||||
{
|
{
|
||||||
private static bool IsWvga
|
public static Resolutions CurrentResolution
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Application.Current.Host.Content.ScaleFactor == 100;
|
switch (Application.Current.Host.Content.ScaleFactor)
|
||||||
}
|
{
|
||||||
}
|
case 100: return Resolutions.WVGA;
|
||||||
|
case 160: return Resolutions.WXGA;
|
||||||
private static bool IsWxga
|
case 150: return Resolutions.HD;
|
||||||
{
|
}
|
||||||
get
|
throw new InvalidOperationException("Unknown resolution");
|
||||||
{
|
|
||||||
return Application.Current.Host.Content.ScaleFactor == 160;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool IsHD
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Application.Current.Host.Content.ScaleFactor == 150;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Resolutions CurrentResolution
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (IsWvga) return Resolutions.WVGA;
|
|
||||||
else if (IsWxga) return Resolutions.WXGA;
|
|
||||||
else if (IsHD) return Resolutions.HD;
|
|
||||||
else throw new InvalidOperationException("Unknown resolution");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user