Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
 public void RemoveAction(ClockHandler handler)
 {
     Contract.Requires <ArgumentNullException> (handler != null);
 }
Exemplo n.º 4
0
 public void RemoveAction (ClockHandler handler) {
     if (this.all_handlers.ContainsKey (handler))
         this.all_handlers [handler] = () => { };
 }
Exemplo n.º 5
0
        /// <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;
 }