public SkinSelectItemView(SkinBase skin) { InitializeComponent(); BindingContext = skin; if (Visual.Current.GetType() == skin.GetType()) { btApply.Text = "Это текущий скин"; btApply.InputTransparent = true; btApply.Selected = true; btApply.IsEnabled = false; btApply.Icon = Icon.Check; } }
public static void ApplySkin(SkinBase skin) { Current = skin; var fileManager = Singleton.Resolve <DataManagerBase>(); fileManager.Set(SkinNameKey, skin.GetType().FullName); // Reinit main page var mainPage = new MainPage(); Application.Current.MainPage = mainPage; mainPage.InitializeManager(); }
static Visual() { var fileManager = Singleton.Resolve <DataManagerBase>(); if (fileManager.Has(SkinNameKey)) { var skinName = fileManager.Get <string>(SkinNameKey); var skinBaseType = typeof(SkinBase); var types = Assembly .GetExecutingAssembly() .GetTypes() .Where(x => x != skinBaseType && skinBaseType.IsAssignableFrom(x)); var skinType = types.FirstOrDefault(x => x.FullName == skinName); if (skinType != null) { Current = Activator.CreateInstance(skinType) as SkinBase; } } }