public override void ShutdownVisualTree() { base.ShutdownVisualTree(); this.imageHost.ShutdownVisualTree(); SilverlightNameScope silverlightNameScope = this.rootNameScope as SilverlightNameScope; if (silverlightNameScope != null) { silverlightNameScope.InternalDictionary.Clear(); } DesignSurfacePlatformCaches.GetOrCreateCache <Dictionary <string, List <IEasingFunctionDefinition> > >(this.Platform.Metadata, DesignSurfacePlatformCaches.EasingFunctionsCache).Clear(); }
public static ILayoutDesigner Instantiate(SceneNode node) { LayoutDesignerFactory.LayoutDesignerTypeHandlerFactory orCreateCache = DesignSurfacePlatformCaches.GetOrCreateCache <LayoutDesignerFactory.LayoutDesignerTypeHandlerFactory>(node.Platform.Metadata, DesignSurfacePlatformCaches.LayoutDesignerFactory); ItemsControlElement itemsControlElement = node as ItemsControlElement; Type type = (Type)null; if (itemsControlElement != null && itemsControlElement.ItemsHost != null) { type = orCreateCache.GetLayoutDesignerType((ITypeResolver)itemsControlElement.ProjectContext, itemsControlElement.ProjectContext.GetType(itemsControlElement.ItemsHost.GetType()), true); } if (type == (Type)null) { type = orCreateCache.GetLayoutDesignerType((ITypeResolver)node.ProjectContext, node.Type, false); } if (!(type == (Type)null)) { return((ILayoutDesigner)Activator.CreateInstance(type, (object[])null)); } return((ILayoutDesigner)null); }
private static MoveStrategy CreateByParentType(MoveStrategyContext context, BaseFrameworkElement parentContainer) { MoveStrategyFactory.MoveStrategyTypeHandlerFactory orCreateCache = DesignSurfacePlatformCaches.GetOrCreateCache <MoveStrategyFactory.MoveStrategyTypeHandlerFactory>(parentContainer.Platform.Metadata, DesignSurfacePlatformCaches.MoveStrategyFactoryCache); ItemsControlElement itemsControlElement = parentContainer as ItemsControlElement; TextBlockElement textBlockElement = parentContainer as TextBlockElement; Type type = (Type)null; if (itemsControlElement != null && itemsControlElement.ItemsHost != null) { type = orCreateCache.GetHandlerType((ITypeResolver)itemsControlElement.ProjectContext, itemsControlElement.ItemsHost.GetIType((ITypeResolver)parentContainer.ProjectContext), true); } if (type == (Type)null) { type = orCreateCache.GetHandlerType((ITypeResolver)parentContainer.ProjectContext, parentContainer.Type, false); } if (type == typeof(GenericMoveStrategy)) { ILayoutDesigner designerForParent = parentContainer.ViewModel.GetLayoutDesignerForParent((SceneElement)parentContainer, true); if ((designerForParent.GetWidthConstraintMode(parentContainer, (BaseFrameworkElement)null) & LayoutConstraintMode.CanvasLike) == LayoutConstraintMode.NonOverlappingGridlike && (designerForParent.GetHeightConstraintMode(parentContainer, (BaseFrameworkElement)null) & LayoutConstraintMode.CanvasLike) == LayoutConstraintMode.NonOverlappingGridlike) { type = typeof(LayoutMoveStrategy); } } if (textBlockElement != null && !parentContainer.ViewModel.ProjectContext.IsCapabilitySet(PlatformCapability.SupportsTextBlockInlineUIContainer)) { type = (Type)null; } if (!(type != (Type)null)) { return((MoveStrategy)null); } MoveStrategy moveStrategy = (MoveStrategy)Activator.CreateInstance(type, new object[1] { (object)context }); moveStrategy.LayoutContainer = parentContainer; return(moveStrategy); }
private void AddFoundEasingFunctionBaseTypes(IAssembly assembly, IPlatform platform) { if (assembly == null || !assembly.IsLoaded || platform == null) { return; } bool flag = false; Dictionary <string, List <IEasingFunctionDefinition> > orCreateCache = DesignSurfacePlatformCaches.GetOrCreateCache <Dictionary <string, List <IEasingFunctionDefinition> > >(platform.Metadata, DesignSurfacePlatformCaches.EasingFunctionsCache); IAssembly usingAssemblyName = platform.Metadata.GetPlatformAssemblyUsingAssemblyName(assembly); if (usingAssemblyName != null && AssemblyHelper.IsPlatformAssembly(usingAssemblyName)) { if (orCreateCache.ContainsKey(assembly.FullName)) { this.knownEasingFunctions.AddRange((IEnumerable <IEasingFunctionDefinition>)orCreateCache[assembly.FullName]); return; } flag = true; } bool supportInternal = this.ActiveProjectContext.ProjectAssembly.CompareTo(assembly); IType type1 = platform.Metadata.ResolveType(PlatformTypes.EasingFunctionBase); if (platform.Metadata.IsNullType((ITypeId)type1)) { return; } Type runtimeType = type1.RuntimeType; Type[] types; try { types = AssemblyHelper.GetTypes(assembly); } catch (Exception ex) { return; } foreach (Type type2 in types) { if (runtimeType.IsAssignableFrom(type2)) { ConstructorAccessibility accessibility; ConstructorInfo defaultConstructor = PlatformTypeHelper.GetDefaultConstructor(type2, supportInternal, out accessibility); if (defaultConstructor != (ConstructorInfo)null) { IEasingFunctionDefinition functionDefinition = platform.ViewObjectFactory.Instantiate(defaultConstructor.Invoke((object[])null)) as IEasingFunctionDefinition; if (functionDefinition != null) { this.knownEasingFunctions.Add(functionDefinition); if (flag) { if (!orCreateCache.ContainsKey(assembly.FullName)) { orCreateCache.Add(assembly.FullName, new List <IEasingFunctionDefinition>()); } orCreateCache[assembly.FullName].Add(functionDefinition); } } } } } }
public DocumentNode GetThemeResourceFromPlatform(IPlatform platform, object resourceKey, out IList <DocumentCompositeNode> auxillaryResources) { auxillaryResources = (IList <DocumentCompositeNode>)null; FolderBasedThemeManager basedThemeManager = platform.ThemeManager as FolderBasedThemeManager; if (basedThemeManager == null) { return((DocumentNode)null); } using (TemporaryCursor.SetWaitCursor()) { Dictionary <ThemeContentProvider.PlatformSpecificDocumentReference, ThemeContentProvider.SystemThemeContentProvider> orCreateCache = DesignSurfacePlatformCaches.GetOrCreateCache <Dictionary <ThemeContentProvider.PlatformSpecificDocumentReference, ThemeContentProvider.SystemThemeContentProvider> >(platform.Metadata, DesignSurfacePlatformCaches.ThemeContentProviderCache); DocumentReference fileThemeReference = ThemeContentProvider.GetFileThemeReference(basedThemeManager.ThemeFolder, basedThemeManager.CurrentTheme); return(this.GetResourceInternal(orCreateCache, (ThemeManager)basedThemeManager, (IProjectContext)null, fileThemeReference, (IAssembly)null, (string)null, resourceKey, out auxillaryResources)); } }