public GetViewerInfoResult GetViewerInfo(GetViewerInfoRequest request) { if (request == null) { string message = "The get viewer info request cannot be null."; Platform.Log(LogLevel.Debug, message); throw new FaultException(message); } if (request.Viewer == null || request.Viewer.Identifier.Equals(Guid.Empty)) { string message = "A valid viewer id must be specified."; Platform.Log(LogLevel.Debug, message); throw new FaultException(message); } IImageViewer viewer = ViewerAutomationTool.GetViewer(request.Viewer.Identifier); if (viewer == null) { string message = String.Format("The specified viewer ({0}) was not found, " + "likely because it has already been closed by the user.", request.Viewer.Identifier); Platform.Log(LogLevel.Debug, message); throw new FaultException <ViewerNotFoundFault>(new ViewerNotFoundFault(message), _viewerNotFoundReason); } GetViewerInfoResult result = new GetViewerInfoResult(); result.AdditionalStudyInstanceUids = GetAdditionalStudyInstanceUids(viewer); return(result); }
public GetViewerInfoResult GetViewerInfo(GetViewerInfoRequest request) { // Done for reasons of speed, as well as the fact that a call to the service from the same thread // that the service is hosted on (the main UI thread) will cause a deadlock. if (SynchronizationContext.Current == ViewerAutomationServiceHostTool.HostSynchronizationContext) { return(new ViewerAutomation().GetViewerInfo(request)); } else { using (ViewerAutomationServiceClient client = new ViewerAutomationServiceClient()) { return(client.GetViewerInfo(request)); } } }
private void OnGetSelectedInfo(object sender, EventArgs e) { StudyItem study = GetSelectedStudy(); if (study == null) { MessageBox.Show("Select a single study item in the list."); return; } Guid?selectedViewer = GetSelectedViewer(); if (selectedViewer == null) { MessageBox.Show("An active viewer must be selected."); return; } using (AutomationClient client = new AutomationClient()) { try { GetViewerInfoRequest request = new GetViewerInfoRequest(); request.Viewer = new Viewer(); request.Viewer.Identifier = GetIdentifier(selectedViewer.Value); GetViewerInfoResult result = client.GetViewerInfo(request); StringBuilder builder = new StringBuilder(); builder.AppendLine("Additional studies:"); foreach (string additionalStudyUid in result.AdditionalStudyInstanceUids) { builder.AppendLine(additionalStudyUid); } MessageBox.Show(builder.ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public GetViewerInfoResult GetViewerInfo(GetViewerInfoRequest request) { return(Execute(a => a.GetViewerInfo(request))); }