Exemplo n.º 1
0
 static void ik_Attach(object sender, AttachEventArgs e)
 {
     if (PhidgetsChanged != null)
     {
         foreach (EventHandler AttachHandler in PhidgetsChanged.GetInvocationList())
         {
             ISynchronizeInvoke syncInvoke = AttachHandler.Target as ISynchronizeInvoke;
             if ((syncInvoke != null) && (syncInvoke.InvokeRequired))
             {
                 syncInvoke.Invoke(AttachHandler, new object[] { null, null });
             }
             else
             {
                 AttachHandler(null, null);
             }
         }
     }
 }
Exemplo n.º 2
0
        static void _phidgetsManager_Detach(object sender, DetachEventArgs e)
        {
            int serial = e.Device.SerialNumber;

            IFKits[serial].close();
            IFKits.Remove(serial);

            if (PhidgetsChanged != null)
            {
                foreach (EventHandler AttachHandler in PhidgetsChanged.GetInvocationList())
                {
                    ISynchronizeInvoke syncInvoke = AttachHandler.Target as ISynchronizeInvoke;
                    if ((syncInvoke != null) && (syncInvoke.InvokeRequired))
                    {
                        syncInvoke.Invoke(AttachHandler, new object[] { null, null });
                    }
                    else
                    {
                        AttachHandler(null, null);
                    }
                }
            }
        }