public override IDropAction CreateInstance(DragDropContext context) { this.CheckNullArgument((object)context, "context"); TypeAsset result1 = (TypeAsset)null; if (DragSourceHelper.FirstDataOfType <TypeAsset>(context.Data, ref result1) && PlatformTypes.IsEffectType((ITypeId)result1.Type)) { ISceneInsertionPoint insertionPoint = this.GetInsertionPoint((object)result1, context); if (insertionPoint != null) { return((IDropAction) new DropEffectAssetAction(result1, insertionPoint)); } } DocumentNodeMarkerSortedList result2 = (DocumentNodeMarkerSortedList)null; if (DragSourceHelper.FirstDataOfType <DocumentNodeMarkerSortedList>(context.Data, ref result2) && result2.Count == 1) { DocumentNodeMarker marker = result2.MarkerAt(0); if (marker != null && marker.Node != null && PlatformTypes.IsEffectType((ITypeId)marker.Node.Type)) { SceneViewModel viewModel = context.Target.TimelineItemManager.ViewModel; SceneNode sceneNode = SceneNode.FromMarker <SceneNode>(marker, viewModel); if (sceneNode != null) { ISceneInsertionPoint insertionPoint = this.GetInsertionPoint((object)sceneNode, context); if (insertionPoint != null) { return((IDropAction) new DropEffectSceneNodeAction(sceneNode, insertionPoint)); } } } } return((IDropAction)null); }
internal static IProperty GetPropertyToInsert(SceneElement element, ITypeId typeToInsert, SceneNode child) { IProperty property = (IProperty)null; if (typeToInsert == null) { if (child != null) { if (child.DocumentNode.SitePropertyKey != null) { return(child.DocumentNode.SitePropertyKey); } if (child.DocumentNode.Parent.SitePropertyKey != null) { return(child.DocumentNode.Parent.SitePropertyKey); } } return(element.InsertionTargetProperty); } IType type = typeToInsert != null?element.ProjectContext.ResolveType(typeToInsert) : (IType)null; if (type != null) { if (PlatformTypes.IsEffectType((ITypeId)type)) { property = element.ProjectContext.ResolveProperty(Base2DElement.EffectProperty); } else if (ProjectNeutralTypes.BehaviorTriggerAction.IsAssignableFrom((ITypeId)type)) { property = element.ProjectContext.ResolveProperty(BehaviorHelper.BehaviorTriggersProperty); } else if (ProjectNeutralTypes.Behavior.IsAssignableFrom((ITypeId)type)) { property = element.ProjectContext.ResolveProperty(BehaviorHelper.BehaviorsProperty); } else if (ProjectNeutralTypes.DataGridColumn.IsAssignableFrom((ITypeId)type)) { property = element.ProjectContext.ResolveProperty(DataGridElement.ColumnsProperty); } } return(property ?? element.InsertionTargetProperty); }
public ISceneInsertionPoint Create(object data) { if (this.Element != null) { TypeAsset typeAsset = data as TypeAsset; if (typeAsset != null && PlatformTypes.IsEffectType((ITypeId)typeAsset.Type)) { IProperty targetProperty = this.Element.ProjectContext.ResolveProperty(Base2DElement.EffectProperty); if (targetProperty != null) { return((ISceneInsertionPoint) new PropertySceneInsertionPoint(this.Element, targetProperty)); } } SceneNode sceneNode = data as SceneNode; if (sceneNode != null && PlatformTypes.IsEffectType((ITypeId)sceneNode.Type)) { return((ISceneInsertionPoint) new PropertySceneInsertionPoint(this.Element, this.Element.ProjectContext.ResolveProperty(Base2DElement.EffectProperty))); } } return((ISceneInsertionPoint)null); }
public static bool IsTypeCompatible(SceneNode sceneNode, IType typeToInsert, IProperty property) { if (typeToInsert.RuntimeType == (Type)null || !sceneNode.ProjectContext.PlatformMetadata.IsSupported((ITypeResolver)sceneNode.ProjectContext, (ITypeId)typeToInsert) || PlatformTypes.UserControl.IsAssignableFrom((ITypeId)sceneNode.Type) && PropertySceneInsertionPoint.ContentProperty.Equals((object)property) && sceneNode.ViewModel.RootNode != sceneNode || (PlatformTypes.Window.IsAssignableFrom((ITypeId)typeToInsert) || PlatformTypes.Page.IsAssignableFrom((ITypeId)typeToInsert) || !property.TargetType.IsAssignableFrom(sceneNode.TargetType) || PlatformTypes.IsEffectType((ITypeId)typeToInsert) && property.PropertyType.Equals((object)PlatformTypes.Object))) { return(false); } if (property.PropertyType.IsAssignableFrom((ITypeId)typeToInsert)) { return(true); } if (!sceneNode.ProjectContext.IsCapabilitySet(PlatformCapability.SupportsAutoTabItemWrapping) && ProjectNeutralTypes.TabControl.IsAssignableFrom((ITypeId)sceneNode.TrueTargetTypeId) && (PlatformTypes.FrameworkElement.IsAssignableFrom((ITypeId)typeToInsert) && !ProjectNeutralTypes.TabItem.IsAssignableFrom((ITypeId)typeToInsert))) { return(false); } if (property.Equals((object)BehaviorHelper.BehaviorsProperty) && ProjectNeutralTypes.Behavior.IsAssignableFrom((ITypeId)typeToInsert) || property.Equals((object)BehaviorHelper.BehaviorTriggersProperty) && (ProjectNeutralTypes.BehaviorTriggerAction.IsAssignableFrom((ITypeId)typeToInsert) || ProjectNeutralTypes.BehaviorTriggerBase.IsAssignableFrom((ITypeId)typeToInsert))) { return(BehaviorHelper.IsSceneNodeValidHost(sceneNode, typeToInsert)); } Type genericCollectionType = CollectionAdapterDescription.GetGenericCollectionType(PlatformTypeHelper.GetPropertyType(property)); return(genericCollectionType != (Type)null && sceneNode.ProjectContext.GetType(genericCollectionType).IsAssignableFrom((ITypeId)typeToInsert) || PlatformTypes.UIElementCollection.Equals((object)property.PropertyType) && PlatformTypes.UIElement.IsAssignableFrom((ITypeId)typeToInsert) || (PlatformTypes.FlowDocument.IsAssignableFrom((ITypeId)property.PropertyType) || PlatformTypes.InlineCollection.IsAssignableFrom((ITypeId)property.PropertyType) || PlatformTypes.BlockCollection.IsAssignableFrom((ITypeId)property.PropertyType)) && (PlatformTypes.UIElement.IsAssignableFrom((ITypeId)typeToInsert) && (bool)sceneNode.ViewModel.ProjectContext.GetCapabilityValue(PlatformCapability.SupportsInlineUIContainer)) || (PlatformTypes.ItemCollection.Equals((object)property.PropertyType) || ItemsControlElement.ItemsProperty.Equals((object)property))); }
public bool TypeToInsertIsSingleProperty(SceneViewModel viewModel) { IType type = this.typeToInsert != null?viewModel.ProjectContext.ResolveType(this.typeToInsert) : (IType)null; return(type != null && (PlatformTypes.IsEffectType((ITypeId)type) || ProjectNeutralTypes.BehaviorTriggerAction.IsAssignableFrom((ITypeId)type) || (ProjectNeutralTypes.Behavior.IsAssignableFrom((ITypeId)type) || ProjectNeutralTypes.DataGridColumn.IsAssignableFrom((ITypeId)type)))); }