/// <summary> /// Display a toast /// </summary> /// <param name="sender"> The sender </param> /// <param name="e"> Event to recognize devices </param> private static void OnDeviceDisconnected(object sender, DeviceDataEventArgs e) { ThreadPool.SetMaxThreads(GetConnectedDevices().Count, GetConnectedDevices().Count); LoggingManager.DeleteEntry(e.Device.Serial); Console.WriteLine($"The device {e.Device} has disconnected from this PC"); RecController.StopScrRec(e.Device); if (MarkerList.ActiveDeviceData is not null && MarkerList.ActiveDeviceData.Serial.Equals(e.Device.Serial)) { MarkerList.ActiveDeviceData = null; } }
/// <summary> /// Kill the AdbServer /// </summary> /// <returns> true for success and false for failure </returns> public static bool KillAdbServer() { try { foreach (var dev in GetConnectedDevices()) { StopLogging(dev); RecController.StopScrRec(dev); } MarkerList.ActiveDeviceData = null; Client.KillAdb(); } catch (Exception) { return(false); } return(true); }