示例#1
0
        /// <summary>
        /// Signals to the engine that the task has completed all of its execution, and that execution of the next task may be notified that this one has completed.
        /// </summary>
        /// <param name="graphContext">The graph context.</param>
        protected void SignalTaskCompletion(IDictionary graphContext)
        {
            if (s_diagnostics)
            {
                _Debug.WriteLine(Name + " is completing - it's validity state is (VS=" + ValidityState + "/SVS=" + SelfValidState + "/UVS=" + AllUpstreamValid + "/CVS=" + AllChildrenValid + ")");
            }
            EdgeExecutionCompletionSignaler eecs = (EdgeExecutionCompletionSignaler)graphContext[EecsKey];

            if (eecs != null)
            {
                graphContext.Remove(EecsKey);
                eecs(graphContext);
            }
            else
            {
                throw new ApplicationException(String.Format(s_eecsExceptionMessage, Name));
            }
        }
示例#2
0
        /// <summary>
        /// Called when edge execution is to begin. This is the method that subclasses of this class implement to hold
        /// application code.
        /// </summary>
        /// <param name="graphContext">The graph context.</param>
        /// <param name="theEdge">The edge - this. This allows multiple edges and edge types to call library code.</param>
        /// <param name="eecs">The EdgeExecutionCompletionSignaler.</param>
        protected virtual void OnEdgeExecution(IDictionary graphContext, Edge theEdge, EdgeExecutionCompletionSignaler eecs)
        {
            if (graphContext.Contains(EecsKey))
            {
                // TODO: Place this into an Errors & Warnings collection on the model.
                _Debug.WriteLine("ERROR : EECSKey was already in the graphContext for " + Name + "." + Environment.NewLine +
                                 "It will be removed, but this is a problem that should be investigated and addressed.");
                graphContext.Remove(EecsKey);
            }
            // This typically means that a task has begun that, the last time it ran, did not complete.
            graphContext.Add(EecsKey, eecs);

            DoTask(graphContext);
        }