public GQHSMTimeOut(string name, DateTime dt, IQEvent ev, TimeOutType type, GQHSMAction action) { _name = name; _dt = dt; _event = ev; _action = action; _callType = GQHSMCallType.TIMEOUT_DATETIME_TYPE; }
public GQHSMTimeOut(string name, TimeSpan duration, IQEvent ev, TimeOutType type, GQHSMAction action) { _name = name; _duration = duration; _event = ev; _type = type; _action = action; _callType = GQHSMCallType.TIMEOUT_TIMESPAN_TYPE; }
public static void Set(string key, object value, int timeOut, TimeOutType timeOutType) { if (timeOutType == TimeOutType.Absolute) { SetAbsoluteExpiration(key, value, timeOut); } else { SetSlidingExpiration(key, value, timeOut); } }
/// <summary> /// 获取 /// </summary> /// <param name="key"></param> /// <returns></returns> public static object Get(string dbName, string key, TimeOutType timeOutType, int timeOut) { try { var obj = GetService(dbName).Get(key); if (timeOutType == TimeOutType.Absolute && obj != null) { Set(dbName, key, obj, timeOut); } return(obj); } catch { } return(null); }
protected void Init(QSystemTimer qTimer, string name, TimeSpan duration, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { _QTimer = qTimer; _Name = name; _Hsm = hsm; _Event = ev; _TimeOutType = timeOutType; if (duration.TotalMilliseconds == 0) { _TimeOutType = TimeOutType.Single; _Timer_Elapsed(this, null); return; } double ms = duration.TotalMilliseconds; double msInterval = ms > 0 ? ms : TimeSpan.MaxValue.TotalMilliseconds; _Timer = new System.Timers.Timer(msInterval); _Timer.Elapsed += new System.Timers.ElapsedEventHandler(_Timer_Elapsed); _Timer.Enabled = ms > 0; _Principal = System.Threading.Thread.CurrentPrincipal; }
public void SetTimeOut(string name, TimeSpan duration, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { _Timer.SetTimeOut (name, duration, hsm, ev, timeOutType); }
public TimeOutCmd(QSystemTimer qTimer, string name, DateTime at, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { TimeSpan duration = new TimeSpan(0); _Time = at; DateTime now = DateTime.Now; if (at > now) { duration = at - now; } Init(qTimer, name, duration, hsm, ev, timeOutType); }
protected virtual TimeOutCmd CreateTimeOut(string name, DateTime at, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { return new TimeOutCmd (this, name, at, hsm, ev, timeOutType); }
protected void Init(QSystemTimer qTimer, string name, TimeSpan duration, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { _QTimer = qTimer; _Name = name; _Hsm = hsm; _Event = ev; _TimeOutType = timeOutType; double ms = duration.TotalMilliseconds; double msInterval = ms > 0 ? ms : TimeSpan.MaxValue.TotalMilliseconds; _Timer = new System.Timers.Timer (msInterval); _Timer.Elapsed += new System.Timers.ElapsedEventHandler(_Timer_Elapsed); _Timer.Enabled = ms > 0; _Principal = System.Threading.Thread.CurrentPrincipal; }
public void SetTimeOut(string name, DateTime at, IQEvent ev, TimeOutType timeOutType) { _EventManager.SetTimeOut(ToTimeOutName(name), at, this, ev, timeOutType); }
public void SetTimeOut(string name, TimeSpan duration, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { _Timer.SetTimeOut(name, duration, hsm, ev, timeOutType); }
public void SetTimeOut(string name, DateTime at, IQEvent ev, TimeOutType timeOutType) { _EventManager.SetTimeOut (ToTimeOutName (name), at, this, ev, timeOutType); }
protected virtual TimeOutCmd CreateTimeOut(string name, TimeSpan duration, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { if (_TimingScale != 1) { duration = new TimeSpan(duration.Ticks * _TimingScale); } return(new TimeOutCmd(this, name, duration, hsm, ev, timeOutType)); }
/// <summary> /// Parse Timeout Expressions /// single float (i.e. 1.0, 0.1, etc converts to TimeSpan.FromSeconds(value) /// every float (i.e. "every 1.0") repeats timeout every TimeSpan.FromSeconds(value) /// at DateTime (i.e. "at Sat, 01 Nov 2008 19:35:00 GMT") does single at DateTime.Parse(value) /// </summary> /// <param name="transition"></param> /// <param name="expression"></param> public void RegisterTimeOutExpression(GQHSMTransition transition, string expression) { string timeOutExpression = expression.Trim(); string eventSignal = transition.EventSignal; if (transition.EventSignal.Length > 0) { eventSignal = transition.EventSignal; } else { eventSignal = transition.Name; } if (timeOutExpression.IndexOf(" ") == -1) { double timeOut = 0.0f; GQHSMAction action = null; if (!Double.TryParse(timeOutExpression, out timeOut)) { action = new GQHSMAction(this, timeOutExpression); } RegisterTimeOutExpression(transition.GetSourceStateID(), new GQHSMTimeOut(transition.State[0].Name + "." + transition.GetFullName(), TimeSpan.FromSeconds(timeOut), new QEvent(eventSignal), action)); } else { string[] strList = timeOutExpression.Split(' '); string timeOutValue = strList [strList.Length - 1].Trim(); TimeOutType flag = TimeOutType.Single; if (timeOutExpression.StartsWith("every")) { flag = TimeOutType.Repeat; } if (timeOutExpression.StartsWith("at")) { flag = TimeOutType.Single; DateTime dt; GQHSMAction action = null; if (!DateTime.TryParse(timeOutValue, out dt)) { action = new GQHSMAction(this, timeOutValue); } RegisterTimeOutExpression(transition.GetSourceStateID(), new GQHSMTimeOut(transition.State[0].Name + "." + transition.GetFullName(), dt, new QEvent(eventSignal), action)); } else { Double timeOut = 0.0f; GQHSMAction action = null; if (!Double.TryParse(timeOutValue, out timeOut)) { action = new GQHSMAction(this, timeOutValue); } RegisterTimeOutExpression(transition.GetSourceStateID(), new GQHSMTimeOut(transition.State[0].Name + "." + transition.GetFullName(), TimeSpan.FromSeconds(timeOut), new QEvent(eventSignal), flag, action)); } } }
public void SetTimeOut(string name, TimeSpan duration, IQEvent ev, TimeOutType timeOutType) { _EventManager.SetTimeOut (ToTimeOutName (name), duration, this, ev, timeOutType); }
protected virtual TimeOutCmd CreateTimeOut(string name, TimeSpan duration, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { if (_TimingScale != 1) { duration = new TimeSpan (duration.Ticks * _TimingScale); } return new TimeOutCmd (this, name, duration, hsm, ev, timeOutType); }
public void SetTimeOut(string name, DateTime at, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { TimeOutCmd timeOut = CreateTimeOut (name, at, hsm, ev, timeOutType); SetTimeOut (timeOut); }
public void SetTimeOut(string name, TimeSpan duration, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { TimeOutCmd timeOut = CreateTimeOut (name, duration, hsm, ev, timeOutType); SetTimeOut (timeOut); }
public void SetTimeOut(string name, DateTime at, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { _Timer.SetTimeOut (name, at, hsm, ev, timeOutType); }
protected virtual TimeOutCmd CreateTimeOut(string name, DateTime at, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { return(new TimeOutCmd(this, name, at, hsm, ev, timeOutType)); }
public void SetTimeOut(string name, TimeSpan duration, IQEvent ev, TimeOutType timeOutType) { _EventManager.SetTimeOut(ToTimeOutName(name), duration, this, ev, timeOutType); }
public static void Set(string dbName, string key, object value, int timeOut, TimeOutType timeOutType) { Set(dbName, key, value, timeOut); }
public TimeOutCmd(QSystemTimer qTimer, string name, TimeSpan duration, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { Init (qTimer, name, duration, hsm, ev, timeOutType); }
public void SetTimeOut(string name, DateTime at, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { TimeOutCmd timeOut = CreateTimeOut(name, at, hsm, ev, timeOutType); SetTimeOut(timeOut); }
public void SetTimeOut(string name, DateTime at, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { _Timer.SetTimeOut(name, at, hsm, ev, timeOutType); }
public TimeOutCmd(QSystemTimer qTimer, string name, TimeSpan duration, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { Init(qTimer, name, duration, hsm, ev, timeOutType); }
public void SetTimeOut(string name, TimeSpan duration, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { TimeOutCmd timeOut = CreateTimeOut(name, duration, hsm, ev, timeOutType); SetTimeOut(timeOut); }
public TimeOutCmd(QSystemTimer qTimer, string name, DateTime at, IQHsm hsm, IQEvent ev, TimeOutType timeOutType) { TimeSpan duration = new TimeSpan (0); _Time = at; DateTime now = DateTime.Now; if (at > now) { duration = at - now; } Init (qTimer, name, duration, hsm, ev, timeOutType); }