private void StopEvents()
        {
            ManagerRemote.LogLine("StopEvents");

            if (m_usbDiscovery != null)
            {
                m_usbDiscovery.Dispose();
                m_usbDiscovery = null;
            }

            if (m_emulatorDiscovery != null)
            {
                m_emulatorDiscovery.Dispose();
                m_emulatorDiscovery = null;
            }
        }
 private void Dispose(bool disposing)
 {
     if (!m_disposed)
     {
         if (disposing)
         {
             if (m_usbDiscovery != null)
             {
                 m_usbDiscovery.OnDeviceChanged -= new Microsoft.SPOT.Debugger.UsbDeviceDiscovery.DeviceChangedEventHandler(OnDeviceListChanged);
                 m_usbDiscovery.Dispose();
                 m_usbDiscovery = null;
             }
         }
         m_disposed = true;
     }
 }
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                Stop();

                if (components != null)
                {
                    components.Dispose();
                }

                if (m_usbDiscovery != null)
                {
                    m_usbDiscovery.Dispose();
                }
            }
            base.Dispose(disposing);
        }