public ClockHandler RegisterConditionalAction (Func <bool> condition, ClockAction action) { var new_id = new ClockHandler (); this.all_handlers.Add (new_id, action); this.cond_handlers.Add (condition, new_id); return new_id; }
public ClockHandler RegisterAction (ulong tick, ClockAction action) { if (this.CurrentTick >= tick) return null; var new_id = new ClockHandler (); this.all_handlers.Add (new_id, action); if (! this.tick_handlers.ContainsKey (tick)) this.tick_handlers.Add (tick, new List <ClockHandler> ()); this.tick_handlers [tick].Add (new_id); return new_id; }
public void RemoveAction(ClockHandler handler) { Contract.Requires <ArgumentNullException> (handler != null); }
public void RemoveAction (ClockHandler handler) { if (this.all_handlers.ContainsKey (handler)) this.all_handlers [handler] = () => { }; }
/// <inheritdoc /> public void RemoveAction (ClockHandler handler) { lock (this.syncRoot) { if (! this.all_handlers.ContainsKey (handler.Id)) throw new InvalidClockHandlerException (handler); if (this.all_handlers [handler.Id] == null) throw new InvalidClockHandlerException (handler); this.all_handlers [handler.Id] = null; } }
/// <summary> /// »нициализаци¤ нового экземпл¤ра исключени¤. /// </summary> /// <param name = "handler">ќписатель действи¤.</param> public InvalidClockHandlerException(ClockHandler handler) : base(string.Format (Strings.InvalidClockHandlerException, handler)) { this.Handler = handler; }