Exemple #1
0
        private void usbDevices_DeviceAttached(object sender, EventArgs e)
        {
            USBEventArgs usbEvent = e as USBEventArgs;

            DeviceChanged?.Invoke(usbEvent.FriendlyName, false);
            //toolStripStatusLabel1.Text = usbEvent.Device.FriendlyName + " connected.";
        }
Exemple #2
0
        private void usbDevices_DeviceRemoved(object sender, EventArgs e)
        {
            USBEventArgs usbEvent = e as USBEventArgs;

            DeviceChanged?.Invoke(usbEvent.FriendlyName, true);
            //toolStripStatusLabel1.Text = usbEvent.FriendlyName + " removed.";
        }
Exemple #3
0
        static void usbDevices_DeviceRemoved(object sender, EventArgs e)
        {
            USBEventArgs usbEvent = e as USBEventArgs;

            Status     = usbEvent.FriendlyName + " removed.";
            m_EndPoint = null;
            //    MessageBox.Show("Removed");
        }
Exemple #4
0
        private void UsbDevices_DeviceRemoved(object sender, EventArgs e)
        {
            isConnect = false;
            USBEventArgs usbEvent = e as USBEventArgs;

            //Console.WriteLine(usbEvent.FriendlyName.ToString() + " Removed");
            NLogHelper.DebugLog(usbEvent.FriendlyName.ToString() + " Removed");
            MessageBox.Show(usbEvent.FriendlyName.ToString() + " Removed");
        }
Exemple #5
0
        /*Summary
         * This is the event handler for device removal. This method resets the device count and searches for the device with VID-PID 04b4-1003
         */
        void UsbDevices_DeviceRemoved(object sender, EventArgs e)
        {
            USBEventArgs evt           = (USBEventArgs)e;
            USBDevice    RemovedDevice = evt.Device;

            string RemovedDeviceName = evt.FriendlyName;

            MyLog.Error(RemovedDeviceName + "板卡断开");

            int key = int.Parse(evt.ProductID.ToString("x4").Substring(0, 2), System.Globalization.NumberStyles.HexNumber);

            USB.MyDeviceList[key] = null;
        }
Exemple #6
0
        //USB COMMS Event Callback FUNCTIONS
        #region //USB COMMS Event Callback FUNCTIONS

        /**********************************************************************
         * NAME: usbDevices_DeviceRemoved
         *
         * DESCRIPTION: Event handler for the removal of a USB device. When the removal
         * of a USB device is detected, this function will be called which will check to
         * see if the device removed was the device we were using. If so, then reset
         * device handler (myHidDevice), disable the timer, and update the GUI.
         *
         ***********************************************************************/

        public void usbDevices_DeviceRemoved(object sender, EventArgs e)
        {
            USBEventArgs usbEvent = e as USBEventArgs;

            // Handle FW ID
            if ((usbEvent.ProductID == Product_ID_FW) && (usbEvent.VendorID == Vendor_ID))
            {
                myHidDevice_FW = null;
                GetDevice();                        // Process device status
            }
            // Handle BL ID
            if ((usbEvent.ProductID == Product_ID_BL) && (usbEvent.VendorID == Vendor_ID))
            {
                myHidDevice_BL = null;
                GetDevice();                        // Process device status
            }
        }
Exemple #7
0
        static void usbDevices_DeviceAttached(object sender, EventArgs e)
        {
            try
            {
                USBEventArgs usbEvent = e as USBEventArgs;
                Status        = usbEvent.Device.FriendlyName + " connected.";
                m_CyUSBDevice = usbEvent.Device as CyUSBDevice;
                if (m_CyUSBDevice.EndPointCount >= 1)
                {
                    m_EndPoint = m_CyUSBDevice.EndPoints[0];
                }
            }
            catch (Exception exc)
            {
                //MessageBox.Show(exc.Message, "Excepion Occurred After disconnecting");
            }

            //    MessageBox.Show("Connected");
        }