private static void Handle(LoadPriorStudiesException exception, IExceptionHandlingContext context) { if (exception.FindFailed) { context.ShowMessageBox(SR.MessageLoadPriorsFindErrors); return; } var summary = new StringBuilder(); if (!exception.FindResultsComplete) { summary.Append(SR.MessagePriorsIncomplete); } if (ShouldShowLoadErrorMessage(exception)) { if (summary.Length > 0) { summary.AppendLine(); summary.AppendLine("----"); summary.AppendLine(); } summary.Append(Macro.Web.Services.ExceptionTranslator.Translate(exception)); } if (summary.Length > 0) { context.ShowMessageBox(summary.ToString()); } }
private static void Handle(LoadPriorStudiesException exception, IExceptionHandlingContext context) { if (exception.FindFailed) { context.ShowMessageBox(SR.MessageLoadPriorsFindErrors); return; } var summary = new StringBuilder(); if (!exception.FindResultsComplete) summary.Append(SR.MessagePriorsIncomplete); if (ShouldShowLoadErrorMessage(exception)) { if (summary.Length > 0) { summary.AppendLine(); summary.AppendLine("----"); summary.AppendLine(); } summary.Append(ClearCanvas.Web.Services.ExceptionTranslator.Translate(exception)); } if (summary.Length > 0) context.ShowMessageBox(summary.ToString()); }
private static bool ShouldShowLoadErrorMessage(LoadPriorStudiesException exception) { if (exception.IncompleteCount > 0) return true; if (exception.NotFoundCount > 0) return true; if (exception.UnknownFailureCount > 0) return true; return false; }
private static void Handle(LoadPriorStudiesException exception, IExceptionHandlingContext context) { if (exception.FindFailed) { lock (_lock) { if (!_mostRecentQuerySuccessful && (!_everShownPriorsMessage || _successfulQuerySinceLastPriorsMessage)) { context.ShowMessageBox(SR.MessageSearchForPriorsFailed); _everShownPriorsMessage = true; _successfulQuerySinceLastPriorsMessage = false; } } return; } var summary = new StringBuilder(); if (!exception.FindResultsComplete) { lock (_lock) { if (!_mostRecentQuerySuccessful && (!_everShownPriorsMessage || _successfulQuerySinceLastPriorsMessage)) { summary.Append(SR.MessagePriorsIncomplete); _everShownPriorsMessage = true; _successfulQuerySinceLastPriorsMessage = false; } } } if (ShouldShowLoadErrorMessage(exception)) { if (summary.Length > 0) { summary.AppendLine(); summary.AppendLine("----"); summary.AppendLine(); } summary.AppendLine(SR.MessageLoadPriorsErrorPrefix); summary.Append(exception.GetExceptionSummary()); } if (summary.Length > 0) { context.ShowMessageBox(summary.ToString()); } }
private static void Handle(LoadPriorStudiesException exception, IExceptionHandlingContext context) { if (exception.FindFailed) { lock (_lock) { if (!_mostRecentQuerySuccessful && (!_everShownPriorsMessage || _successfulQuerySinceLastPriorsMessage)) { context.ShowMessageBox(SR.MessageSearchForPriorsFailed); _everShownPriorsMessage = true; _successfulQuerySinceLastPriorsMessage = false; } } return; } var summary = new StringBuilder(); if (!exception.FindResultsComplete) { lock (_lock) { if (!_mostRecentQuerySuccessful && (!_everShownPriorsMessage || _successfulQuerySinceLastPriorsMessage)) { summary.Append(SR.MessagePriorsIncomplete); _everShownPriorsMessage = true; _successfulQuerySinceLastPriorsMessage = false; } } } if (ShouldShowLoadErrorMessage(exception)) { if (summary.Length > 0) { summary.AppendLine(); summary.AppendLine("----"); summary.AppendLine(); } summary.AppendLine(SR.MessageLoadPriorsErrorPrefix); summary.Append(exception.GetExceptionSummary()); } if (summary.Length > 0) context.ShowMessageBox(summary.ToString()); }
private static bool ShouldShowLoadErrorMessage(LoadPriorStudiesException exception) { if (exception.IncompleteCount > 0) { return(true); } if (exception.NotFoundCount > 0) { return(true); } if (exception.UnknownFailureCount > 0) { return(true); } return(false); }
private void Test(TestParameters[] tests) { PriorStudyLoaderExceptionPolicy.Reset(); var policy = new PriorStudyLoaderExceptionPolicy(); var context = new Context(); foreach (var test in tests) { //reset. context.ShowedMessageBox = false; if (test.FindFailed || !test.ResultsComplete) { var exception = test.FindFailed ? new LoadPriorStudiesException() : new LoadPriorStudiesException(test.OtherExceptions, test.StudyCount, test.ResultsComplete); PriorStudyLoaderExceptionPolicy.NotifyFailedQuery(); policy.Handle(exception, context); Assert.AreEqual(test.MessageBoxExpected, context.ShowedMessageBox); } else { PriorStudyLoaderExceptionPolicy.NotifySuccessfulQuery(); if (test.OtherExceptions.Count > 0) { var exception = new LoadPriorStudiesException(test.OtherExceptions, test.StudyCount, test.ResultsComplete); policy.Handle(exception, context); } Assert.AreEqual(test.MessageBoxExpected, context.ShowedMessageBox); } } }
private void Test(TestParameters[] tests) { PriorStudyLoaderExceptionPolicy.Reset(); var policy = new PriorStudyLoaderExceptionPolicy(); var context = new Context(); foreach (var test in tests) { //reset. context.ShowedMessageBox = false; if (test.FindFailed || !test.ResultsComplete) { var exception = test.FindFailed ? new LoadPriorStudiesException() : new LoadPriorStudiesException(test.OtherExceptions, test.StudyCount, test.ResultsComplete); PriorStudyLoaderExceptionPolicy.NotifyFailedQuery(); policy.Handle(exception, context); Assert.AreEqual(test.MessageBoxExpected, context.ShowedMessageBox); } else { PriorStudyLoaderExceptionPolicy.NotifySuccessfulQuery(); if (test.OtherExceptions.Count > 0) { var exception = new LoadPriorStudiesException(test.OtherExceptions, test.StudyCount, test.ResultsComplete); policy.Handle(exception, context); } Assert.AreEqual(test.MessageBoxExpected, context.ShowedMessageBox); } } }