Exemple #1
0
        public uint SetTimer <TEnum>(float interval, XTimerMgr.ElapsedIDEventHandler handler, object param, TEnum e) where TEnum : struct
        {
            this._token += 1u;
            int id = XFastEnumIntEqualityComparer <TEnum> .ToInt(e);

            if (interval <= 0f)
            {
                handler(param, id);
                this._token += 1u;
            }
            else
            {
                double           trigger = this._elapsed + Math.Round((double)interval, 3);
                XTimerMgr.XTimer timer   = this.GetTimer(trigger, handler, param, this._token, false, id);
                this._timers.PushHeap(timer);
                this._dict.Add(this._token, timer);
            }
            return(this._token);
        }
 public int GetHashCode(TEnum en)
 {
     return(XFastEnumIntEqualityComparer <TEnum> .ToInt(en));
 }
 public bool Equals(TEnum lhs, TEnum rhs)
 {
     return(XFastEnumIntEqualityComparer <TEnum> .ToInt(lhs) == XFastEnumIntEqualityComparer <TEnum> .ToInt(rhs));
 }