public static void ChangeTheme(string theme) { if (theme != null) { Theming.ChangeTheme((Theming.Themes)Enum.Parse(typeof(Theming.Themes), theme)); } }
public App() { InitializeComponent(); if (!DesignMode.IsDesignModeEnabled) { // Don't run in the Previewer //ApplyAccentColor((Color)Resources["UIAccent"]); //Theming.ChangeTheme(Theming.Themes.Comos); // register some services. var db = Services.XServices.Instance.GetService <Services.IDatabase>(); Services.XServices.Instance.AddService <Services.XDatabase>( new Services.XDatabase(db)); string theme = db.ReadSetting("Theme", "Siemens"); Theming.ChangeTheme(theme); if (Device.RuntimePlatform != Device.UWP) { // For android needs to be done here. App.WidthPixels = Services.XServices.Instance.GetService <Services.IPlatformSystem>().GetScreenWidthPixels; App.HeightPixels = Services.XServices.Instance.GetService <Services.IPlatformSystem>().GetScreenHeightPixels; App.PixelDensity = Services.XServices.Instance.GetService <Services.IPlatformSystem>().GetScreenDensity; } else { App.PixelDensity = 1; } App.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)); var web = Services.XServices.Instance.GetService <ComosWebSDK.IComosWeb>(); var menuPage = new Pages.PageMenu(web); Navigation = new NavigationPage(new Pages.PageLogin()); Navigation.Popped += Navigation_Popped; Navigation.PoppedToRoot += Navigation_PoppedToRoot; m_PageRoot = new Pages.PageRoot(); m_PageRoot.Master = menuPage; m_PageRoot.Detail = Navigation; MainPage = m_PageRoot; m_PageRoot.IsPresentedChanged += M_PageRoot_IsPresentedChanged; if (Device.RuntimePlatform == Device.UWP) { MainPage.Appearing += MainPage_Appearing; } } }