Exemplo n.º 1
0
 /// <summary>
 /// Detaches the specified t.
 /// </summary>
 /// <param name="t">The t.</param>
 public static void Detach(WeakTimer t)
 {
     for (int i = _listeners.Count - 1; i >= 0; i--)
     {
         WeakReference wr = (WeakReference)_listeners[i];
         try
         {
             if (wr.Target == t)
             {
                 _listeners.RemoveAt(i);
             }
         }
         catch
         {
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Attaches the specified t.
        /// </summary>
        /// <param name="t">The t.</param>
        public static void Attach(WeakTimer t)
        {
            WeakReference wr = new WeakReference(t);

            _listeners.Add(wr);
        }