private static IStudyViewer[] CheckStudiesFound(IStudyViewer[] viewers, ViewStudiesOptions options) { if (!viewers.Any() && options.Interactive) { options.DesktopWindow.ShowMessageBox(SR.MessageNoStudiesFound, MessageBoxActions.Ok); } return(viewers); }
/// <summary> /// Opens all studies associated with the specified order. /// </summary> /// <param name="orderRef">Reference to the order for which to open images.</param> /// <param name="options"> </param> /// <returns>One or more instances of a study viewer.</returns> public static IStudyViewer[] ViewStudies(EntityRef orderRef, ViewStudiesOptions options) { CheckSupported(); CheckAccess(); var studyUids = GetStudiesForOrder(orderRef); var viewers = _viewer.ViewStudies(new ViewStudiesArgs { StudyInstanceUids = studyUids.ToArray(), InstancePerStudy = false }); return(CheckStudiesFound(viewers, options)); }
/// <summary> /// Opens studies associated with the specified order and procedures. /// </summary> /// <param name="orderRef">Reference to the order for which to open studies.</param> /// <param name="procedureRefs">Reference to the specific procedures for which to open studies - all procedures must belong to the parent order.</param> /// <param name="options"> </param> /// <returns>One or more instances of a study viewer.</returns> public static IStudyViewer[] ViewStudies(EntityRef orderRef, IEnumerable <EntityRef> procedureRefs, ViewStudiesOptions options) { CheckSupported(); CheckAccess(); var studyUids = GetStudiesForProcedures(orderRef, procedureRefs.ToList()); var viewers = _viewer.ViewStudies(new ViewStudiesArgs { StudyInstanceUids = studyUids.ToArray(), InstancePerStudy = true }); if (!viewers.Any() && options.FallbackToOrder) { // check if there might be other studies var allStudyUidsForOrder = GetStudiesForOrder(orderRef); if (allStudyUidsForOrder.Count > studyUids.Count) { // there are other studies associated with this order that could be opened // if we're in interactive mode, confirm with the user that we should do this if (options.Interactive && !Confirm(SR.MessageConfirmOpenStudiesForRelatedProcedures, options.DesktopWindow)) { return(new IStudyViewer[0]); } viewers = _viewer.ViewStudies(new ViewStudiesArgs { StudyInstanceUids = allStudyUidsForOrder.ToArray(), InstancePerStudy = false }); return(CheckStudiesFound(viewers, options)); } } return(CheckStudiesFound(viewers, options)); }