/// <summary> /// Pings the device to make sure it's alive and responding /// </summary> private static void PingDevice() { if (args.verbose) { Console.WriteLine("Pinging device..."); } zeitgeber.Ping(); if (args.verbose) { Console.WriteLine("Ping Success"); } }
private void timerUpdate_Tick(object sender, EventArgs e) { // Automatic connection/disconnection if (zeitgeber.isConnected) { try { zeitgeber.Ping(); UpdateDiagnostics(); } catch (Exception ex) { zeitgeber.isConnected = false; lblConnected.Text = "Not Connected"; listViewInfo.Enabled = false; groupBox1.Enabled = false; } } else { try { zeitgeber.Connect(); zeitgeber.Ping(); OnDeviceConnect(); lblConnected.Text = "Connected"; listViewInfo.Enabled = true; groupBox1.Enabled = true; } catch (Exception ex) { zeitgeber.isConnected = false; // Couldn't connect } } }