예제 #1
0
파일: Form1.cs 프로젝트: bangush/server-1
 private void OnDicomExplorerExecuteQuery(object sender, EventArgs e)
 {
     using (DicomExplorerAutomationClient client = new DicomExplorerAutomationClient())
     {
         try
         {
             if (_dicomExplorerQueryLocal.Checked)
             {
                 SearchLocalStudiesRequest request = new SearchLocalStudiesRequest();
                 request.SearchCriteria                 = new DicomExplorerSearchCriteria();
                 request.SearchCriteria.PatientId       = _patientId.Text;
                 request.SearchCriteria.AccessionNumber = _accession.Text;
                 client.SearchLocalStudies(request);
             }
             else
             {
                 SearchRemoteStudiesRequest request = new SearchRemoteStudiesRequest();
                 request.SearchCriteria                 = new DicomExplorerSearchCriteria();
                 request.SearchCriteria.PatientId       = _patientId.Text;
                 request.SearchCriteria.AccessionNumber = _accession.Text;
                 request.AETitle = _dicomExplorerRemoteAE.Text;
                 client.SearchRemoteStudies(request);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
        public SearchRemoteStudiesResult SearchRemoteStudies(SearchRemoteStudiesRequest request)
        {
            if (request == null)
            {
                throw new FaultException("The request cannot be null.");
            }

            DicomExplorerComponent explorerComponent = GetDicomExplorer();

            if (request.SearchCriteria == null)
            {
                request.SearchCriteria = new DicomExplorerSearchCriteria();
            }

            string aeTitle = (request.AETitle ?? "").Trim();

            if (String.IsNullOrEmpty(aeTitle))
            {
                explorerComponent.SelectPriorsServers();
            }
            else
            {
                var server = explorerComponent.ServerTreeComponent.ServerTree.RootServerGroup
                             .GetAllServers().OfType <IServerTreeDicomServer>().FirstOrDefault(s => s.AETitle == aeTitle);
                if (server == null)
                {
                    throw new FaultException <ServerNotFoundFault>(new ServerNotFoundFault(), String.Format("Server '{0}' not found.", aeTitle));
                }

                explorerComponent.ServerTreeComponent.SetSelection(server);
            }

            SynchronizationContext.Current.Post(
                ignore => explorerComponent.StudyBrowserComponent.Search(request.SearchCriteria.ToIdentifier(true)), null);

            return(new SearchRemoteStudiesResult());
        }