Ejemplo n.º 1
0
        /// <summary>
        /// Performs common construction behaviors.
        /// </summary>
        /// <param name="thread">The state machine's thread.</param>
        private void construct(NSFEventThread thread)
        {
            ConsecutiveLoopDetectionEnabled = true;
            ConsecutiveLoopLimit            = 1000;
            EventLimitDetectionEnabled      = true;
            EventLimit        = 100;
            EventThread       = thread;
            QueuedEvents      = 0;
            LoggingEnabled    = true;
            RunStatus         = NSFEventHandlerRunStatus.EventHandlerStopped;
            TerminationStatus = NSFEventHandlerTerminationStatus.EventHandlerReady;

            resetEvent           = new NSFEvent("Reset", this);
            runToCompletionEvent = new NSFEvent("RunToCompletion", this);
            startEvent           = new NSFEvent("Start", this);
            stopEvent            = new NSFEvent("Stop", this);
            terminateEvent       = new NSFEvent("Terminate", this);

            StateChangeActions.setExceptionAction(handleStateChangeActionException);

            if (isTopStateMachine())
            {
                EventThread.addEventHandler(this);
            }
        }
        /// <summary>
        /// Creates an event handler
        /// </summary>
        /// <param name="name">The user defined name for the state machine.</param>
        /// <param name="thread">The thread on which events for the state machine are queued.</param>
        public NSFEventHandler(NSFString name, NSFEventThread thread)
            : base(name)
        {
            EventThread       = thread;
            LoggingEnabled    = true;
            RunStatus         = NSFEventHandlerRunStatus.EventHandlerStopped;
            TerminationStatus = NSFEventHandlerTerminationStatus.EventHandlerReady;
            startEvent        = new NSFEvent("Start", this);
            stopEvent         = new NSFEvent("Stop", this);
            terminateEvent    = new NSFEvent("Terminate", this);

            EventThread.addEventHandler(this);
        }
        /// <summary>
        /// Performs common construction behaviors.
        /// </summary>
        /// <param name="thread">The state machine's thread.</param>
        private void construct(NSFEventThread thread)
        {
            ConsecutiveLoopDetectionEnabled = true;
            ConsecutiveLoopLimit = 1000;
            EventLimitDetectionEnabled = true;
            EventLimit = 100;
            EventThread = thread;
            QueuedEvents = 0;
            LoggingEnabled = true;
            RunStatus = NSFEventHandlerRunStatus.EventHandlerStopped;
            TerminationStatus = NSFEventHandlerTerminationStatus.EventHandlerReady;

            resetEvent = new NSFEvent("Reset", this);
            runToCompletionEvent = new NSFEvent("RunToCompletion", this);
            startEvent = new NSFEvent("Start", this);
            stopEvent = new NSFEvent("Stop", this);
            terminateEvent = new NSFEvent("Terminate", this);

            StateChangeActions.setExceptionAction(handleStateChangeActionException);

            if (isTopStateMachine())
            {
                EventThread.addEventHandler(this);
            }
        }
        /// <summary>
        /// Creates an event handler
        /// </summary>
        /// <param name="name">The user defined name for the state machine.</param>
        /// <param name="thread">The thread on which events for the state machine are queued.</param>
        public NSFEventHandler(NSFString name, NSFEventThread thread)
            : base(name)
        {
            EventThread = thread;
            LoggingEnabled = true;
            RunStatus = NSFEventHandlerRunStatus.EventHandlerStopped;
            TerminationStatus = NSFEventHandlerTerminationStatus.EventHandlerReady;
            startEvent = new NSFEvent("Start", this);
            stopEvent = new NSFEvent("Stop", this);
            terminateEvent = new NSFEvent("Terminate", this);

            EventThread.addEventHandler(this);
        }