Пример #1
0
        private ThemeContentProvider.SystemThemeContentProvider GetCachedThemeContent(Dictionary <ThemeContentProvider.PlatformSpecificDocumentReference, ThemeContentProvider.SystemThemeContentProvider> themeCache, ThemeManager manager, IProjectContext projectContext, DocumentReference reference, IAssembly themeAssembly, string themeAssemblyPath, ITextBufferService textBufferService)
        {
            ThemeContentProvider.PlatformSpecificDocumentReference key = new ThemeContentProvider.PlatformSpecificDocumentReference(reference, projectContext != null ? projectContext.TargetFramework : (FrameworkName)null);
            ThemeContentProvider.SystemThemeContentProvider        themeContentProvider;
            if (!themeCache.TryGetValue(key, out themeContentProvider))
            {
                Encoding    encoding;
                ITextBuffer textBuffer = themeAssembly != null?ThemeManager.LoadResource(themeAssembly, themeAssemblyPath, textBufferService, out encoding) : ThemeContentProvider.LoadReference(reference, textBufferService, out encoding);

                IDocumentLocator documentLocator = DocumentReferenceLocator.GetDocumentLocator(reference);
                IDocumentContext userContext     = projectContext == null ? (IDocumentContext)null : (IDocumentContext) new DocumentContext(projectContext, documentLocator);
                XamlDocument     theme           = manager.GetTheme(documentLocator, themeAssembly != null, userContext, textBuffer, encoding);
                if (theme != null)
                {
                    bool flag1 = false;
                    try
                    {
                        if (projectContext != null)
                        {
                            if (!projectContext.IsCapabilitySet(PlatformCapability.IsWpf))
                            {
                                if (themeAssembly != null)
                                {
                                    bool flag2 = false;
                                    foreach (IAssembly assembly in (projectContext.Platform.Metadata as PlatformTypes).DefaultAssemblyReferences)
                                    {
                                        if (assembly == themeAssembly)
                                        {
                                            flag2 = true;
                                            break;
                                        }
                                    }
                                    if (flag2)
                                    {
                                        flag1 = true;
                                        AnimationEditor.ConvertFromToAnimations(theme.RootNode);
                                    }
                                }
                            }
                        }
                    }
                    catch
                    {
                        if (flag1)
                        {
                            theme = manager.GetTheme(documentLocator, themeAssembly != null, userContext, textBuffer, encoding);
                        }
                    }
                    themeContentProvider = new ThemeContentProvider.SystemThemeContentProvider(this.designerContext, theme);
                    themeCache[key]      = themeContentProvider;
                }
            }
            return(themeContentProvider);
        }
Пример #2
0
 protected override bool UpdateAssets()
 {
     if (this.originalDocumentProvider == null)
     {
         Encoding encoding;
         this.originalDocumentProvider = new ResourceDictionaryContentProvider(this.designerContext, this.themeManager.GetTheme(DocumentReferenceLocator.GetDocumentLocator(this.documentReference), false, (IDocumentContext)null, ThemeContentProvider.LoadReference(this.documentReference, this.designerContext.TextBufferService, out encoding), encoding));
         this.ContentProvider          = this.GetProvider(this.designerContext.ActiveProject);
     }
     return(base.UpdateAssets());
 }