Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 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;
         }
     }
 }