Example #1
0
 protected void RaiseStateChange(EventHandler handler, ILQHsm hsm, LogStateEventArgs logEvent)
 {
     if (handler != null)
     {
         handler(hsm, logEvent);
     }
 }
Example #2
0
 protected void DoStateChange(LogStateEventArgs logEvent)
 {
     if (OnStateChange(logEvent))
     {
         RaiseStateChange(StateChange, this, logEvent);
     }
 }
Example #3
0
        public void LogStateEvent(StateLogType logType, QState state)
        {
            LogStateEventArgs logEvent = new LogStateEventArgs();

            logEvent.LogType = logType;
            logEvent.State   = state;
            DoStateChange(logEvent);
        }
Example #4
0
        public void LogStateEvent(StateLogType logType, QState state, string action)
        {
            LogStateEventArgs logEvent = new LogStateEventArgs();

            logEvent.LogType = logType;
            logEvent.State   = state;
            logEvent.LogText = action;
            DoStateChange(logEvent);
        }
Example #5
0
        public void LogStateEvent(StateLogType logType, QState state, QState initState)
        {
            System.Diagnostics.Debug.Assert(logType == StateLogType.Init);
            LogStateEventArgs logEvent = new LogStateEventArgs();

            logEvent.LogType   = logType;
            logEvent.State     = state;
            logEvent.NextState = initState;
            DoStateChange(logEvent);
        }
Example #6
0
 public virtual void RaiseFinalStateReached(EventHandler handler, ILQHsm hsm, QState state)
 {
     if (handler != null)
     {
         LogStateEventArgs logEvent = new LogStateEventArgs();
         logEvent.LogType = StateLogType.Final;
         logEvent.State   = state;
         handler(hsm, logEvent);
     }
 }
Example #7
0
        public void LogStateEvent(StateLogType logType, QState state, QState toState, string eventName, string eventDescription)
        {
            LogStateEventArgs logEvent = new LogStateEventArgs();

            logEvent.LogType          = logType;
            logEvent.State            = state;
            logEvent.NextState        = toState;
            logEvent.EventName        = eventName;
            logEvent.EventDescription = eventDescription;
            DoStateChange(logEvent);
        }
Example #8
0
        private void hsm_StateChange(object sender, EventArgs e)
        {
            qf4net.LogStateEventArgs args = e as qf4net.LogStateEventArgs;
            qf4net.ILQHsm            hsm  = sender as qf4net.ILQHsm;

            switch (args.LogType)
            {
            case qf4net.StateLogType.Exit:  _WriterDec(); break;
            }

            switch (args.LogType)
            {
            case qf4net.StateLogType.Init:
            {
                _WriterWriteLine(Color.YellowGreen, "[{0}-{1}] {2} to {3}", hsm, args.LogType, args.State.Method.Name, args.NextState.Method.Name);
            } break;

            case qf4net.StateLogType.Entry:
            {
                _WriterWriteLine(Color.Green, "[{0}-{1}] {2}", hsm, args.LogType, args.State.Method.Name);
            } break;

            case qf4net.StateLogType.Exit:
            {
                _WriterWriteLine(Color.Goldenrod, "[{0}-{1}] {2}", hsm, args.LogType, args.State.Method.Name);
            } break;

            case qf4net.StateLogType.EventTransition:
            {
                _WriterWriteLine(Color.DarkBlue, "[{0}-{1}] {2} on {3} to {4} -> {5}", hsm, args.LogType, args.State.Method.Name, args.EventName, args.NextState.Method.Name, args.EventDescription);
            } break;

            case qf4net.StateLogType.Log:
            {
                _WriterWriteLine(Color.Brown, "[{0}-{1}] {2}", hsm, args.LogType, args.LogText);
            } break;

            default: throw new NotSupportedException("StateLogType." + args.LogType.ToString());
            }

            switch (args.LogType)
            {
            case qf4net.StateLogType.Entry: _WriterInc(); break;
            }
        }
Example #9
0
        public void LogText(string fmt, params object[] args)
        {
            string msg;

            if (args == null || args.Length == 0)
            {
                msg = fmt;
            }
            else
            {
                msg = string.Format(fmt, args);
            }
            LogStateEventArgs logEvent = new LogStateEventArgs();

            logEvent.LogType = StateLogType.Log;
            logEvent.LogText = msg;
            DoStateChange(logEvent);
        }
Example #10
0
 protected virtual void RaiseFinalStateReached(EventHandler handler, ILQHsm hsm, QState state)
 {
     if (handler != null)
     {
         LogStateEventArgs logEvent = new LogStateEventArgs ();
         logEvent.LogType = StateLogType.Final;
         logEvent.State = state;
         handler (hsm, logEvent);
     }
 }
Example #11
0
 protected void DoStateChange(LogStateEventArgs logEvent)
 {
     if (OnStateChange (logEvent))
     {
         RaiseStateChange (StateChange, this, logEvent);
     }
 }
Example #12
0
 protected virtual bool OnStateChange(LogStateEventArgs logEvent)
 {
     return(true);
 }
Example #13
0
 protected void LogStateEvent(StateLogType logType, QState state, string action)
 {
     LogStateEventArgs logEvent = new LogStateEventArgs ();
     logEvent.LogType = logType;
     logEvent.State = state;
     logEvent.LogText = action;
     DoStateChange (logEvent);
 }
Example #14
0
 protected void LogStateEvent(StateLogType logType, QState state, QState initState)
 {
     System.Diagnostics.Debug.Assert (logType == StateLogType.Init);
     LogStateEventArgs logEvent = new LogStateEventArgs ();
     logEvent.LogType = logType;
     logEvent.State = state;
     logEvent.NextState = initState;
     DoStateChange (logEvent);
 }
Example #15
0
 protected void LogStateEvent(StateLogType logType, QState state)
 {
     LogStateEventArgs logEvent = new LogStateEventArgs ();
     logEvent.LogType = logType;
     logEvent.State = state;
     DoStateChange (logEvent);
 }
Example #16
0
 protected void LogStateEvent(StateLogType logType, QState state, QState toState, string eventName, string eventDescription)
 {
     LogStateEventArgs logEvent = new LogStateEventArgs ();
     logEvent.LogType = logType;
     logEvent.State = state;
     logEvent.NextState = toState;
     logEvent.EventName = eventName;
     logEvent.EventDescription = eventDescription;
     DoStateChange (logEvent);
 }
 private void _Hsm_StateChange_RunInViewThread(ILQHsm hsm, LogStateEventArgs ea)
 {
     if(_View.InvokeRequired)
     {
         object[] args = new object[] {hsm, ea};
         _View.Invoke (_Hsm_StateChange_RunInViewThread_Handler, args);
     }
     else
     {
         _Hsm_StateChange_Internal (hsm, ea);
     }
 }
Example #18
0
 protected void LogText(string fmt, params object[] args)
 {
     string msg;
     if (args == null || args.Length == 0)
     {
         msg = fmt;
     }
     else
     {
         msg = string.Format (fmt, args);
     }
     LogStateEventArgs logEvent = new LogStateEventArgs ();
     logEvent.LogType = StateLogType.Log;
     logEvent.LogText = msg;
     DoStateChange (logEvent);
 }
Example #19
0
 protected virtual bool OnStateChange(LogStateEventArgs logEvent)
 {
     return true;
 }
Example #20
0
 protected void RaiseStateChange(EventHandler handler, ILQHsm hsm, LogStateEventArgs logEvent)
 {
     if (handler != null)
     {
         handler (hsm, logEvent);
     }
 }
        private void _Hsm_StateChange_Internal(ILQHsm hsm, LogStateEventArgs ea)
        {
            string currentStateName = null;
            string currentTransitionName = null;
            switch (ea.LogType)
            {
                case StateLogType.EventTransition:
                {
                    currentStateName = ea.State.Method.Name;
                    currentTransitionName = ea.EventDescription;
                }
                    break;
                case StateLogType.Init:
                {
                    currentStateName = ea.NextState.Method.Name;
                } break;
                case StateLogType.Restored:
                case StateLogType.Entry:
                case StateLogType.Final:
                {
                    currentStateName = ea.State.Method.Name;
                } break;
            }

            if(currentStateName != null)
            {
                RefreshCurrentStateView (currentStateName, currentTransitionName);
            }
        }