private void TestClient()
		{
			SynchronizationContext context = SynchronizationContext.Current;

			//Have to test client on another thread, otherwise there is a deadlock b/c the service is hosted on the main thread.
			ThreadPool.QueueUserWorkItem(delegate
											{
												try
												{
													using (ViewerAutomationServiceClient client = new ViewerAutomationServiceClient())
													{
														client.GetActiveViewers();
													}

													context.Post(delegate
																	{
																		base.Context.DesktopWindow.ShowMessageBox("Success!", MessageBoxActions.Ok);
																	}, null);
												}
												catch (Exception e)
												{
													context.Post(delegate
													{
														base.Context.DesktopWindow.ShowMessageBox(e.Message, MessageBoxActions.Ok);
													}, null);

												}
											});

		}
        private void TestClient()
        {
            SynchronizationContext context = SynchronizationContext.Current;

            //Have to test client on another thread, otherwise there is a deadlock b/c the service is hosted on the main thread.
            ThreadPool.QueueUserWorkItem(delegate
            {
                try
                {
                    using (ViewerAutomationServiceClient client = new ViewerAutomationServiceClient())
                    {
                        client.GetActiveViewers();
                    }

                    context.Post(delegate
                    {
                        base.Context.DesktopWindow.ShowMessageBox("Success!", MessageBoxActions.Ok);
                    }, null);
                }
                catch (Exception e)
                {
                    context.Post(delegate
                    {
                        base.Context.DesktopWindow.ShowMessageBox(e.Message, MessageBoxActions.Ok);
                    }, null);
                }
            });
        }
		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);
				}
			} 
		}
예제 #4
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));
         }
     }
 }
예제 #5
0
 public void CloseViewer(CloseViewerRequest 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)
     {
         new ViewerAutomation().CloseViewer(request);
     }
     else
     {
         using (ViewerAutomationServiceClient client = new ViewerAutomationServiceClient())
         {
             client.CloseViewer(request);
         }
     }
 }
		public void ActivateViewer(ActivateViewerRequest 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)
			{
				new ViewerAutomation().ActivateViewer(request);
			}
			else
			{
				using (ViewerAutomationServiceClient client = new ViewerAutomationServiceClient())
				{
					client.ActivateViewer(request);
				}
			} 
		}
예제 #7
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();
        }