private void chronopicConnectionSequenceInit(int numCPs) { connectNum = 1; if (numCPs == 1) { connectAnother = false; crpDoing = chronopicRegister.ConnectedOfType(ChronopicRegisterPort.Types.CONTACTS); //store a boolean in order to read info faster cp2016.StoredCanCaptureContacts = true; } else { //2 connectAnother = true; //will get two crps or null crpMultiList = chronopicRegister.GetTwoContactsConnected(); //store a boolean in order to read info faster if (crpMultiList == null) { return; } crpDoing = crpMultiList[0]; cp2016.StoredCanCaptureContacts = (crpMultiList.Count == 2); } connectingSequence = connectingSequenceEnum.START; chronopicConnectionSequenceDo(); }
private void chronopicConnectionSequenceDo() { //0 print sequence LogB.Information("SEQUENCE: " + connectingSequence.ToString()); //1 check if need to end sequence or go to second chronopic if (connectingSequence == connectingSequenceEnum.END) { if (connectAnother) { System.Threading.Thread.Sleep(250); crpDoing = crpMultiList[1]; connectingSequence = connectingSequenceEnum.START; connectAnother = false; connectNum = 2; chronopicConnectionSequenceDo(); return; } else { button_activate_chronopics.Show(); on_button_execute_test_acceptedPre(); return; } } //2 update sequence if (connectingSequence == connectingSequenceEnum.START) { if (cp2016.IsLastConnectedReal(crpDoing, connectNum)) { connectingSequence = connectingSequenceEnum.FIRMWAREIFNEEDED; } else { connectingSequence = connectingSequenceEnum.CONNECTINGREAL; } chronopicConnectionSequenceDo(); } else if (connectingSequence == connectingSequenceEnum.CONNECTINGREAL) { callConnectContactsReal(crpDoing, connectNum); //this opens a thread and when end goes to chronopicConnectionSequenceDo again } else if (connectingSequence == connectingSequenceEnum.FIRMWAREIFNEEDED) { changeMultitestFirmwareIfNeeded(connectNum); //this will call chronopicConnectionSequenceDo if success } }
private void changeMultitestFirmwareIfNeeded(int cpCount) { //change multitest stuff threshold.UpdateAtDatabaseIfNeeded(getMenuItemMode()); if (threshold.ShouldUpdateChronopicFirmware(cpCount)) { bool ok = cp2016.ChangeMultitestFirmwarePre(threshold.GetT, cpCount); if (ok) { threshold.ChronopicFirmwareUpdated(cpCount); } } connectingSequence = connectingSequenceEnum.END; chronopicConnectionSequenceDo(); }
private void on_connection_contacts_real_done(object o, EventArgs args) { cp2016.FakeButtonContactsRealDone.Clicked -= new EventHandler(on_connection_contacts_real_done); if (cp2016.SuccededConnectContactsRealThread) { LogB.Information("Success at Connecting real! (main GUI)"); connectingSequence = connectingSequenceEnum.FIRMWAREIFNEEDED; chronopicConnectionSequenceDo(); } else { LogB.Warning("Failure at Connecting real! (main GUI)"); } }
private void changeMultitestFirmwareIfNeeded(int cpCount) { //change multitest stuff threshold.UpdateAtDatabaseIfNeeded(current_menuitem_mode); if (threshold.ShouldUpdateChronopicFirmware(cpCount)) { bool ok = cp2016.ChangeMultitestFirmwarePre(threshold.GetT, cpCount); if (ok) { threshold.ChronopicFirmwareUpdated(cpCount); label_threshold.Text += " (" + Catalog.GetString("Applied") + ")"; } else { label_threshold.Text += " (" + Catalog.GetString("Failed") + ")"; } } connectingSequence = connectingSequenceEnum.END; chronopicConnectionSequenceDo(); }