示例#1
0
 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)));
 }
示例#2
0
        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
            });
        }