public static AppTheme GetAppTheme(ResourceDictionary resources) { if (resources == null) { throw new ArgumentNullException("resources"); } return(ThemeManager.AppThemes.FirstOrDefault <AppTheme>((AppTheme x) => ThemeManager.AreResourceDictionarySourcesEqual(x.Resources.Source, resources.Source))); }
public static Accent GetAccent(ResourceDictionary resources) { if (resources == null) { throw new ArgumentNullException("resources"); } Accent accent = ThemeManager.Accents.FirstOrDefault <Accent>((Accent x) => ThemeManager.AreResourceDictionarySourcesEqual(x.Resources.Source, resources.Source)); if (accent != null) { return(accent); } if (!(resources.Source == null) || !ThemeManager.IsAccentDictionary(resources)) { return(null); } return(new Accent() { Name = "Runtime accent", Resources = resources }); }