Exemple #1
0
        private void OnPreviewGraphCompleted(AsyncTask asyncTask)
        {
            var updateTask = asyncTask as PreviewGraphAsyncTask;

            if (updateTask != null)
            {
                var nodeGuids             = updateTask.previewGraphData;
                var deltaComputeStateArgs = new DeltaComputeStateEventArgs(nodeGuids, graphExecuted);
                OnSetNodeDeltaState(deltaComputeStateArgs);
            }
        }
        /// <summary>
        /// This function gets the set of nodes that will get executed in the next run.
        /// This function will be called when the nodes are modified or when showrunpreview is set
        /// the executing nodes will be sent via SetNodeDeltaState event.
        /// </summary>
        /// <param name="showRunPreview">This parameter controls the delta state computation </param>
        public void GetExecutingNodes(bool showRunPreview)
        {
            var task = new PreviewGraphAsyncTask(scheduler, VerboseLogging);

            //The Graph is executed and Show node execution is checked on the Settings menu
            if (graphExecuted && showRunPreview)
            {
                if (task.Initialize(EngineController, this) != null)
                {
                    task.Completed += OnPreviewGraphCompleted;
                    scheduler.ScheduleForExecution(task);
                }
            }
            //Show node exection is checked but the graph has not RUN
            else
            {
                var deltaComputeStateArgs = new DeltaComputeStateEventArgs(new List <Guid>(), graphExecuted);
                OnSetNodeDeltaState(deltaComputeStateArgs);
            }
        }
 private void OnPreviewGraphCompleted(AsyncTask asyncTask)
 {
     var updateTask = asyncTask as PreviewGraphAsyncTask;
     if (updateTask != null)
     {
         var nodeGuids = updateTask.previewGraphData;
         var deltaComputeStateArgs = new DeltaComputeStateEventArgs(nodeGuids,graphExecuted);
         OnSetNodeDeltaState(deltaComputeStateArgs);               
     }            
 }
 /// <summary>
 /// This function gets the set of nodes that will get executed in the next run.
 /// This function will be called when the nodes are modified or when showrunpreview is set
 /// the executing nodes will be sent via SetNodeDeltaState event.
 /// </summary>
 /// <param name="showRunPreview">This parameter controls the delta state computation </param>
 public void GetExecutingNodes(bool showRunPreview)
 {
     var task = new PreviewGraphAsyncTask(scheduler, VerboseLogging);
                 
     //The Graph is executed and Show node execution is checked on the Settings menu
     if (graphExecuted && showRunPreview)
     {
         if (task.Initialize(EngineController, this) != null)
         {
             task.Completed += OnPreviewGraphCompleted;
             scheduler.ScheduleForExecution(task);
         }
     }
     //Show node exection is checked but the graph has not RUN
     else
     {
         var deltaComputeStateArgs = new DeltaComputeStateEventArgs(new List<Guid>(), graphExecuted);
         OnSetNodeDeltaState(deltaComputeStateArgs); 
     }
 }
 internal virtual void OnSetNodeDeltaState(DeltaComputeStateEventArgs e)
 {
     var handler = SetNodeDeltaState;
     if (handler != null) handler(this, e);
 }
 public virtual void OnSetNodeDeltaState(DeltaComputeStateEventArgs e)
 {
     var handler = SetNodeDeltaState;
     if (handler != null) handler(this, e);
 }
        private void hwm_SetNodeDeltaState(object sender, DeltaComputeStateEventArgs e)
        {
            var nodeGuids = e.NodeGuidList;
            // if runsettings is manual, and if the graph is not executed, then turing on showrunpreview 
            //should turn on showexectionpreview on every node.
            if (nodeGuids.Count == 0 && !e.GraphExecuted)
            {
                foreach (var nodeModel in Nodes)
                {
                    nodeModel.ShowExecutionPreview = DynamoViewModel.ShowRunPreview;
                }
            }

            //if the graph is executed then set the node preview to false , provided
            // there is no error on that node.
            if (nodeGuids.Count == 0 && e.GraphExecuted)
            {
                foreach (var nodeViewModel in Nodes)
                {
                    if (nodeViewModel.State != ElementState.Error && nodeViewModel.State != ElementState.Warning)
                    {
                        nodeViewModel.ShowExecutionPreview = false;
                        nodeViewModel.IsNodeAddedRecently = false;
                    }
                }                
            }

            foreach (Guid t in nodeGuids)
            {
                var nodeViewModel = Nodes.FirstOrDefault(x => x.NodeModel.GUID == t);
                if (nodeViewModel != null)
                {
                    nodeViewModel.ShowExecutionPreview = nodeViewModel.DynamoViewModel.ShowRunPreview;
                    nodeViewModel.IsNodeAddedRecently = false;
                }
            }

            /* Color the recently added nodes */
            var addedNodes = Nodes.Where(x => x.IsNodeAddedRecently).ToList();
            foreach (var nodes in addedNodes)
            {
                if (nodes.ShowExecutionPreview)
                    nodes.ShowExecutionPreview = nodes.DynamoViewModel.ShowRunPreview;
            }           
        }