public void LoadWithErrorDialog(AppSettings settings) { var theme = Cache.GetByFilename(settings.Theme, out var cte); if (theme == null) { LoggerSingleton.Inst.ShowExceptionDialog($"Could not load theme {settings.Theme}", cte); theme = Cache.GetFallback(); } else if (!theme.Compatibility.Includes(LoggerSingleton.Inst.AppVersion)) { LoggerSingleton.Inst.ShowExceptionDialog($"Could not load theme {settings.Theme}\r\nThe theme does not support the current version of AlephNote ({LoggerSingleton.Inst.AppVersion})", null); theme = Cache.GetFallback(); } ChangeTheme(theme); }
public void LoadWithErrorDialog(AppSettings settings) { var theme = Cache.GetThemeByFilename(settings.Theme, out var cte); if (theme == null) { LoggerSingleton.Inst.ShowExceptionDialog($"Could not load theme {settings.Theme}", cte); theme = Cache.GetFallback(); } else if (!theme.Compatibility.Includes(AlephAppContext.AppVersion)) { LoggerSingleton.Inst.ShowExceptionDialog($"Could not load theme {settings.Theme}\r\nThe theme does not support the current version of AlephNote ({AlephAppContext.AppVersion.Item1}.{AlephAppContext.AppVersion.Item2}.{AlephAppContext.AppVersion.Item3}.{AlephAppContext.AppVersion.Item4})", null); theme = Cache.GetFallback(); } List <AlephTheme> modifiers = new List <AlephTheme>(); foreach (var mod in settings.ThemeModifier) { var thememod = Cache.GetModifierByFilename(mod, out var cmte); if (thememod == null) { LoggerSingleton.Inst.ShowExceptionDialog($"Could not load theme-modifier {settings.Theme}", cmte); continue; } else if (!thememod.Compatibility.Includes(AlephAppContext.AppVersion)) { LoggerSingleton.Inst.ShowExceptionDialog($"Could not load theme-modifier {settings.Theme}\r\nThe modifier does not support the current version of AlephNote ({AlephAppContext.AppVersion.Item1}.{AlephAppContext.AppVersion.Item2}.{AlephAppContext.AppVersion.Item3}.{AlephAppContext.AppVersion.Item4})", null); continue; } modifiers.Add(thememod); } LoggerSingleton.Inst.Info("ThemeManager", $"Set application theme to {theme.Name} (modifiers: {string.Join(" + ", modifiers.Select(m => "["+m.Name+"]"))})"); ChangeTheme(theme, modifiers); }
private ThemeManager(ThemeCache c) { Cache = c; CurrentBaseTheme = c.GetFallback(); }