Beispiel #1
0
 internal static void RaiseEvent <THandler>(VlcEventHandler <THandler> handler, object sender, VlcEventArgs <THandler> arg)
 {
     if (handler == null)
     {
         return;
     }
     foreach (VlcEventHandler <THandler> singleInvoke in handler.GetInvocationList())
     {
         var syncInvoke = singleInvoke.Target as ISynchronizeInvoke;
         if (syncInvoke == null)
         {
             continue;
         }
         if (syncInvoke is Control && ((Control)syncInvoke).IsDisposed)
         {
             continue;
         }
         try
         {
             if (syncInvoke.InvokeRequired)
             {
                 syncInvoke.Invoke(singleInvoke, new[] { sender, arg });
             }
             else
             {
                 singleInvoke(sender, arg);
             }
         }
         catch (ObjectDisposedException)
         {
             //Because IsDisposed was true and IsDisposed is now false...
             continue;
         }
     }
 }
Beispiel #2
0
 public static void RaiseEvent <TSender, THandler>(VlcEventHandler <TSender, THandler> handler, TSender sender, VlcEventArgs <THandler> arg)
 {
     if (handler == null)
     {
         return;
     }
     foreach (VlcEventHandler <TSender, THandler> singleInvoke in handler.GetInvocationList())
     {
         var syncInvoke = singleInvoke.Target as ISynchronizeInvoke;
         if (syncInvoke == null)
         {
             singleInvoke.DynamicInvoke(new object[] { sender, arg });
             continue;
         }
         try
         {
             if (syncInvoke.InvokeRequired)
             {
                 syncInvoke.Invoke(singleInvoke, new object[] { sender, arg });
             }
             else
             {
                 singleInvoke(sender, arg);
             }
         }
         catch (ObjectDisposedException)
         {
             //Because IsDisposed was true and IsDisposed could be false now...
             continue;
         }
     }
 }
 public static void RaiseEvent <TSender, THandler>(VlcEventHandler <TSender, THandler> handler, TSender sender, VlcEventArgs <THandler> arg)
 {
     if (handler == null || ExecuteRaiseEventDelegate == null)
     {
         return;
     }
     foreach (VlcEventHandler <TSender, THandler> singleInvoke in handler.GetInvocationList())
     {
         if (!CanRaiseEvent)
         {
             return;
         }
         ExecuteRaiseEventDelegate(singleInvoke, sender, arg);
     }
 }