Beispiel #1
0
        private void Listener_NewUsbEvent(UsbEvent e)
        {
            AddDeviceFromEvent(e);
            ActionEvents(e);

            Invoke(new Action(() => RefreshUsbDevices()));
            Invoke(new Action(() => RefreshActions()));
        }
Beispiel #2
0
        public static ManagementEventWatcher RegisterRemoveEvent(UsbEvent RemoveEvent)
        {
            var removeQuery   = new WqlEventQuery("SELECT * FROM Win32_DeviceChangeEvent WHERE EventType = 3");
            var removeWatcher = new ManagementEventWatcher(removeQuery);

            removeWatcher.EventArrived += delegate(object sender, EventArrivedEventArgs e) {
                // string driveName = e.NewEvent.Properties["DriveName"].Value.ToString();
                Action action = delegate {
                    RemoveEvent();
                };
                Application.Current.Dispatcher.BeginInvoke(action);
            };
            removeWatcher.Start();
            return(removeWatcher);
        }
Beispiel #3
0
 private void AddDeviceFromEvent(UsbEvent e)
 {
     DeviceManager.AddDeviceFromEvent(e);
 }
Beispiel #4
0
 private async void ActionEvents(UsbEvent e)
 {
     await ActionManagerExecutor.ExecActions(e);
 }