public void OpenStudy() { try { int numberOfSelectedStudies = Context.SelectedStudies.Count; if (Context.SelectedStudies.Count == 0) { return; } if (!PermissionsHelper.IsInRole(ImageViewer.AuthorityTokens.Study.Open)) { Context.DesktopWindow.ShowMessageBox(SR.MessageOpenStudyPermissionDenied, MessageBoxActions.Ok); return; } int numberOfLoadableStudies = GetNumberOfLoadableStudies(); if (numberOfLoadableStudies != numberOfSelectedStudies) { int numberOfNonLoadableStudies = numberOfSelectedStudies - numberOfLoadableStudies; string message; if (numberOfSelectedStudies == 1) { message = SR.MessageCannotOpenNonStreamingStudy; } else { if (numberOfNonLoadableStudies == 1) { message = SR.MessageOneNonStreamingStudyCannotBeOpened; } else { message = String.Format(SR.MessageFormatXNonStreamingStudiesCannotBeOpened, numberOfNonLoadableStudies); } } Context.DesktopWindow.ShowMessageBox(message, MessageBoxActions.Ok); return; } var helper = new OpenStudyHelper { WindowBehaviour = ViewerLaunchSettings.WindowBehaviour, AllowEmptyViewer = ViewerLaunchSettings.AllowEmptyViewer }; foreach (var study in Context.SelectedStudies) { helper.AddStudy(study.StudyInstanceUid, study.Server); } helper.Title = ImageViewerComponent.CreateTitle(GetSelectedPatients()); helper.OpenStudies(); } catch (Exception e) { ExceptionHandler.Report(e, Context.DesktopWindow); } }
public void OpenStudies() { try { int numberOfSelectedStudies = Context.Component.Selection.Items.Length; if (numberOfSelectedStudies == 0) { return; } var helper = new OpenStudyHelper { WindowBehaviour = ViewerLaunchSettings.WindowBehaviour, AllowEmptyViewer = ViewerLaunchSettings.AllowEmptyViewer }; foreach (StudyItem study in Context.Component.Selection.Items) { helper.AddStudy(study.StudyInstanceUid, study.Server); } helper.Title = ImageViewerComponent.CreateTitle(GetSelectedPatients()); helper.OpenStudies(); } catch (Exception e) { ExceptionHandler.Report(e, Context.DesktopWindow); } }
public void OpenStudy() { try { int numberOfSelectedStudies = Context.SelectedStudies.Count; if (Context.SelectedStudies.Count == 0) { return; } if (!PermissionsHelper.IsInRole(ImageViewer.AuthorityTokens.Study.Open)) { Context.DesktopWindow.ShowMessageBox(SR.MessageOpenStudyPermissionDenied, MessageBoxActions.Ok); return; } int numberOfLoadableStudies = GetNumberOfLoadableStudies(); if (numberOfLoadableStudies != numberOfSelectedStudies) { int numberOfNonLoadableStudies = numberOfSelectedStudies - numberOfLoadableStudies; string message; if (numberOfSelectedStudies == 1) { message = SR.MessageCannotOpenNonStreamingStudy; } else { if (numberOfNonLoadableStudies == 1) { message = SR.MessageOneNonStreamingStudyCannotBeOpened; } else { message = String.Format(SR.MessageFormatXNonStreamingStudiesCannotBeOpened, numberOfNonLoadableStudies); } } Context.DesktopWindow.ShowMessageBox(message, MessageBoxActions.Ok); return; } if (Context.SelectedServers.Count == 1 && Context.SelectedServers[0].IsLocal) { // TODO (CR Phoenix5 - Medium): Not so sure now about excluding failed items. // #10746: Workstation: the user must be warned when opening studies that are being processed // This implementation does not cover all the possible cases of when a study might be modified. // For example: if a study is being retrieved, WQI failed and deleted, the study is technically // not complete and user should be warned. The risk of such cases are mitigated by the fact the // user is warned about the failed WQI. This implementation is only meant to warn user if the // study is "being" or "about to" be modified before opening the study. try { Platform.Log(LogLevel.Debug, "Querying for a StudyUpdate work items that are in progress for the studies that are being opened."); var isStudyBeingProcessed = Context.SelectedStudies.Any(study => { var request = new WorkItemQueryRequest { StudyInstanceUid = study.StudyInstanceUid }; IEnumerable <WorkItemData> workItems = null; Platform.GetService <IWorkItemService>(s => workItems = s.Query(request).Items); return(workItems.Any(IsNonTerminalStudyUpdateItem)); }); var message = this.Context.SelectedStudies.Count > 1 ? SR.MessageLoadStudiesBeingProcessed : SR.MessageLoadStudyBeingProcessed; if (isStudyBeingProcessed && DialogBoxAction.No == Context.DesktopWindow.ShowMessageBox(message, MessageBoxActions.YesNo)) { return; } } catch (Exception e) { Platform.Log(LogLevel.Debug, e); } } var helper = new OpenStudyHelper { WindowBehaviour = ViewerLaunchSettings.WindowBehaviour, AllowEmptyViewer = ViewerLaunchSettings.AllowEmptyViewer, //The user has elected to ignore "in use" studies. StudyLoaderOptions = new StudyLoaderOptions(true) }; foreach (var study in Context.SelectedStudies) { helper.AddStudy(study.StudyInstanceUid, study.Server); } helper.Title = ImageViewerComponent.CreateTitle(GetSelectedPatients()); helper.OpenStudies(); } catch (Exception e) { ExceptionHandler.Report(e, Context.DesktopWindow); } }