Пример #1
0
 /// <summary>Constructor</summary>
 /// <param name="msg">The message linked to this response</param>
 /// <param name="status">The status string of the response</param>
 public ResponseOk(ISpEventMessage msg, string status) :
     base(DemoMsgType.SimpleResponse, DemoMsgId.Tick, SpEventPriority.Normal)
 {
     this.ReturnCode   = SpConverter.EnumToInt(DemoReponseId.Success);
     this.ReturnStatus = status;
     this.Uid          = msg.Uid;
 }
Пример #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="msg">The paired incoming message</param>
 /// <param name="status">Extra status information</param>
 //public MySimpleOkResponse(MyBaseMsg msg, string status)
 //: base(MyMsgType.SimpleResponse, msg, MyReturnCode.Success, status) {
 public MySimpleOkResponse(ISpEventMessage msg, string status)
     : base(MyMsgType.SimpleResponse, MyMsgId.Tick, SpEventPriority.Normal)
 {
     this.ReturnCode   = SpConverter.EnumToInt(MyReturnCode.Success);
     this.ReturnStatus = status;
     this.Uid          = msg.Uid;
 }
Пример #3
0
        //protected override ISpEventMessage ExecOnTick(ISpEventMessage eventMsg) {
        //    Console.WriteLine("########## {0} has received OnTick event:{1}", this.FullName, eventMsg.EventId);
        //    return base.ExecOnEntry(eventMsg);
        //    // just push the same one back
        //    //return eventMsg;
        //}
        //protected override ISpEventMessage ExecOnTick(ISpEventMessage eventMsg) {
        //    Console.WriteLine("########## {0} has received OnTick event:{1}", this.FullName, eventMsg.EventId);
        //    return base.ExecOnEntry(eventMsg);
        //    // just push the same one back
        //    //return eventMsg;
        //}



        #region SpStateOverrides

        protected override ISpEventMessage OnRuntimeTransitionRequest(ISpEventMessage msg)
        {
            switch (SpConverter.IntToEnum <MyMsgId>(msg.EventId))
            {
            case MyMsgId.Abort:
                Log.Info("MySuperState", "OnRuntimeTransitionRequest", " *** Got abort and returning Stop");

                // get the GUID
                ISpEventMessage myMsg = new MyBaseMsg(MyMsgType.SimpleMsg, MyMsgId.Stop);
                myMsg.Uid = msg.Uid;
                return(myMsg);

            default:

                break;
            }


            //// Do not know which state this is except it is the current state
            if (msg.EventId == SpConverter.EnumToInt(MyMsgId.Abort))
            {
                //this.GetCurrentState().

                // get the GUID
                ISpEventMessage myMsg = new MyBaseMsg(MyMsgType.SimpleMsg, MyMsgId.Start);

                // Try recursion - no will not work
                //this.OnTick(myMsg);

                //this.GetCurrentState().

                //return this.GetOnResultTransition(myMsg);
            }


            return(base.OnRuntimeTransitionRequest(msg));
        }