| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 | 
							- using Aitex.Core.RT.Fsm;
 
- using Aitex.Core.RT.Log;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- namespace CyberX8_RT.Schedulers
 
- {
 
-     public class SchedulerPostMsg
 
-     {
 
-         private enum Step
 
-         {
 
-             PostMsg,
 
-             CheckMsg
 
-         }
 
-         #region 内部变量
 
-         private Step _step = Step.CheckMsg;
 
-         private DateTime _postMsgTime = DateTime.Now;
 
-         #endregion
 
-         /// <summary>
 
-         /// 构造函数
 
-         /// </summary>
 
-         /// <param name="entity"></param>
 
-         public SchedulerPostMsg()
 
-         {
 
-         }
 
-         /// <summary>
 
-         /// 重置
 
-         /// </summary>
 
-         public void Reset()
 
-         {
 
-             _step = Step.CheckMsg;
 
-             _postMsgTime = DateTime.Now;
 
-         }
 
-         /// <summary>
 
-         /// 发送方法
 
-         /// </summary>
 
-         /// <typeparam name="T"></typeparam>
 
-         /// <typeparam name="V"></typeparam>
 
-         /// <param name="entity"></param>
 
-         /// <param name="currentState"></param>
 
-         /// <param name="eEvent"></param>
 
-         /// <param name="moduleName"></param>
 
-         /// <param name="msg"></param>
 
-         /// <param name="confirmState"></param>
 
-         /// <param name="args"></param>
 
-         /// <returns></returns>
 
-         public bool PostMsg<T, V>(Entity entity,int currentState,eEvent eEvent, string moduleName, int msg, int confirmState, params object[] args)
 
-         {
 
-             if (_step == Step.PostMsg)
 
-             {
 
-                 bool result =entity.CheckToPostMessage<T, V>(eEvent, moduleName, msg, args);
 
-                 if (result)
 
-                 {
 
-                     _postMsgTime = DateTime.Now;
 
-                     _step = Step.CheckMsg;
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 if (currentState == confirmState)
 
-                 {
 
-                     return true;
 
-                 }
 
-                 else if (DateTime.Now.Subtract(_postMsgTime).TotalMilliseconds >= 1000)
 
-                 {
 
-                     _step = Step.PostMsg;
 
-                 }
 
-             }
 
-             return false;
 
-         }
 
-     }
 
- }
 
 
  |