コード例 #1
0
        private TriggerModel3 TriggerSubscription_Inserted(object sender, SceneNode basisNode, object basisContent, SceneNode newPathNode)
        {
            TriggerBaseNode trigger       = (TriggerBaseNode)newPathNode;
            TriggerModel3   triggerModel3 = TriggerModel3.ConstructModel(trigger, this);

            if (triggerModel3 != null)
            {
                ITriggerContainer currentContainer = this.CurrentContainer;
                if (currentContainer == null)
                {
                    return((TriggerModel3)null);
                }
                int triggerIndex = this.GetTriggerIndex(currentContainer, trigger);
                if (triggerIndex == -1)
                {
                    return((TriggerModel3)null);
                }
                if (this.ShouldDisplayNoneTrigger)
                {
                    ++triggerIndex;
                }
                this.triggerModels.Insert(triggerIndex, triggerModel3);
                if (trigger == this.TriggerToBeSelected)
                {
                    this.TriggerToBeSelected = (TriggerBaseNode)null;
                    this.SelectedItem        = triggerModel3;
                }
            }
            return(triggerModel3);
        }
コード例 #2
0
        public void CreateNewEventTrigger()
        {
            if (this.CurrentContainer == null)
            {
                return;
            }
            SceneViewModel    activeSceneViewModel = this.ActiveSceneViewModel;
            SceneDocument     document             = activeSceneViewModel.Document;
            ITriggerContainer currentContainer     = this.CurrentContainer;

            using (SceneEditTransaction editTransaction = document.CreateEditTransaction(StringTable.TriggerChangeUndoUnit))
            {
                IProjectContext projectContext = document.ProjectContext;
                IType           type           = projectContext.GetType(currentContainer.TargetElementType);
                if (type != null)
                {
                    TriggerSourceInformation triggerSource = (TriggerSourceInformation)TriggersHelper.GetDefaultEvent((ITypeResolver)projectContext, type);
                    if (triggerSource != (TriggerSourceInformation)null)
                    {
                        TriggerBaseNode trigger = TriggersHelper.CreateTrigger(triggerSource, activeSceneViewModel);
                        if (trigger != null)
                        {
                            int index = currentContainer.VisualTriggers.Count;
                            if (this.selectedItem != null)
                            {
                                index = this.selectedItem != this.noneTrigger ? currentContainer.VisualTriggers.IndexOf(this.selectedItem.SceneNode) + 1 : 0;
                            }
                            currentContainer.VisualTriggers.Insert(index, trigger);
                            this.TriggerToBeSelected = trigger;
                        }
                    }
                }
                editTransaction.Commit();
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: PasteCommand.cs プロジェクト: radtek/Shopdrawing
        private static void StripStoryboardsAndTriggers(SceneElement element)
        {
            BaseFrameworkElement frameworkElement = element as BaseFrameworkElement;

            if (frameworkElement != null && frameworkElement.Resources != null)
            {
                List <DictionaryEntryNode> list = new List <DictionaryEntryNode>();
                foreach (DictionaryEntryNode dictionaryEntryNode in frameworkElement.Resources)
                {
                    if (dictionaryEntryNode.Value != null && PlatformTypes.Storyboard.IsAssignableFrom((ITypeId)dictionaryEntryNode.Value.Type))
                    {
                        list.Add(dictionaryEntryNode);
                    }
                }
                foreach (DictionaryEntryNode dictionaryEntryNode in list)
                {
                    frameworkElement.Resources.Remove(dictionaryEntryNode);
                }
            }
            ITriggerContainer triggerContainer = (ITriggerContainer)element.StoryboardContainer;

            if (triggerContainer == null || !triggerContainer.CanEditTriggers)
            {
                return;
            }
            triggerContainer.VisualTriggers.Clear();
        }
コード例 #5
0
        private static string CreateBeginActionName(ITriggerContainer storyboardContainer, string timelineName)
        {
            string            str               = timelineName + StringTable.TriggerDefaultActionName;
            SceneNode         sceneNode         = (SceneNode)storyboardContainer;
            SceneNodeIDHelper sceneNodeIdHelper = new SceneNodeIDHelper(sceneNode.ViewModel, sceneNode);

            if (!sceneNodeIdHelper.IsValidElementID(sceneNode, str))
            {
                str = sceneNodeIdHelper.GetValidElementID(sceneNode, str);
            }
            return(str);
        }
コード例 #6
0
        private int GetTriggerIndex(ITriggerContainer container, TriggerBaseNode trigger)
        {
            int num = 0;

            foreach (TriggerBaseNode triggerBaseNode in (IEnumerable <TriggerBaseNode>)container.VisualTriggers)
            {
                if (triggerBaseNode == trigger)
                {
                    return(num);
                }
                if (PlatformTypes.Trigger.IsAssignableFrom((ITypeId)triggerBaseNode.Type) || PlatformTypes.MultiTrigger.IsAssignableFrom((ITypeId)triggerBaseNode.Type) || PlatformTypes.EventTrigger.IsAssignableFrom((ITypeId)triggerBaseNode.Type))
                {
                    ++num;
                }
            }
            return(-1);
        }
コード例 #7
0
        public void CreateNewPropertyTrigger()
        {
            if (this.CurrentContainer == null)
            {
                return;
            }
            ITriggerContainer        currentContainer         = this.CurrentContainer;
            SceneViewModel           activeSceneViewModel     = this.ActiveSceneViewModel;
            SceneDocument            document                 = activeSceneViewModel.Document;
            StyleNode                styleNode                = currentContainer as StyleNode;
            FrameworkTemplateElement frameworkTemplateElement = currentContainer as FrameworkTemplateElement;

            using (SceneEditTransaction editTransaction = document.CreateEditTransaction(StringTable.TriggerChangeUndoUnit))
            {
                TriggerSourceInformation triggerSource = (TriggerSourceInformation)null;
                if (styleNode != null || frameworkTemplateElement != null)
                {
                    triggerSource = (TriggerSourceInformation)TriggersHelper.GetDefaultProperty(currentContainer.TargetElementType, document.DocumentContext);
                }
                if (triggerSource != (TriggerSourceInformation)null)
                {
                    TriggerBaseNode trigger = TriggersHelper.CreateTrigger(triggerSource, activeSceneViewModel);
                    if (trigger != null)
                    {
                        int index = currentContainer.VisualTriggers.Count;
                        if (this.selectedItem != null)
                        {
                            index = this.selectedItem != this.noneTrigger ? currentContainer.VisualTriggers.IndexOf(this.selectedItem.SceneNode) + 1 : 0;
                        }
                        currentContainer.VisualTriggers.Insert(index, trigger);
                        activeSceneViewModel.SetActiveTrigger(trigger);
                    }
                }
                editTransaction.Commit();
            }
        }
コード例 #8
0
 internal override void ContainIn(ITriggerContainer container)
 {
     container.Schedule = this;
 }
コード例 #9
0
 internal override void WrapInContainer(ITriggerContainer container) => container.Schedule = this;
コード例 #10
0
 internal abstract void WrapInContainer(ITriggerContainer container);
コード例 #11
0
		internal abstract void WrapInContainer(ITriggerContainer container);
コード例 #12
0
 internal override void ContainIn(ITriggerContainer container)
 {
     container.Schedule = this;
 }
コード例 #13
0
 internal abstract void ContainIn(ITriggerContainer container);
コード例 #14
0
 internal abstract void ContainIn(ITriggerContainer container);
コード例 #15
0
        public static TriggerBaseNode FindOrCreateTrigger(TriggerSourceInformation triggerSource, ITriggerContainer triggerContainer, SceneViewModel viewModel)
        {
            RoutedEventInformation eventInformation    = triggerSource as RoutedEventInformation;
            PropertyInformation    propertyInformation = triggerSource as PropertyInformation;

            foreach (TriggerBaseNode triggerBaseNode in (IEnumerable <TriggerBaseNode>)triggerContainer.VisualTriggers)
            {
                EventTriggerNode eventTriggerNode = triggerBaseNode as EventTriggerNode;
                TriggerNode      triggerNode      = triggerBaseNode as TriggerNode;
                if (eventTriggerNode != null && (TriggerSourceInformation)eventInformation != (TriggerSourceInformation)null && eventTriggerNode.RoutedEvent == eventInformation.RoutedEvent)
                {
                    return((TriggerBaseNode)eventTriggerNode);
                }
                if (triggerNode != null && (TriggerSourceInformation)propertyInformation != (TriggerSourceInformation)null && ((ITriggerConditionNode)triggerNode).PropertyKey == propertyInformation.DependencyProperty)
                {
                    return((TriggerBaseNode)triggerNode);
                }
            }
            TriggerBaseNode trigger = TriggersHelper.CreateTrigger(triggerSource, viewModel);

            if (trigger != null)
            {
                triggerContainer.VisualTriggers.Add(trigger);
            }
            return(trigger);
        }