Exemple #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;
        }
Exemple #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;
        }
 public void RemoveAction(ClockHandler handler)
 {
     Contract.Requires <ArgumentNullException> (handler != null);
 }
Exemple #4
0
 public void RemoveAction (ClockHandler handler) {
     if (this.all_handlers.ContainsKey (handler))
         this.all_handlers [handler] = () => { };
 }
Exemple #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;
 }