12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- /*===============================================================================
- * Change history
- * When Who TaskId Comment
- * ---------- ------ ------ ------------------------------------
- * 2006-08-08 RMa Added LogType to the log event args.
- * 2006-05-17 RMa Created
- *
- ---------------------------------------------------------------------------------*/
- using System;
- namespace Wayne.Lib.StateEngine
- {
- /// <summary>
- /// Categorizes the log entries in the OnLog event from the State machine.
- /// </summary>
- public enum LogType
- {
- /// <summary>
- /// Logging when a state entry is performed.
- /// </summary>
- Enter,
- /// <summary>
- /// Logging when a state exit is performed.
- /// </summary>
- Exit,
- /// <summary>
- /// Logging when an event is sent into a state for handling.
- /// </summary>
- HandleEvent,
- /// <summary>
- /// Logging when an exception has been unhandled in the user code.
- /// </summary>
- Error,
- /// <summary>
- /// Misc. debug logging.
- /// </summary>
- Debug,
- /// <summary>
- /// Warnings about unhandled transitions.
- /// </summary>
- UnhandledTransition,
- }
- /// <summary>
- /// The Log Event args is used to carry log strings when logging internally in the
- /// state machine. Applications can hook on the StateMachine.OnLog event in order to
- /// catch loggins from the inner workings of the statemachine.
- /// </summary>
- public sealed class LogEventArgs : EventArgs
- {
- #region Fields
- LogType logType;
- string logText;
- #endregion
- #region Construction
- /// <summary>
- /// Initializes a new instance of the LogEventArgs class.
- /// </summary>
- /// <param name="logType">Category of this log entry.</param>
- /// <param name="logText">Text to be logged.</param>
- internal LogEventArgs(LogType logType, string logText)
- {
- this.logText = logText;
- this.logType = logType;
- }
- #endregion
- #region Properties
- /// <summary>
- /// The log text from the Statemachine.
- /// </summary>
- public string LogText
- {
- get { return logText; }
- }
- /// <summary>
- /// Category of the log entry.
- /// </summary>
- public LogType LogType
- {
- get { return logType; }
- }
- #endregion
- }
- }
|