CB-8750 [wp8]: Rewrite resoultion helper

This commit is contained in:
sgrebnov 2015-04-25 14:56:39 -07:00
parent 9549ce3a9d
commit 00e8999eeb

View File

@ -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");
} }
} }
} }