private void addEvent(long time, eventDelegate eventDel) { Event e = new Event(); e.eventDelegate = eventDel; time = System.DateTime.Now.Ticks + time; time >>= 10; lock (sdict) { List <Event> elist; sdict.TryGetValue(time, out elist); /*try { * elist = sdict[time]; * } catch {} */ if (elist == null) { elist = new List <Event>(); sdict.Add(time, elist); } elist.Add(e); } }
// constructor public TimedSimulatedEvent(double interval, double jitter, eventDelegate callback) { // jitter must be a positive value if (jitter < 0) { throw new ArgumentException("Jitter value must be >= 0"); } else { this.jitter = jitter; } // interval must be at greater than or equal to the jitter value if (interval < jitter) { throw new ArgumentException("interval must be >= jitter value"); } else { this.interval = interval; } if (callback != null) { this.SetCallback(callback); } eventTimer = new Timer(); eventTimer.AutoReset = false; // don't automatically rerun the timer eventTimer.Elapsed += OnTimedEvent; }
public MainScanItem(saveTab scanParams, CookieContainer cookie, eventDelegate deleg, bool ignoreWarn, int resDel) { Steam.scanInput = scanParams; Steam.NotSetHead = (scanParams.Name == string.Empty); Steam.delegMessage += deleg; Steam.cookieCont = cookie; //Steam.currencies.Current = currency; Steam.IgnoreWarn = ignoreWarn; Steam.resellDelay = resDel; }
public bool Unsubscribe(string eventName, eventDelegate client) { int index = Array.FindIndex(eventsList, s => s == eventName); if (index >= 0) { events[index] -= client; return(true); } return(false); }
/// <summary> /// 移除事件监听 /// </summary> public void RemoveEventListener(string msg, eventDelegate func) { if (eventDic.ContainsKey(msg)) { eventDic[msg] -= func; if (eventDic[msg] == null) { eventDic.Remove(msg); } } }
public bool Subscribe(string eventName, eventDelegate client) { int index = Array.FindIndex(eventsList, s => s == eventName); if (eventsList.Length > index && index >= 0) { Debug.Log(index); events[index] += client; return(true); } return(false); }
/// <summary> /// 监听事件消息,执行一次后销毁,函数委托必须添加BaseEvent参数 /// </summary> public bool AddOnce(string msg, eventDelegate func) { if (eventOnceDic.ContainsKey(msg)) { eventOnceDic[msg] += func; } else { eventOnceDic.Add(msg, func); } return(true); }
private void addEvent(long time, eventDelegate eventDel) { Event e = new Event(); e.eventDelegate = eventDel; time = System.DateTime.Now.Ticks + time; time >>= 10; lock (sdict) { List<Event> elist; sdict.TryGetValue(time, out elist); /*try { elist = sdict[time]; } catch {} */ if (elist == null) { elist = new List<Event>(); sdict.Add(time, elist); } elist.Add(e); } }
public void SubscribeBeginDragEvent(eventDelegate beginDragDelegate) { beginDragEvent += beginDragDelegate; }
public void SubscribePointerUpEvent(eventDelegate pointerUpDelegate) { pointerUpEvent += pointerUpDelegate; }
public void SubscribeDragEvent(eventDelegate dragDelegate) { dragEvent += dragDelegate; }
public FakeTimedSimulatedEvent(ISimulatedEvent originalEvent) { this.eventCallback = originalEvent.EventDelegate; }
public void addEventInCS(long time, eventDelegate eventDel) { time = time * 100000; addEvent(time, eventDel); }
/// <summary> /// Invokes an event in a thread safe manner. /// </summary> /// <param name="del"></param> public void InvokeEvent(eventDelegate del) { lock (lockThis) { del(); } }
public MainForm() { delegMessage = new eventDelegate(Event_Message); InitializeComponent(); }
public void onDisconnect(eventDelegate e) { this.m_onDisconnect = e; }
public void onConnection(eventDelegate e) { this.m_onConnection = e; }
/// <summary> /// Add an event to the event handler in centiseconds. /// </summary> /// <param name="time">Time in centiseconds to have the event called.</param> /// <param name="eventDel">The event delegate to perform /// after time has passed.</param> public void AddEventInCS(long time, eventDelegate eventDel) { lock (lockThis) { eventHandler.addEventInCS(time, eventDel); } }
public void SetCallback(eventDelegate callback) { this.timerDelegate = callback; }
public bool Unsubscribe(string eventName, eventDelegate client) { }
/// <summary> /// Invokes an event in a thread safe manner. /// </summary> /// <param name="del"></param> public void InvokeEvent(eventDelegate del) { lock (lockThis) { del(); } }
/// <summary> /// Add an event to the event handler in centiseconds. /// </summary> /// <param name="time">Time in centiseconds to have the event called.</param> /// <param name="eventDel">The event delegate to perform /// after time has passed.</param> public void AddEventInCS(long time, eventDelegate eventDel) { lock (lockThis) { eventHandler.addEventInCS(time, eventDel); } }
/// <summary> /// Set a callback to execute when a event is required /// </summary> /// <param name="eventName">Name of the event</param> /// <param name="callback">Callback to be excecuted</param> public void On(string eventName, eventDelegate callback) { this.eventTable.Add(eventName, callback); }
public void addEventInCS(long time, eventDelegate eventDel) { time = time * 100000; addEvent(time, eventDel); }