/// <summary> /// Checks the time the last package arrived and tries to reconnect if time exceeds 3 seconds /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void Reconnect(Object sender, EventArgs e) { form1.EnableTimer(false); TimeSpan time; time = DateTime.Now - dcTime; if (time.Seconds >= 4) { UpdateStatus(this, new UpdateStatusEvent("Verbindung unterbrochen, suche Sensor!")); //If reconnect successful if (serial.Reconnect()) { ////read new packageNumber //firstPackage = true; ////Start new File //if (save) //{ // EndSave(); // serial.StartSensor(); // StartRecording(saveDialog.patientName, DateTime.Today, 'M'); //} //else //processData = new ProcessData(54); serial.StartSensor(); UpdateStatus(this, new UpdateStatusEvent("Verbindung wiederhergestellt!")); } } form1.EnableTimer(true); }