Monitor, um alle 10 sec zu prüfen ob ein Gerät angeschlossen oder getrennt wurde.

ADB Fastboot
// Top of ur .cs file
...
using AndroidCtrl;
 
using AndroidCtrl.ADB.Binary;
//or
using AndroidCtrl.ADB.Socket;
...
 
// Assign the callbacks
ADB.Monitor.Added += Added;
ADB.Monitor.Changed += Changed;
ADB.Monitor.Removed += Removed;
 
// Start the monitor
ADB.Monitor.Start()
 
// Stop the ADB monitor
ADB.Monitor.Stop();
 
// Stop the ADB monitor and release all event handler
ADB.Monitor.Stop(true);
 

Callback für ADB/Fastboot
// Top of ur .cs file
using System.Linq;
...
using AndroidCtrl;
...
 
// Callback for both (ADB/Fastboot)
private void Added(object sender, MonitorAddedEventArgs e)
{
     App.Current.Dispatcher.Invoke((Action)delegate
     {
          // Do what u want with the "IDeviceInfo[] e.Devices.ToArray()"
          // The "sender" is a "string" and returns "adb" or "fastboot"
     });
}
 
private void Changed(object sender, MonitorChangedEventArgs e)
{
     App.Current.Dispatcher.Invoke((Action)delegate
     {
          // Do what u want with the "IDeviceInfo[] e.Devices.ToArray()"
          // The "sender" is a "string" and returns "adb" or "fastboot"
     });
}
 
private void Removed(object sender, MonitorRemovedEventArgs e)
{
     App.Current.Dispatcher.Invoke((Action)delegate
     {
          // Do what u want with the "IDeviceInfo[] e.Devices.ToArray()"
          // The "sender" is a "string" and returns "adb" or "fastboot"
     });
}