public DocumentNode GetThemeResourceFromProject(IProject project, object resourceKey, out IList <DocumentCompositeNode> auxillaryResources) { auxillaryResources = (IList <DocumentCompositeNode>)null; IProjectContext projectContext = (IProjectContext)ProjectXamlContext.GetProjectContext(project); if (projectContext == null) { return((DocumentNode)null); } string rootDirectory = Path.Combine(project.ProjectRoot.Path, "Themes"); foreach (string currentTheme in ThemeContentProvider.GetThemeNames(projectContext)) { DocumentReference fileThemeReference = ThemeContentProvider.GetFileThemeReference(rootDirectory, currentTheme); IProjectItem projectItem = project.FindItem(fileThemeReference); if (projectItem != null) { ResourceDictionaryContentProvider resourceDictionary = this.designerContext.ResourceManager.GetContentProviderForResourceDictionary(projectItem); if (resourceDictionary != null) { DocumentNode projectResource = this.FindProjectResource(project, resourceDictionary, projectItem.DocumentReference.Path, resourceKey, out auxillaryResources); if (projectResource != null) { return(projectResource); } } } } return((DocumentNode)null); }
public DocumentNode GetThemeResourceFromAssembly(IProjectContext projectContext, IAssembly themeRuntimeAssembly, IAssembly themeTargetAssembly, object resourceKey, out IList <DocumentCompositeNode> auxillaryResources) { using (TemporaryCursor.SetWaitCursor()) { foreach (string str1 in ThemeContentProvider.GetThemeNames(projectContext)) { string str2 = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "themes/{0}.xaml", new object[1] { (object)str1.ToLowerInvariant() }); IProjectContext projectContext1 = (IProjectContext) new ThemeContentProvider.TargetThemeAssemblyProjectContext(projectContext, themeRuntimeAssembly, this.designerContext.AssemblyService); DocumentReference theme = DocumentReference.Create(Path.Combine(themeTargetAssembly.Name, str2)); DocumentNode resourceInternal = this.GetResourceInternal(this.projectThemeCache, projectContext.Platform.ThemeManager, projectContext1, theme, themeTargetAssembly, str2, resourceKey, out auxillaryResources); if (resourceInternal != null) { return(resourceInternal); } } if (projectContext.Platform.ThemeManager.AllowFallbackToPlatform) { return(this.GetThemeResourceFromPlatform(projectContext.Platform, resourceKey, out auxillaryResources)); } auxillaryResources = (IList <DocumentCompositeNode>)null; return((DocumentNode)null); } }