Example #1
0
 public static void Remove(ref Event.Callback callback)
 {
     if (callback == null)
     {
         return;
     }
     callback.Remove();
     callback = null;
 }
Example #2
0
 public static void Remove <T1, T2, T3>(ref Event.Callback <T1, T2, T3> callback)
 {
     if (callback == null)
     {
         return;
     }
     callback.Remove();
     callback = null;
 }
Example #3
0
 public void Add(Event.Callback callback)
 {
     callback.Handler = this;
     lock (this.Lock)
     {
         Event.Callback last = this.Last;
         if (last != null)
         {
             last.Next         = callback;
             callback.Previous = last;
             this.Last         = callback;
         }
         else
         {
             this.First = callback;
             this.Last  = callback;
         }
     }
 }
Example #4
0
            public void Remove()
            {
                Event handler = this.Handler;

                Event.Callback next     = this.Next;
                Event.Callback previous = this.Previous;
                if (previous != null)
                {
                    previous.Next = next;
                    if (next == null)
                    {
                        handler.Last = previous;
                    }
                }
                else
                {
                    handler.First = next;
                }
                if (next != null)
                {
                    next.Previous = previous;
                    if (previous == null)
                    {
                        handler.First = next;
                    }
                }
                else
                {
                    handler.Last = previous;
                }
                if (!handler.Invoking)
                {
                    this.Previous = null;
                    this.Next     = null;
                }
                else
                {
                    handler.RemovedQueue.Enqueue(this);
                }
                this.Invoke  = null;
                this.Handler = null;
            }
Example #5
0
 public Event.Callback Add(Action callback)
 {
     Event.Callback callback1 = new Event.Callback(callback);
     this.Add(callback1);
     return(callback1);
 }
Example #6
0
 public Event.Callback <T> Add(Action <T> callback)
 {
     Event.Callback <T> callback1 = new Event.Callback <T>(callback);
     this.Add(callback1);
     return(callback1);
 }
 public Event.Callback <T1, T2, T3, T4> Add(Action <T1, T2, T3, T4> callback)
 {
     Event.Callback <T1, T2, T3, T4> callback1 = new Event.Callback <T1, T2, T3, T4>(callback);
     this.Add(callback1);
     return(callback1);
 }