private void button2_Click(object sender, EventArgs e) { resetFlag = true; this.StatusBox.Text = ""; this.StatusBox.Text = "Reboot Command Issued"; listBox1.Items.Clear(); string serial; android.UpdateDeviceList(); if (android.HasConnectedDevices) { for (var i = 0; i < android.ConnectedDevices.Count; i++) { serial = android.ConnectedDevices[i]; device = android.GetConnectedDevice(serial); device.Reboot(); } } else { this.DeviceList.Text = "Error - No Devices Connected"; } android.Dispose(); }
private void timer2_Tick(object sender, EventArgs e) { string serial; if (android.HasConnectedDevices) { for (var i = 0; i < android.ConnectedDevices.Count; i++) { serial = android.ConnectedDevices[i]; device = android.GetConnectedDevice(serial); try { CheckRoutine(device, i); } catch { device.Reboot(); continue; } } } else { this.DeviceList.Text = "Error - No Devices Connected"; } //code that runs every x }