public static void CreateDefaultTrigger(StoryboardTimelineSceneNode storyboard) { ITriggerContainer triggerContainer = (ITriggerContainer)storyboard.StoryboardContainer ?? storyboard.ViewModel.RootNode as ITriggerContainer; if (triggerContainer == null || !triggerContainer.CanEditTriggers) { return; } SceneViewModel viewModel = storyboard.ViewModel; IProjectContext projectContext = viewModel.ProjectContext; IType type = projectContext.GetType(triggerContainer.TargetElementType); if (type == null) { return; } TriggerSourceInformation triggerSource = (TriggerSourceInformation)TriggersHelper.GetDefaultEvent((ITypeResolver)projectContext, type); if (!(triggerSource != (TriggerSourceInformation)null)) { return; } TriggerBaseNode orCreateTrigger = TriggersHelper.FindOrCreateTrigger(triggerSource, triggerContainer, viewModel); if (orCreateTrigger == null) { return; } TimelineActionNode timelineActionNode = (TimelineActionNode)BeginActionNode.Factory.Instantiate(viewModel); timelineActionNode.TargetTimeline = storyboard; TriggersHelper.DefaultAddAction(orCreateTrigger, (TriggerActionNode)timelineActionNode); }
private void EnsureProperActions(TriggerBaseNode trigger, StoryboardTimelineSceneNode storyboard) { if (!TriggersHelper.NeedsBeginAction(storyboard)) { return; } TimelineActionNode timelineActionNode = (TimelineActionNode)BeginActionNode.Factory.Instantiate(storyboard.ViewModel); timelineActionNode.TargetTimeline = storyboard; TriggersHelper.DefaultAddAction(trigger, (TriggerActionNode)timelineActionNode); storyboard.UpdateActionNames(); }
public void CreateAction() { TriggerActionNode defaultAction = TriggersHelper.CreateDefaultAction(this.SceneNode.ViewModel, TriggersHelper.GetDefaultStoryboardName(this.SceneNode)); if (defaultAction == null) { return; } using (SceneEditTransaction editTransaction = this.SceneNode.ViewModel.CreateEditTransaction(StringTable.TriggerChangeUndoUnit)) { TriggersHelper.DefaultAddAction(this.SceneNode, defaultAction); editTransaction.Commit(); } }