Exemple #1
0
 private void ClearAllViewers()
 {
     foreach (DataGridViewRow row in _studyGrid.Rows)
     {
         StudyItem item = (StudyItem)row.DataBoundItem;
         item.ClearViewers();
     }
 }
Exemple #2
0
        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);
                }
            }
        }