예제 #1
0
 /// <summary>
 /// Adds a handler to this event.
 /// </summary>
 /// <param name="handler">Delegate to be invoked when event is ran.</param>
 /// <param name="priority">
 /// The priority order of this handler. LOWER priorities are called FIRST, and higher priorities are
 /// called last. The default priority is 'Normal'.
 /// </param>
 /// <param name="ignoreCancel">If true, the handler will be executed even if a previous handler cancelled the event.</param>
 /// <remarks>
 /// For information on the priority ordering system, see <c>Priority</c>.
 /// </remarks>
 public void AddHandler(EventHandler <TArgs> handler, EventPriority priority, bool ignoreCancel = false)
 {
     handlers.Add(new PrioritizedEventHandler <TArgs>(handler, priority, ignoreCancel));
     handlers.Sort((a, b) => ((int)a.Priority).CompareTo(b.Priority)); // Sort by priority
 }
예제 #2
0
 public PrioritizedEventHandler(EventHandler <TArgsType> handler, EventPriority priority, bool ignoreCancel = false)
 {
     Event        = handler;
     Priority     = priority;
     IgnoreCancel = ignoreCancel;
 }