private void GetSubjectInfo(SummitSystem theSummit) { if (theSummit == null || theSummit.IsDisposed) { _log.Warn("Summit null or disposed when trying to get subject id"); return; } //This loops until it gets the subjectInfo. Sometimes it comes back null so need to be sure I actually get it. _log.Info("Getting Subject info..."); SubjectInfo subjectInfo = null; int counter = 10; while (subjectInfo == null && counter > 0) { try { APIReturnInfo bufferReturnInfo; bufferReturnInfo = theSummit.FlashReadSubjectInfo(out subjectInfo); patientID = subjectInfo.ID; leadLocationOne = subjectInfo.LeadTargets[0].ToString(); leadLocationTwo = subjectInfo.LeadTargets[2].ToString(); _log.Info("Patient ID: " + patientID); _log.Info("Lead Location 1: " + leadLocationOne); _log.Info("Lead Location 2: " + leadLocationTwo); } catch (Exception e) { //do nothing. Just keep looping until we actually get the patient id _log.Error(e); } if (counter < 10) { Thread.Sleep(300); } _log.Info("Attempt to get subject info: " + (10 - counter)); counter--; } if (subjectInfo == null && counter == 0) { _log.Warn("Could not get subject info from medtronic"); } }