internal static bool GetThemeFromResources(AppTheme presetTheme, ResourceDictionary dict, ref Tuple <AppTheme, Accent> detectedAccentTheme) { bool flag; AppTheme appTheme = presetTheme; Accent accent = ThemeManager.GetAccent(dict); Accent accent1 = accent; if (accent != null) { detectedAccentTheme = Tuple.Create <AppTheme, Accent>(appTheme, accent1); return(true); } using (IEnumerator <ResourceDictionary> enumerator = dict.MergedDictionaries.GetEnumerator()) { while (enumerator.MoveNext()) { if (!ThemeManager.GetThemeFromResources(presetTheme, enumerator.Current, ref detectedAccentTheme)) { continue; } flag = true; return(flag); } return(false); } return(flag); }
private static Tuple <AppTheme, Accent> DetectAppStyle(ResourceDictionary resources) { if (resources == null) { throw new ArgumentNullException("resources"); } AppTheme appTheme = null; Tuple <AppTheme, Accent> tuple = null; if (!ThemeManager.DetectThemeFromResources(ref appTheme, resources) || !ThemeManager.GetThemeFromResources(appTheme, resources, ref tuple)) { return(null); } return(new Tuple <AppTheme, Accent>(tuple.Item1, tuple.Item2)); }