internal void AddTriggerNode() { Type newClrObject = ClrNewObjectDialog.CreateNewClrObject(this.sceneViewModel, this.sceneViewModel.ProjectContext.ResolveType(ProjectNeutralTypes.BehaviorTriggerBase).RuntimeType, true); if (!(newClrObject != (Type)null)) { return; } using (SceneEditTransaction editTransaction = this.sceneViewModel.CreateEditTransaction(StringTable.AddBehaviorCommandTriggerUndo)) { BehaviorTriggerBaseNode behaviorTriggerBaseNode = (BehaviorTriggerBaseNode)this.sceneViewModel.CreateSceneNode(newClrObject); InvokeCommandActionNode commandActionNode = (InvokeCommandActionNode)this.sceneViewModel.CreateSceneNode(ProjectNeutralTypes.InvokeCommandAction); commandActionNode.CommandName = this.CategoryName; behaviorTriggerBaseNode.Actions.Add((SceneNode)commandActionNode); if (ProjectNeutralTypes.BehaviorEventTriggerBase.IsAssignableFrom((ITypeId)behaviorTriggerBaseNode.Type)) { SceneNode sceneNode = (SceneNode)this.behaviorNode; while (sceneNode != null && !(sceneNode is SceneElement)) { sceneNode = sceneNode.Parent; } if (sceneNode != null) { sceneNode.EnsureNamed(); ((BehaviorEventTriggerBaseNode)behaviorTriggerBaseNode).SourceName = sceneNode.Name; } } this.behaviorNode.GetCollectionForProperty(BehaviorHelper.BehaviorTriggersProperty).Add((SceneNode)behaviorTriggerBaseNode); editTransaction.Commit(); } this.Rebuild(); this.TriggerNodeView.MoveCurrentToLast(); }
public Type PromptForClrType() { if (this.PropertyValue == null) { return((Type)null); } SceneNodeProperty sceneNodeProperty = (SceneNodeProperty)this.PropertyValue.get_ParentProperty(); return(ClrNewObjectDialog.CreateNewClrObject(sceneNodeProperty.SceneNodeObjectSet.ViewModel, ((PropertyEntry)sceneNodeProperty).get_PropertyType())); }
private SceneNode CreateTypeForProperty(SceneViewModel viewModel, Type propertyType) { Type newClrObject = ClrNewObjectDialog.CreateNewClrObject(viewModel, propertyType); if (newClrObject == (Type)null) { return((SceneNode)null); } Type type = newClrObject; if (typeof(string).Equals(type)) { return(viewModel.CreateSceneNode((object)StringTable.DefaultCollectionEditorString)); } return(viewModel.CreateSceneNode(type)); }
internal void OnTriggerTypeButtonClicked(object sender, RoutedEventArgs args) { SceneNode sceneNode1 = this.selectedObjects[0]; Type runtimeType = sceneNode1.ProjectContext.ResolveType(ProjectNeutralTypes.BehaviorTriggerBase).RuntimeType; Type newClrObject = ClrNewObjectDialog.CreateNewClrObject(sceneNode1.ViewModel, runtimeType, true); if (!(newClrObject != (Type)null)) { return; } BehaviorTriggerActionNode triggerActionNode = (BehaviorTriggerActionNode)sceneNode1; using (SceneEditTransaction editTransaction = triggerActionNode.ViewModel.CreateEditTransaction(StringTable.ChangeBehaviorTriggerTypeUndoDescription)) { SceneNode sceneNode2 = triggerActionNode.ViewModel.CreateSceneNode(newClrObject); this.objectSet.ReparentActionAndCopyBehaviors(this.objectSet.FindExistingTriggerMatchingDocumentNode(sceneNode2.DocumentNode) ?? (BehaviorTriggerBaseNode)sceneNode2); editTransaction.Commit(); } }
public static Type CreateNewClrObject(SceneViewModel viewModel, Type propertyType) { return(ClrNewObjectDialog.CreateNewClrObject(viewModel, propertyType, false)); }