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); } }
/// <summary> /// Opens the selected search result in a new workspace. /// </summary> public void OpenSelectedSearchResult() { if (_selectedSearchResult != null) { OpenStudyHelper.OpenStudies("DICOM_LOCAL", new string[] { _selectedSearchResult.StudyItem.StudyInstanceUID }, WindowBehaviour.Auto); } }
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); } }
/// <summary> /// Activate the tool action. /// </summary> /// <remarks> /// This function detects secondary monitor if availible then open the study in separate window and show it in the secondary monitor /// </remarks> public void Activate() { //Get Current Selected Study StudyItem item = this.Context.SelectedStudy; if (item != null) { string[] studyInstanceUids = { "" + item.StudyInstanceUID + "" }; //Create an OpenStudyArgs to be used later to open the study //Note that I used WindowBehaviour.Separate to open the study in a separate Form OpenStudyArgs args = new OpenStudyArgs(studyInstanceUids, item.Server, item.StudyLoaderName, WindowBehaviour.Separate); //Open the selected study OpenStudyHelper.OpenStudies(args); //Move it to secondary screen if only there are more than one screen if (System.Windows.Forms.Screen.AllScreens.Length > 1) { //Get All System Screens System.Windows.Forms.Screen[] Screens = System.Windows.Forms.Screen.AllScreens; //Create a variable to hold the secondary screen variable and assign it to null System.Windows.Forms.Screen SecScreenVar; SecScreenVar = null; //assign the SecScreenVar to the secondary screen foreach (System.Windows.Forms.Screen SecScreen in Screens) { //if its the secondary assign it if (SecScreen.Primary == false) { SecScreenVar = SecScreen; } } //If a secondary screen found if (SecScreenVar != null) { //Get the newly opened study window Form currentForm = Form.ActiveForm; //Set its start position to manual currentForm.StartPosition = FormStartPosition.Manual; //Set its location to the secondary screen currentForm.Location = SecScreenVar.WorkingArea.Location; //Set its size to the secondary screen size currentForm.Size = new Size(SecScreenVar.WorkingArea.Width, SecScreenVar.WorkingArea.Height); //Reshow it in its new location currentForm.Hide(); currentForm.Show(); } } } }
public OpenViewerOutput OpenViewer(OpenViewerInput input) { Platform.CheckForNullReference(input, "input"); Platform.CheckMemberIsSet(input.StudyInstanceUids, "StudyInstanceUids"); if (input.StudyInstanceUids.Length == 0) { return(new OpenViewerOutput()); } var helper = new OpenStudyHelper(); foreach (var studyInstanceUid in input.StudyInstanceUids) { helper.AddStudy(studyInstanceUid, null, "DICOM_LOCAL"); } var id = Interlocked.Increment(ref _viewerId); helper.Title = "imageviewer " + id; var viewer = helper.OpenStudies(); var workspace = Application.ActiveDesktopWindow.Workspaces .First(w => ImageViewerComponent.GetAsImageViewer(w) == viewer); lock (_viewers) { _viewers.Add(id, viewer); } workspace.Closed += (sender, e) => { lock (_viewers) { _viewers.Remove(id); } }; return(new OpenViewerOutput { ViewerId = id }); }
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); } }