Beispiel #1
0
        public void RegDeviceEvent(bool b)
        {
            if (this.devNotifier == null)
            {
                this.devNotifier = DeviceNotifier.OpenDeviceNotifier();
            }
            try
            {
                switch (b)
                {
                case false:
                {
                    this.IsRegistered = false;
                    this.devNotifier.OnDeviceNotify -= (new EventHandler <DeviceNotifyEventArgs>(this.devNotifier_OnDeviceNotify));
                    break;
                }

                case true:
                {
                    this.IsRegistered = true;
                    this.USBDrive     = string.Empty;
                    this.devNotifier.OnDeviceNotify -= (new EventHandler <DeviceNotifyEventArgs>(this.devNotifier_OnDeviceNotify));
                    this.devNotifier.OnDeviceNotify += (new EventHandler <DeviceNotifyEventArgs>(this.devNotifier_OnDeviceNotify));
                    break;
                }
                }
            }
            catch
            {
            }
        }
Beispiel #2
0
 /// <summary>
 /// Creates an instance of a USB device using a VID PID pair
 /// </summary>
 /// <param name="vid">VID</param>
 /// <param name="pid">PID</param>
 public VUsbDevice(int vid, int pid)
 {
     MyUsbFinder       = new UsbDeviceFinder(vid, pid);
     UsbDeviceNotifier = DeviceNotifier.OpenDeviceNotifier();
     UsbDeviceNotifier.OnDeviceNotify += new EventHandler <DeviceNotifyEventArgs>(UsbDeviceNotifier_OnDeviceNotify);
     UsbDeviceNotifier.Enabled         = true;
 }
        public fTestDeviceNotify()
        {
            InitializeComponent();
            devNotifier = DeviceNotifier.OpenDeviceNotifier();

            devNotifier.OnDeviceNotify += onDevNotify;
        }
        public MainWindow()
        {
            InitializeComponent();

            autoReadTimer          = new DispatcherTimer();
            autoReadTimer.Tick    += new EventHandler(autoReadObjects);
            autoReadTimer.Interval = new TimeSpan(0, 0, 1);   // Hours, Minutes, Seconds



            // try to connect to device. Show status in status bar
            try
            {
                traqpaq = new TraqpaqDevice();
                // update status bar
                //traqpaq.myOTPreader.reqSerialNumber();
                statusBarItemTraqpaq.Content = "Device connected";
                oneTimeRead();
                autoReadTimer.Start();
            }
            catch (TraqPaqNotConnectedException)
            {
                // Device not found
                traqpaq = null;
                // update status bar
                statusBarItemTraqpaq.Content = "Device not found";
                // Set up event handler to wait for a usb device to connect to
                deviceNotifier = DeviceNotifier.OpenDeviceNotifier();
                deviceNotifier.OnDeviceNotify += new EventHandler <DeviceNotifyEventArgs>(deviceNotifier_OnDeviceNotify);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Objeto construtor
        /// </summary>
        public Serial() : base()
        {
            devNotifier = DeviceNotifier.OpenDeviceNotifier();
            devNotifier.OnDeviceNotify += (object sender, DeviceNotifyEventArgs e) =>
            {
                if (e == null || e.Device == null)
                {
                    return;
                }

                string idportcom = PortCom.HardwareID.Split('&')[1];
                string iddevnoti = e.Device.Name.Split('#')[1].Split('&')[0];

                if (e.EventType == EventType.DeviceArrival)
                {
                    if (idportcom == iddevnoti)
                    {
                        RaiseAoConectarCaboUSB($"O equipamento {PortCom.Fabricante} {PortCom.Modelo} foi localizado\nporém não foi possível determinar se ele ainda está utilizando a mesma porta de conexão");
                    }

                    return;
                }

                if (idportcom == iddevnoti)
                {
                    TratamentoErros erro     = new TratamentoErros();
                    string          mensagem = $"O equipamento  {PortCom.Fabricante} {PortCom.Modelo} foi desconectado da porta {PortCom.PortName}";
                    erro.Mensagem = mensagem;
                    erro.Numero   = 1;
                    erro.Detalhes = new Exception(mensagem);
                    RaiseAoEncontrarErro(erro);
                }
            };
        }
Beispiel #6
0
        public fTestDeviceNotify()
        {
            InitializeComponent();
            devNotifier = DeviceNotifier.OpenDeviceNotifier();

            devNotifier.OnDeviceNotify += onDevNotify;
        }
        public MainWindow()
        {
            InitializeComponent();

            autoReadTimer = new DispatcherTimer();
            autoReadTimer.Tick += new EventHandler(autoReadObjects);
            autoReadTimer.Interval = new TimeSpan(0, 0, 1);   // Hours, Minutes, Seconds

            // try to connect to device. Show status in status bar
            try
            {
                traqpaq = new TraqpaqDevice();
                // update status bar
                //traqpaq.myOTPreader.reqSerialNumber();
                statusBarItemTraqpaq.Content = "Device connected";
                oneTimeRead();
                autoReadTimer.Start();

            }
            catch (TraqPaqNotConnectedException)
            {
                // Device not found
                traqpaq = null;
                // update status bar
                statusBarItemTraqpaq.Content = "Device not found";
                // Set up event handler to wait for a usb device to connect to
                deviceNotifier = DeviceNotifier.OpenDeviceNotifier();
                deviceNotifier.OnDeviceNotify += new EventHandler<DeviceNotifyEventArgs>(deviceNotifier_OnDeviceNotify);
            }
        }
 /// <summary>
 /// Creates an instance of a USB device using a VID PID pair
 /// </summary>
 /// <param name="vid">VID</param>
 /// <param name="pid">PID</param>
 public VUsbDevice(int vid, int pid)
 {
     MyUsbFinder = new UsbDeviceFinder(vid, pid);
     UsbDeviceNotifier = DeviceNotifier.OpenDeviceNotifier();
     UsbDeviceNotifier.OnDeviceNotify += new EventHandler<DeviceNotifyEventArgs>(UsbDeviceNotifier_OnDeviceNotify);
     UsbDeviceNotifier.Enabled = true;
 }
 public RemoteManager()
 {
     InitializeComponent();
     manager                           = new ManagerHandler(this, managerColour);
     USBDeviceNotifier                 = DeviceNotifier.OpenDeviceNotifier();
     USBDeviceNotifier.Enabled         = false;
     USBDeviceNotifier.OnDeviceNotify += OnDeviceNotifyEvent;
 }
        private LCTFController()
        {
            this.usbFinder         = new UsbDeviceFinder(new Guid("{d67436ae-96c7-4da3-83c9-322c4ceb41f3}"));
            this.usbDeviceNotifier = DeviceNotifier.OpenDeviceNotifier();
            this.usbDeviceNotifier.OnDeviceNotify += this.OnDeviceNotify;
            this.usbDeviceNotifier.Enabled         = true;

            this.UpdateAttachedDevices();
        }
 protected override void Initialize()
 {
     #if IOS
     startPollThread();
     #else
     UsbDeviceNotifier = DeviceNotifier.OpenDeviceNotifier();
     UsbDeviceNotifier.OnDeviceNotify += OnDeviceNotifyEvent;
     #endif
 }
Beispiel #12
0
 public Teensy(int pid, int vid)
 {
     _vid         = vid;
     _pid         = pid;
     _usbFinder   = new UsbDeviceFinder(_vid, _pid);
     _buffer      = null;
     _devNotifier = DeviceNotifier.OpenDeviceNotifier();
     _devNotifier.OnDeviceNotify += OnDeviceNotify;
 }
Beispiel #13
0
 public Teensy(int pid, int vid)
 {
     _vid = vid;
     _pid = pid;
     _usbFinder = new UsbDeviceFinder(_vid, _pid);
     _buffer = null;
     _devNotifier = DeviceNotifier.OpenDeviceNotifier();
     _devNotifier.OnDeviceNotify += OnDeviceNotify;
 }
Beispiel #14
0
        private UsbWatcher()
        {
            m_Devices = new List <UsbSubscription> ();

            // Set-up the USB watcher
            m_Watcher = new LinuxDeviceNotifier();
            m_Watcher.OnDeviceNotify += new EventHandler <DeviceNotifyEventArgs> (UsbDeviceNotifier_OnDeviceNotify);
            m_Watcher.Enabled         = true;
        }
Beispiel #15
0
        private UsbWatcher()
        {
            m_Devices = new List<UsbSubscription> ();

            // Set-up the USB watcher
            m_Watcher = new LinuxDeviceNotifier ();
            m_Watcher.OnDeviceNotify += new EventHandler<DeviceNotifyEventArgs> (UsbDeviceNotifier_OnDeviceNotify);
            m_Watcher.Enabled = true;
        }
 public ArduinoUsbDevice(int vendorId, int productId)
 {
     _vendorId          = vendorId;
     _productId         = productId;
     _myUsbFinder       = new UsbDeviceFinder(_vendorId, _productId);
     _usbDeviceNotifier = DeviceNotifier.OpenDeviceNotifier();
     _usbDeviceNotifier.OnDeviceNotify += OnDeviceNotifyEvent;
     ConnectUsbDevice();
 }
Beispiel #17
0
        public Form1()
        {
            InitializeComponent();

            devNotifier = DeviceNotifier.OpenDeviceNotifier();

        //    devNotifier.OnDeviceNotify += onDevNotify;

            devNotifier.OnDeviceNotify += new EventHandler<DeviceNotifyEventArgs>(onDevNotify);
        }
Beispiel #18
0
        public Form1()
        {
            InitializeComponent();

            devNotifier = DeviceNotifier.OpenDeviceNotifier();

            //    devNotifier.OnDeviceNotify += onDevNotify;

            devNotifier.OnDeviceNotify += new EventHandler <DeviceNotifyEventArgs>(onDevNotify);
        }
        public FirmwareManagerForm()
        {
            InitializeComponent();
            devNotifier = DeviceNotifier.OpenDeviceNotifier();
            // devNotifier.OnDeviceNotify += devNotifier_OnDeviceNotify;

            TreehopperManager manager = new TreehopperManager();
            manager.BoardAdded += manager_BoardAdded;
            manager.BoardRemoved += manager_BoardRemoved;
        }
		public UsbMonitor (IntPtr mainWindowHandle)
		{
			if (BlinkstickDeviceFinder.IsUnix ()) {
				UsbDeviceNotifier = DeviceNotifier.OpenDeviceNotifier();
				UsbDeviceNotifier.OnDeviceNotify += OnDeviceNotifyEvent;
			} else {
				winUsbDeviceMonitor = new WinUsbDeviceMonitor();
				winUsbDeviceMonitor.DeviceListChanged += HandleDeviceListChanged;
			}
		}
Beispiel #21
0
        private void AttachUsbNotifier()
        {
            usbDeviceNotifier = DeviceNotifier.OpenDeviceNotifier();
            usbDeviceNotifier.OnDeviceNotify += OnDeviceNotify;

            while (true)
            {
                Application.DoEvents();
            }
        }
Beispiel #22
0
        public FirmwareManagerForm()
        {
            InitializeComponent();
            devNotifier = DeviceNotifier.OpenDeviceNotifier();
            // devNotifier.OnDeviceNotify += devNotifier_OnDeviceNotify;

            TreehopperManager manager = new TreehopperManager();

            manager.BoardAdded   += manager_BoardAdded;
            manager.BoardRemoved += manager_BoardRemoved;
        }
        public ArduinoUsbDevice(int vendorId, int productId)
        {
            _vendorId = vendorId;
            _productId = productId;

            _myUsbFinder = new UsbDeviceFinder(_vendorId, _productId);
            _usbDeviceNotifier = DeviceNotifier.OpenDeviceNotifier();

            _usbDeviceNotifier.OnDeviceNotify += OnDeviceNotifyEvent;

            ConnectUsbDevice();
        }
Beispiel #24
0
        public ClearShotWinUsbService()
        {
            _targetDevice = UsbDevice.OpenUsbDevice(x => x.Pid == ClearShotDevice.ProductId && x.Vid == ClearShotDevice.VendorId);

            if (_targetDevice != null)
            {
                OnConnected(this, EventArgs.Empty);
            }

            _devNotifier = DeviceNotifier.OpenDeviceNotifier();
            _devNotifier.OnDeviceNotify += OnDevNotify;
        }
Beispiel #25
0
 public MainWindow()
 {
     InitializeComponent();
     _UsbKeyDataStruct = new UsbKeyDataStruct();
     devNotifier = DeviceNotifier.OpenDeviceNotifier();
     devNotifier.OnDeviceNotify += devNotifier_OnDeviceNotify;
     this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
     btnG.IsEnabled =false;
    // byte[] aaa = new byte[12] { 0x35, 0x77, 0x61, 0x54, 0x42, 0x6A, 0x49, 0x44, 0x46, 0x2f, 0x34, 0x3d };
     //byte[] ret = Decrypt(aaa);
    // string aa = System.Text.Encoding.Default.GetString(ret);
     ;
 }
Beispiel #26
0
 public MainWindow()
 {
     InitializeComponent();
     _UsbKeyDataStruct           = new UsbKeyDataStruct();
     devNotifier                 = DeviceNotifier.OpenDeviceNotifier();
     devNotifier.OnDeviceNotify += devNotifier_OnDeviceNotify;
     this.Loaded                += new RoutedEventHandler(MainWindow_Loaded);
     btnG.IsEnabled              = false;
     // byte[] aaa = new byte[12] { 0x35, 0x77, 0x61, 0x54, 0x42, 0x6A, 0x49, 0x44, 0x46, 0x2f, 0x34, 0x3d };
     //byte[] ret = Decrypt(aaa);
     // string aa = System.Text.Encoding.Default.GetString(ret);
     ;
 }
Beispiel #27
0
        public MainWindow()
        {
            InitializeComponent();
            _UsbKeyDataStruct           = new UsbKeyDataStruct();
            devNotifier                 = DeviceNotifier.OpenDeviceNotifier();
            devNotifier.OnDeviceNotify += devNotifier_OnDeviceNotify;
            this.Loaded                += new RoutedEventHandler(MainWindow_Loaded);
            btnG.IsEnabled              = false;
            Uri        uri = new Uri(@"disconnect.jpg", UriKind.Relative);
            ImageBrush ib  = new ImageBrush();

            ib.ImageSource    = new BitmapImage(uri);
            ib.Stretch        = Stretch.Uniform;
            lbicon.Background = ib;
        }
Beispiel #28
0
        public UsbMonitor()
        {
            switch (HidSharp.PlatformDetector.RunningPlatform())
            {
            case HidSharp.PlatformDetector.Platform.Windows:
                winUsbDeviceMonitor = new WinUsbDeviceMonitor();
                winUsbDeviceMonitor.DeviceListChanged += HandleDeviceListChanged;
                break;

            case HidSharp.PlatformDetector.Platform.Linux:
                UsbDeviceNotifier = DeviceNotifier.OpenDeviceNotifier();
                UsbDeviceNotifier.OnDeviceNotify += OnDeviceNotifyEvent;
                break;
            }
        }
Beispiel #29
0
        public void BeginDiscovery()
        {
            if (m_usbNotifier != null)
            {
                throw new InvalidOperationException();
            }

            // Test all the loaded HID devices to see if they're valid
            HidDeviceLoader loader = new HidDeviceLoader();

            foreach (var device in loader.GetDevices())
            {
                DeviceID id = new DeviceID(device);
                IInitDevice(id, DeviceEventType.DeviceDiscovered);
            }

            // Register for new device insertions
            m_usbNotifier = DeviceNotifier.OpenDeviceNotifier();
            m_usbNotifier.OnDeviceNotify += IOnUsbNotify;
        }
Beispiel #30
0
        public UsbPanel()
        {
            InitializeComponent();

            this.Icon = Icon.FromHandle(GraphicsResx.usbpanelicon.GetHicon());

            try
            {
                UsbDevice.UsbErrorEvent += OnUsbError;

                devNotifier = DeviceNotifier.OpenDeviceNotifier();
                devNotifier.OnDeviceNotify += onDevNotify;

                FillDeviceInfo();
            }
            catch (Exception ex)
            {
                ErrorReportWindow.Show(ex, "Error Initializing USB Panel");
            }
        }
Beispiel #31
0
        public UsbPanel()
        {
            InitializeComponent();

            this.Icon = Icon.FromHandle(GraphicsResx.usbpanelicon.GetHicon());

            try
            {
                UsbDevice.UsbErrorEvent += OnUsbError;

                devNotifier = DeviceNotifier.OpenDeviceNotifier();
                devNotifier.OnDeviceNotify += onDevNotify;

                FillDeviceInfo();
            }
            catch (Exception ex)
            {
                ErrorReportWindow.Show(ex, "Error Initializing USB Panel");
            }
        }
Beispiel #32
0
        protected override EventResult OnConnectBusy()
        {
            try {
                if (usb_finder_ == null)
                {
                    usb_finder_ = new UsbDeviceFinder((int)devp_.CommVendorID.Value, (int)devp_.CommProductID.Value);
                }

                if ((devp_.DeviceEventCapture.Value) && (usb_notifier_ == null))
                {
                    usb_notifier_         = DeviceNotifier.OpenDeviceNotifier();
                    usb_notifier_.Enabled = false;
                }

                if (usb_notifier_ != null)
                {
                    usb_notifier_.Enabled         = false;
                    usb_notifier_.OnDeviceNotify -= OnUsbDeviceNotify;
                    usb_notifier_.OnDeviceNotify += OnUsbDeviceNotify;
                    usb_notifier_.Enabled         = true;
                }

                if ((devp_.DeviceComm.Value) && (usb_device_ == null) && (usb_finder_ != null))
                {
                    usb_device_ = UsbDevice.OpenUsbDevice(usb_finder_);
                }

                if (((devp_.DeviceEventCapture.Value) && (usb_notifier_ == null)) ||
                    ((devp_.DeviceComm.Value) && (usb_device_ == null))
                    )
                {
                    return(EventResult.Busy);
                }

                return(EventResult.Success);
            } catch {
                return(EventResult.Busy);
            }
        }
Beispiel #33
0
        protected override void OnDisconnectStart()
        {
            if (usb_reader_ != null)
            {
                usb_reader_.DataReceivedEnabled = false;
//                usb_reader_.DataReceived -=
            }

            if (usb_device_ != null)
            {
                if (usb_device_.IsOpen)
                {
                    if (usb_device_ is IUsbDevice usb_device_i)
                    {
                        usb_device_i.ReleaseInterface(0);
                    }

                    usb_device_.Close();
                }
                usb_device_ = null;
            }

            if (usb_notifier_ != null)
            {
                usb_notifier_.Enabled         = false;
                usb_notifier_.OnDeviceNotify -= OnUsbDeviceNotify;
                usb_notifier_ = null;
            }

            if (usb_finder_ != null)
            {
                usb_finder_ = null;
            }

            UsbDevice.Exit();
        }
Beispiel #34
0
 public void Hook()
 {
     UsbDeviceNotifier = DeviceNotifier.OpenDeviceNotifier();
     UsbDeviceNotifier.OnDeviceNotify += OnDeviceNotifyEvent;
 }
Beispiel #35
0
        public MainControl()
        {
            InitializeComponent();
            //初始化浏览器
            this.initChartBrowser();
            this.chartBrowser.Navigate(dirRoot + @"\Views\Browser\main.html");

            //若过了试用期并且未注册,则不进行U盘监听
            if (!deviceService.CheckEffective())
            {
                return;
            }
            deviceDic      = new Dictionary <string, bool>();
            deviceNotifier = DeviceNotifier.OpenDeviceNotifier();
            deviceNotifier.OnDeviceNotify += OnDeviceNotifyEvent;

            try
            {
                allUsbDrives = DriveInfo.GetDrives().Where(x => x.DriveType == DriveType.Removable).ToArray();
                //开启任务异步操作,避免多个采集站统计加载时界面假死
                Thread ts = new Thread(() =>
                {
                    var resourceIndex = 0;
                    var searcher      = new ManagementObjectSearcher("SELECT * FROM Win32_LogicalDiskToPartition");
                    foreach (ManagementObject dm in searcher.Get())
                    {
                        var drive   = getValueInQuotes(dm["Dependent"].ToString()) + @"\";
                        diskArray   = getValueInQuotes(dm["Antecedent"].ToString()).Split(',');
                        driveNumber = Convert.ToInt32(diskArray[0].Remove(0, 6).Trim());
                        var disks   = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");
                        foreach (ManagementObject disk in disks.Get())
                        {
                            if (disk["Name"].ToString() == ("\\\\.\\PHYSICALDRIVE" + driveNumber.ToString()) & disk["InterfaceType"].ToString() == "USB")
                            {
                                DeviceControl device = new DeviceControl();
                                var serialNumber     = parseSerialFromDeviceID(disk["PNPDeviceID"].ToString()).ToUpper();
                                DriveInfo d          = allUsbDrives.FirstOrDefault(x => x.Name == drive);
                                if (d == null)
                                {
                                    continue;
                                }
                                var deviceName = d.Name;
                                var deviceRoot = d.RootDirectory;
                                var checkToken = device.CheckDeviceToken(deviceName, serialNumber);
                                if (checkToken < 0)
                                {
                                    continue;
                                }
                                if (resourceIndex == 0)
                                {
                                    MessageUtil.ShowMessage("资源已就绪,开始采集...", EnumData.MessageType.Information, this);
                                    resourceIndex++;
                                }
                                device.SetProgressDelegate += HandleRefreshProgess;
                                Action <DirectoryInfo, string> copyAction = device.CopyFilesTo;
                                copyAction.BeginInvoke(deviceRoot, serialNumber, null, null);
                            }
                        }
                    }
                });
                ts.IsBackground = true;
                ts.Start();
            }
            catch
            {
                MessageUtil.ShowMessage("资源识别失败,请重启程序!", EnumData.MessageType.Warning, this);
            }
        }
Beispiel #36
0
 public Driver()
 {
     notifier = DeviceNotifier.OpenDeviceNotifier();
     notifier.OnDeviceNotify += new EventHandler<DeviceNotifyEventArgs>(notifier_OnDeviceNotify);
 }
        //public delegate void Populate();

        public MainWindow()
        {
            InitializeComponent();

            // Set up event handler to wait for a usb device to connect to
            deviceNotifier = DeviceNotifier.OpenDeviceNotifier();
            deviceNotifier.OnDeviceNotify += new EventHandler<DeviceNotifyEventArgs>(deviceNotifier_OnDeviceNotify);

            // try to connect to device (if device was connected previously). Show status in status bar
            try
            {
                traqpaq = new TraqpaqDevice();
                // update status bar
                statusBarItemTraqpaq.Content = "Device connected: " + traqpaq.reqSerialNumber();
            }
            catch (TraqPaqNotConnectedException)
            {
                // Device not found
                traqpaq = null;
                // update status bar
                statusBarItemTraqpaq.Content = "Device not found";
            }

            // Create the pages
            homePage = new HomePage(this);
            settingsPage = new SettingsPage(this);
            uploadPage = new UploadPage(this);

            // assign the pages to the respective tabs
            frameUpload.Navigate(uploadPage);
            frameSettings.Navigate(settingsPage);

            // Go to the welcome page
            frameHome.Navigate(homePage);

            // create the log book page
            logBookPage = new LogBookPage(this);
            frameLogBook.Navigate(logBookPage);
            if (traqpaq != null)
            {
                logBookPage.populateTracks();
            }

            // configure the background worker
            //bw.DoWork += bw_DoWork;
            //bw.WorkerReportsProgress = false;
            // attempt with backgroundworker if connected
            //if (traqpaq != null)
            //{
            //    logBookPage.populateTracks();
            //    //bw.RunWorkerAsync();
            //}


            //// create the log book page as a background task
            //Thread threadCreateRecordPage = new System.Threading.Thread(
            //    new ThreadStart(
            //        delegate()
            //        {
            //            System.Windows.Threading.DispatcherOperation dispatcherOp = frameLogBook.Dispatcher.BeginInvoke(
            //                System.Windows.Threading.DispatcherPriority.Normal,
            //                new Action(delegate()
            //                {
            //                    logBookPage.populateTracks();                                
            //                }));
            //        }));
            //threadCreateRecordPage.SetApartmentState(ApartmentState.STA);
            //threadCreateRecordPage.Start();

            //Action createRecordPage = delegate()
            //{
            //    logBookPage.populateTracks();
            //};
            //Task taskLogPage = Task.Factory.StartNew(createRecordPage);

        }
 public void fDeviceNotify()
 {
     devNotifier = DeviceNotifier.OpenDeviceNotifier();
     devNotifier.OnDeviceNotify += onDevNotify;
 }
Beispiel #39
0
        public void Dispose()
        {
            //close connection
            if (IsOpen)
                Close();

            //stop event notifier
            if (notifier != null)
            {
                notifier.Enabled = false;
                notifier = null;
            }
        }
Beispiel #40
0
 public void fDeviceNotify()
 {
     devNotifier = DeviceNotifier.OpenDeviceNotifier();
     devNotifier.OnDeviceNotify += onDevNotify;
 }
Beispiel #41
0
		public UsbMonitor ()
		{
            switch (HidSharp.PlatformDetector.RunningPlatform())
            {
                case HidSharp.PlatformDetector.Platform.Windows:
                    winUsbDeviceMonitor = new WinUsbDeviceMonitor();
                    winUsbDeviceMonitor.DeviceListChanged += HandleDeviceListChanged;
                    break;
                case HidSharp.PlatformDetector.Platform.Linux:
                    UsbDeviceNotifier = DeviceNotifier.OpenDeviceNotifier();
                    UsbDeviceNotifier.OnDeviceNotify += OnDeviceNotifyEvent;
                    break;
            }
		}