public DictionaryEntryNode Instantiate(object key, SceneNode value) { DictionaryEntryNode dictionaryEntryNode = (DictionaryEntryNode)this.Instantiate(value.ViewModel, PlatformTypes.DictionaryEntry); dictionaryEntryNode.Key = key; dictionaryEntryNode.Value = value; return(dictionaryEntryNode); }
void IStoryboardContainer.AddResourceStoryboard(string name, StoryboardTimelineSceneNode storyboard) { DictionaryEntryNode dictionaryEntryNode = DictionaryEntryNode.Factory.Instantiate((object)name, (SceneNode)storyboard); if ((IPropertyId)storyboard.Platform.Metadata.ResolveProperty(StyleNode.ResourcesProperty) == null) { return; } Microsoft.Expression.DesignSurface.Utility.ResourceHelper.EnsureResourceDictionaryNode((SceneNode)this).Add(dictionaryEntryNode); }
protected virtual DocumentNode ResolveDefaultStyleAsDocumentNode(IType targetType, IPropertyId propertyKey) { DocumentNode node = (DocumentNode)null; IViewStyle viewStyle = (IViewStyle)null; if (this.IsViewObjectValid) { ReferenceStep referenceStep = propertyKey as ReferenceStep; if (referenceStep != null && this.ProjectContext.IsCapabilitySet(PlatformCapability.IsWpf)) { viewStyle = this.Platform.ViewObjectFactory.Instantiate(referenceStep.GetCurrentValue(this.ViewObject.PlatformSpecificObject)) as IViewStyle; if (viewStyle != null && viewStyle.StyleTargetType != targetType.RuntimeType) { viewStyle = (IViewStyle)null; } if (viewStyle != null) { node = this.ViewModel.DefaultView.GetCorrespondingDocumentNode((IViewObject)viewStyle, true); if (node == null && this.DesignerContext.DesignerDefaultPlatformService.DefaultPlatform == this.Platform) { node = this.CreateNode(viewStyle.PlatformSpecificObject); } } } } for (IType type = this.ProjectContext.GetType(this.MetadataFactory.GetMetadata(targetType.RuntimeType).GetStylePropertyTargetType(propertyKey)); node == null && type != null && !PlatformTypes.Object.Equals((object)type); type = type.BaseType) { IList <DocumentCompositeNode> auxillaryResources = (IList <DocumentCompositeNode>)null; if (PlatformTypes.IsPlatformType((ITypeId)type)) { node = this.DesignerContext.ThemeContentProvider.GetThemeResourceFromPlatform(this.Platform, (object)type.RuntimeType, out auxillaryResources); } else { foreach (IProject project in this.DesignerContext.ProjectManager.CurrentSolution.Projects) { IProjectContext projectContext = (IProjectContext)ProjectXamlContext.GetProjectContext(project); if (projectContext != null && type.RuntimeAssembly.Equals((object)projectContext.ProjectAssembly)) { node = this.DesignerContext.ThemeContentProvider.GetThemeResourceFromProject(project, (object)type.RuntimeType, out auxillaryResources); if (node == null && !this.ProjectContext.IsCapabilitySet(PlatformCapability.IsWpf)) { node = this.DesignerContext.ThemeContentProvider.GetThemeResourceFromAssembly(this.ProjectContext, type.RuntimeAssembly, type.RuntimeAssembly, (object)type.RuntimeType, out auxillaryResources); } } } } if (node != null) { node = node.Clone(this.DocumentContext); if (auxillaryResources != null && auxillaryResources.Count > 0) { StyleNode styleNode = (StyleNode)this.ViewModel.GetSceneNode(node); if (styleNode.AreResourcesSupported) { if (styleNode.Resources == null) { styleNode.Resources = (ResourceDictionaryNode)this.ViewModel.CreateSceneNode(PlatformTypes.ResourceDictionary); } for (int index = auxillaryResources.Count - 1; index >= 0; --index) { DictionaryEntryNode dictionaryEntryNode = (DictionaryEntryNode)this.ViewModel.GetSceneNode(auxillaryResources[index].Clone(this.DocumentContext)); styleNode.Resources.Insert(0, dictionaryEntryNode); } } } } } if (viewStyle == null && this.ProjectContext.IsCapabilitySet(PlatformCapability.IsWpf)) { ReferenceStep referenceStep = propertyKey as ReferenceStep; if (referenceStep != null) { System.Windows.Style style = referenceStep.GetDefaultValue(targetType.RuntimeType) as System.Windows.Style; if (style != null) { node = this.CreateNode((object)style); } } } return(node); }