public ScreenSizeHelper GetScreenSize() { ScreenSizeHelper helper = new ScreenSizeHelper { PlatformName = "WinPhone8.1", ScreenHeight = Window.Current.Bounds.Height, ScreenWidth = Window.Current.Bounds.Width }; return(helper); }
public ScreenSizeHelper GetScreenSize() { ScreenSizeHelper helper = new ScreenSizeHelper { PlatformName = "iOS", ScreenWidth = UIScreen.MainScreen.Bounds.Width, ScreenHeight = UIScreen.MainScreen.Bounds.Height }; return(helper); }
public ScreenSizeHelper GetScreenSize() { var metrics = Resources.System.DisplayMetrics; ScreenSizeHelper helper = new ScreenSizeHelper { PlatformName = "Android", ScreenHeight = ConvertPixelsToDp(metrics.HeightPixels), ScreenWidth = ConvertPixelsToDp(metrics.WidthPixels) }; return(helper); }
public static void SetStyle() { string themesUri = null; bool x; string width = "W" + ScreenSizeHelper.WindowSizeWidth(); ScreenSizeHelper.ScreenWidthEnum screenWidthValue; x = Enum.TryParse <ScreenSizeHelper.ScreenWidthEnum>(width, out screenWidthValue); if (x) { switch ((ScreenSizeHelper.ScreenWidthEnum)Enum.Parse(typeof(ScreenSizeHelper.ScreenWidthEnum), width)) { case ScreenSizeHelper.ScreenWidthEnum.W384: themesUri = "ms-appx:///Themes/W384/DataItemStyle.xaml"; break; case ScreenSizeHelper.ScreenWidthEnum.W400: themesUri = "ms-appx:///Themes/W400/DataItemStyle.xaml"; break; case ScreenSizeHelper.ScreenWidthEnum.W450: themesUri = "ms-appx:///Themes/W450/DataItemStyle.xaml"; break; case ScreenSizeHelper.ScreenWidthEnum.W491: themesUri = "ms-appx:///Themes/W491/DataItemStyle.xaml"; break; case ScreenSizeHelper.ScreenWidthEnum.W514: themesUri = "ms-appx:///Themes/W514/DataItemStyle.xaml"; break; default: themesUri = "ms-appx:///Themes/W400/DataItemStyle.xaml"; break; } } else { themesUri = "ms-appx:///Themes/W400/DataItemStyle.xaml"; } var appTheme = new ResourceDictionary { Source = new Uri(themesUri, UriKind.Absolute) }; Application.Current.Resources.MergedDictionaries.Add(appTheme); }