public void UnregisterHsm(qf4net.ILQHsm hsm) { hsm.EventManager.PolledEvent -= new qf4net.PolledEventHandler(EventManager_PolledEvent); hsm.StateChange -= new EventHandler(hsm_StateChange); hsm.DispatchException -= new qf4net.DispatchExceptionHandler(hsm_DispatchException); hsm.UnhandledTransition -= new qf4net.DispatchUnhandledTransitionHandler(hsm_UnhandledTransition); }
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; } }