コード例 #1
0
ファイル: Form1.cs プロジェクト: bangush/server-1
        private OpenStudyInfo[] GetStudiesToOpen(ICollection <OpenStudyInfo> studiesToOpen)
        {
            OpenStudyInfo[] returnInfo = new OpenStudyInfo[studiesToOpen.Count];
            int             i          = 0;

            foreach (OpenStudyInfo info in studiesToOpen)
            {
                returnInfo[i++] = info;
            }

            return(returnInfo);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: bangush/server-1
        private void OnOpenStudy(object sender, EventArgs e)
        {
            StudyItem study = GetSelectedStudy();

            if (study == null)
            {
                return;
            }

            using (AutomationClient client = new AutomationClient())
            {
                try
                {
                    OpenStudiesRequest   request       = new OpenStudiesRequest();
                    List <OpenStudyInfo> studiesToOpen = new List <OpenStudyInfo>();
                    foreach (StudyItem s in GetSelectedStudies())
                    {
                        OpenStudyInfo info = new OpenStudyInfo();
                        info.StudyInstanceUid = s.StudyInstanceUid;
                        info.SourceAETitle    = s.RetrieveAETitle;
                        studiesToOpen.Add(info);
                    }

                    request.StudiesToOpen         = GetStudiesToOpen(studiesToOpen);
                    request.ActivateIfAlreadyOpen = _activateIfOpen.Checked;

                    OpenStudiesResult result = client.OpenStudies(request);
                    if (result.Viewer != null)
                    {
                        bool shouldExist = study.HasViewers && _activateIfOpen.Checked;
                        bool exists      = study.HasViewer(result.Viewer.Identifier);
                        if (shouldExist && !exists)
                        {
                            study.ClearViewers();
                        }

                        if (!exists)
                        {
                            study.AddViewer(result.Viewer.Identifier);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
コード例 #3
0
        private void btnRetreive_Click(object sender, EventArgs e)
        {
            if (DataGridView1.SelectedRows == null)
            {
                MessageBox.Show(
                    "Please Select a Study to Retrive It.",
                    "Information- " + Application.ProductName,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information
                    );
                return;
            }

            if (DataGridView1.SelectedCells[1].Value != null)
            {
                modMain.PatName = DataGridView1.SelectedCells[1].Value.ToString();
            }
            if (DataGridView1.SelectedCells[3].Value != null)
            {
                modMain.PatDOB = DataGridView1.SelectedCells[3].Value.ToString();
            }
            if (DataGridView1.SelectedCells[2].Value != null)
            {
                modMain.PatSex = DataGridView1.SelectedCells[2].Value.ToString();
            }
            if (DataGridView1.SelectedCells[5].Value != null)
            {
                modMain.StudyID = DataGridView1.SelectedCells[5].Value.ToString();
            }
            if (DataGridView1.SelectedCells[6].Value != null)
            {
                modMain.StudyDate = DataGridView1.SelectedCells[6].Value.ToString();
            }
            if (DataGridView1.SelectedCells[7].Value != null)
            {
                modMain.StudyTime = DataGridView1.SelectedCells[7].Value.ToString();
            }

            //_MoverSettings = LoadSettingfromXmlFile();

            BasicHttpBinding binding             = new BasicHttpBinding();
            EndpointAddress  endpoint            = new EndpointAddress(ConfigurationManager.AppSettings["AutomationServiceUrl"]);
            ViewerAutomationServiceClient client = new ViewerAutomationServiceClient(binding, endpoint);

            try
            {
                client.Open();
                OpenStudiesRequest request = new OpenStudiesRequest();
                request.ActivateIfAlreadyOpen = true;
                List <OpenStudyInfo> studiesToOpen = new List <OpenStudyInfo>();
                OpenStudyInfo        studyInfo     = new OpenStudyInfo(modMain.StudyID);
                studiesToOpen.Add(studyInfo);
                request.StudiesToOpen = studiesToOpen;
                client.OpenStudies(request);
                client.Close();
            }
            catch (Exception x)
            {
                client.Abort();
                MessageBox.Show(x.Message);
            }
            //this.Close();
        }