Beispiel #1
0
 public OpenStudiesResult OpenStudies(OpenStudiesRequest 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().OpenStudies(request));
     }
     else
     {
         using (ViewerAutomationServiceClient client = new ViewerAutomationServiceClient())
         {
             return(client.OpenStudies(request));
         }
     }
 }
		public OpenStudiesResult OpenStudies(OpenStudiesRequest 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().OpenStudies(request);
			}
			else
			{
				using (ViewerAutomationServiceClient client = new ViewerAutomationServiceClient())
				{
					return client.OpenStudies(request);
				}
			} 
		}
        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();
        }