public bool Equals(IScheduleVertex other)
        {
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            // Check if other is a null reference by using ReferenceEquals because
            // we overload the == operator. If other isn't actually null then
            // we get an infinite loop where we're constantly trying to compare to null.
            return(!ReferenceEquals(other, null) &&
                   Index == other.Index &&
                   GetType().Equals(other.GetType()));
        }
Ejemplo n.º 2
0
        private bool ProcessScheduleStep(IScheduleVertex current, ref ScheduleExecutionState state)
        {
            if (m_ExecutionInfo.Cancellation.IsCancellationRequested)
            {
                state = ScheduleExecutionState.Canceled;
                return(false);
            }

            // If we need to pause we do it here
            m_ExecutionInfo.PauseHandler.WaitForUnPause(m_ExecutionInfo.Cancellation);

            // Get the executor for the current node type and run it
            // on the current node. If we fail then we exit the loop
            {
                var type = current.GetType();
                if (!m_Executors.ContainsKey(type))
                {
                    state = ScheduleExecutionState.NoProcessorForVertex;
                    return(false);
                }

                RaiseOnVertexProcess(Schedule, current.Index);
                var processor = m_Executors[type];
                try
                {
                    ScheduleExecutionState shouldContinue = processor.Process(current, m_ExecutionInfo);
                    if (shouldContinue != ScheduleExecutionState.Executing)
                    {
                        state = shouldContinue;
                        return(false);
                    }

                    RaiseOnExecutionProgress(-1, Resources.Progress_ExecutingSchedule, false);
                }
                catch (Exception)
                {
                    state = ScheduleExecutionState.UnhandledException;
                    return(false);
                }

                return(true);
            }
        }
Ejemplo n.º 3
0
        private static bool AreVerticesEqual(IScheduleVertex first, IScheduleVertex second)
        {
            if (first.GetType() != second.GetType())
            {
                return(false);
            }

            var executingActionVertex = first as ExecutingActionVertex;

            if (executingActionVertex != null)
            {
                return(executingActionVertex.ActionToExecute == ((ExecutingActionVertex)second).ActionToExecute);
            }

            var subScheduleVertex = first as SubScheduleVertex;

            if (subScheduleVertex != null)
            {
                return(subScheduleVertex.ScheduleToExecute == ((SubScheduleVertex)second).ScheduleToExecute);
            }

            return(true);
        }
Ejemplo n.º 4
0
        public bool Equals(IScheduleVertex other)
        {
            if (ReferenceEquals(this, other))
            {
                return true;
            }

            // Check if other is a null reference by using ReferenceEquals because
            // we overload the == operator. If other isn't actually null then
            // we get an infinite loop where we're constantly trying to compare to null.
            return !ReferenceEquals(other, null)
                && Index == other.Index
                && GetType().Equals(other.GetType());
        }
        private static bool AreVerticesEqual(IScheduleVertex first, IScheduleVertex second)
        {
            if (first.GetType() != second.GetType())
            {
                return false;
            }

            var executingActionVertex = first as ExecutingActionVertex;
            if (executingActionVertex != null)
            {
                return executingActionVertex.ActionToExecute == ((ExecutingActionVertex)second).ActionToExecute;
            }

            var subScheduleVertex = first as SubScheduleVertex;
            if (subScheduleVertex != null)
            {
                return subScheduleVertex.ScheduleToExecute == ((SubScheduleVertex)second).ScheduleToExecute;
            }

            return true;
        }
Ejemplo n.º 6
0
 private static IScheduleVertex CloneVertex(IScheduleVertex vertex)
 {
     return s_VertexBuilder[vertex.GetType()](vertex, vertex.Index);
 }
Ejemplo n.º 7
0
 private static IScheduleVertex CloneVertex(IScheduleVertex vertex)
 {
     return(s_VertexBuilder[vertex.GetType()](vertex, vertex.Index));
 }
Ejemplo n.º 8
0
        private bool ProcessScheduleStep(IScheduleVertex current, ref ScheduleExecutionState state)
        {
            if (m_ExecutionInfo.Cancellation.IsCancellationRequested)
            {
                state = ScheduleExecutionState.Canceled;
                return false;
            }

            // If we need to pause we do it here
            m_ExecutionInfo.PauseHandler.WaitForUnPause(m_ExecutionInfo.Cancellation);

            // Get the executor for the current node type and run it
            // on the current node. If we fail then we exit the loop
            {
                var type = current.GetType();
                if (!m_Executors.ContainsKey(type))
                {
                    state = ScheduleExecutionState.NoProcessorForVertex;
                    return false;
                }

                RaiseOnVertexProcess(Schedule, current.Index);
                var processor = m_Executors[type];
                try
                {
                    ScheduleExecutionState shouldContinue = processor.Process(current, m_ExecutionInfo);
                    if (shouldContinue != ScheduleExecutionState.Executing)
                    {
                        state = shouldContinue;
                        return false;
                    }

                    RaiseOnExecutionProgress(-1, Resources.Progress_ExecutingSchedule, false);
                }
                catch (Exception)
                {
                    state = ScheduleExecutionState.UnhandledException;
                    return false;
                }

                return true;
            }
        }