Пример #1
0
        private void DeviceCallback(IntPtr device, bool added, IntPtr context)
        {
            //Called whenever a DirectOutput device is added or removed from the system.
            Debug.Print("DeviceCallback(): 0x" + device.ToString("x") + (added ? " Added" : " Removed"));
            if (GetDeviceType(device) != DeviceTypes.Fip)
            {
                return;
            }
            if (!added && _fipPanels.Count == 0)
            {
                return;
            }

            var i     = _fipPanels.Count - 1;
            var found = false;

            do
            {
                if (_fipPanels[i].DevicePtr == device)
                {
                    found = true;
                    var fip = _fipPanels[i];
                    if (!added)
                    {
                        fip.Shutdown();
                        _fipPanels.Remove(fip);
                    }
                }
                i--;
            } while (i >= 0);
            if (added && !found)
            {
                Debug.Print("DeviceCallback() Spawning one FIPPanelA10C. " + device);
                var fipPanel = new FIPPanelA10C(device, this);
                fipPanel.FIPHandler = this;
                _fipPanels.Add(fipPanel);
                fipPanel.Initalize();
            }
            if (OnFIPCountChanged != null)
            {
                OnFIPCountChanged(_fipPanels.Count);
            }
        }
Пример #2
0
 private void EnumerateCallback(IntPtr device, IntPtr context)
 {
     //Called initially when enumerating FIPs.
     try
     {
         if (GetDeviceType(device) != DeviceTypes.Fip)
         {
             return;
         }
         Debug.Print("Spawning one [FIPPanelA10C]. EnumerateCallback() Device: 0x" + device.ToString("x"));
         var fipPanel = new FIPPanelA10C(device, this);
         fipPanel.FIPHandler = this;
         _fipPanels.Add(fipPanel);
         fipPanel.Initalize();
     }
     catch (Exception ex)
     {
         Common.LogError(788788, ex, "EnumerateCallback for FIP " + device);
         throw;
     }
 }