public static bool WriteEventLog(SummitSystem localSummit, string successLogMessage, string successLogMessageSubType, string unsuccessfulMessageBoxMessage, ILog _log) { int counter = 5; APIReturnInfo bufferReturnInfo; try { do { bufferReturnInfo = localSummit.LogCustomEvent(DateTime.Now, DateTime.Now, successLogMessage, successLogMessageSubType); counter--; } while (bufferReturnInfo.RejectCode != 0 && counter > 0); if (counter == 0) { ShowMessageBox.Show(unsuccessfulMessageBoxMessage, "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); return(false); } } catch (Exception e) { _log.Error(e); ShowMessageBox.Show("Error calling summit system while logging event.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } return(true); }
private void LogLeadIntegrityAsEvent(SummitSystem theSummit, string pairs, string result) { APIReturnInfo bufferReturnInfo; try { bufferReturnInfo = theSummit.LogCustomEvent(DateTime.Now, DateTime.Now, "Lead Integrity", pairs + " --- " + result); if (bufferReturnInfo.RejectCode != 0) { ShowMessageBox.Show("Could not log event. If you would like all lead integrity results logged, please try again.", "Error Logging"); _log.Warn("Could not log lead integrity event. Reject code: " + bufferReturnInfo.RejectCode + ". Reject description: " + bufferReturnInfo.Descriptor); } } catch (Exception e) { ShowMessageBox.Show("Could not log event. If you would like all lead integrity results logged, please try again.", "Error Logging"); _log.Error(e); } }
public void RunMontageButtonClick() { IsMontageEnabled = false; ProgressVisibility = Visibility.Visible; TimeSpan time = TimeSpan.FromSeconds(timeLeftForMontage); //here backslash is must to tell that colon is //not the part of format, it just a character that we want in output string str = time.ToString(@"hh\:mm\:ss"); ProgressText = str + " time left"; try { theSummitLeft.LogCustomEvent(DateTime.Now, DateTime.Now, "Montage Sequence Begin", DateTime.Now.ToString("MM_dd_yyyy hh:mm:ss tt")); } catch (Exception e) { _log.Error(e); MessageBox.Show("Could not log start event. Please try montage again", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } //Start default left thread leftThread = new Thread(new ThreadStart(MontageLeftThreadCode)); leftThread.IsBackground = true; leftThread.Start(); //Start right thread if bilateral if (isBilateral) { try { theSummitRight.LogCustomEvent(DateTime.Now, DateTime.Now, "Montage Sequence Begin", DateTime.Now.ToString("MM_dd_yyyy hh:mm:ss tt")); } catch (Exception e) { _log.Error(e); MessageBox.Show("Could not log start event. Please try montage again", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } rightThread = new Thread(new ThreadStart(MontageRightThreadCode)); rightThread.IsBackground = true; rightThread.Start(); } else { rightFinished = true; } }
/// <summary> /// Report button click that reports data to Event log in medtronic json file /// </summary> public void ReportClick() { //this adds conditions to string string conditions = ""; foreach (ConditionCheckBoxClass itemToAddIfChecked in ConditionList) { if (itemToAddIfChecked.IsSelected) { conditions += itemToAddIfChecked.Condition + ", "; } } //This adds medications to string string medications = ""; foreach (MedicationCheckBoxClass itemToCheckIfChecked in MedicationList) { if (itemToCheckIfChecked.IsSelected) { medications += itemToCheckIfChecked.Medication + ", "; } } //This adds both medications and conditions to event log //Make sure there is a medication checked before writing. No need to write if nothing there. if (!string.IsNullOrEmpty(medications)) { //add time to medications only if available if (MedicationTime != null) { medications += " --- " + MedicationTime.ToString(); medications = medications.Replace('/', '_'); } APIReturnInfo result; //Adds data to event log if (theSummitLeft != null) { if (!theSummitLeft.IsDisposed) { try { result = theSummitLeft.LogCustomEvent(DateTime.Now, DateTime.Now, MEDICATION, medications); CheckRejectCode(result, "Logging Medications"); } catch (Exception e) { _log.Error(e); MessageBox.Show("Error Logging Medications", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } } if (theSummitRight != null) { if (!theSummitRight.IsDisposed) { try { result = theSummitRight.LogCustomEvent(DateTime.Now, DateTime.Now, MEDICATION, medications); CheckRejectCode(result, "Logging Medications"); } catch (Exception e) { _log.Error(e); MessageBox.Show("Error Logging Medications", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } } } //Make sure there is data for conditions checked //If no data, then nothing to write if (!string.IsNullOrEmpty(conditions)) { //Adds data to event log APIReturnInfo result; if (theSummitLeft != null) { if (!theSummitLeft.IsDisposed) { try { result = theSummitLeft.LogCustomEvent(DateTime.Now, DateTime.Now, CONDITIONS, conditions); CheckRejectCode(result, "Logging Conditions"); } catch (Exception e) { _log.Error(e); MessageBox.Show("Error Logging conditions", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } } if (theSummitRight != null) { if (!theSummitRight.IsDisposed) { try { result = theSummitRight.LogCustomEvent(DateTime.Now, DateTime.Now, CONDITIONS, conditions); CheckRejectCode(result, "Logging Conditions"); } catch (Exception e) { _log.Error(e); MessageBox.Show("Error Logging conditions", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } } } //Make sure there is data inside the additional comments box //If no data, then nothing to write if (!string.IsNullOrEmpty(AdditionalCommentsForReportBox)) { //Adds data to event log APIReturnInfo result; if (theSummitLeft != null) { if (!theSummitLeft.IsDisposed) { try { result = theSummitLeft.LogCustomEvent(DateTime.Now, DateTime.Now, EXTRA_COMMENTS, AdditionalCommentsForReportBox); CheckRejectCode(result, "Logging additional comments"); } catch (Exception e) { _log.Error(e); MessageBox.Show("Error Logging additional Comments", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } } if (theSummitRight != null) { if (!theSummitRight.IsDisposed) { try { result = theSummitRight.LogCustomEvent(DateTime.Now, DateTime.Now, EXTRA_COMMENTS, AdditionalCommentsForReportBox); CheckRejectCode(result, "Logging additional comments"); } catch (Exception e) { _log.Error(e); MessageBox.Show("Error Logging additional Comments", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } } } TryClose(); }