From 00e8999eeb03291baef71b5e1b1ce380e12f0449 Mon Sep 17 00:00:00 2001 From: sgrebnov Date: Sat, 25 Apr 2015 14:56:39 -0700 Subject: [PATCH] CB-8750 [wp8]: Rewrite resoultion helper --- src/wp/ResolutionHelper.cs | 39 +++++++++----------------------------- 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/src/wp/ResolutionHelper.cs b/src/wp/ResolutionHelper.cs index 4d7996c..050c392 100644 --- a/src/wp/ResolutionHelper.cs +++ b/src/wp/ResolutionHelper.cs @@ -21,39 +21,18 @@ namespace WPCordovaClassLib.Cordova.Commands public enum Resolutions { WVGA, WXGA, HD }; public static class ResolutionHelper - { - private static bool IsWvga + { + public static Resolutions CurrentResolution { get { - return Application.Current.Host.Content.ScaleFactor == 100; - } - } - - private static bool IsWxga - { - get - { - 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"); + switch (Application.Current.Host.Content.ScaleFactor) + { + case 100: return Resolutions.WVGA; + case 160: return Resolutions.WXGA; + case 150: return Resolutions.HD; + } + throw new InvalidOperationException("Unknown resolution"); } } }