Ejemplo n.º 1
0
		private void InternalVerifyServer()
		{
			if (this.NoServersSelected())
			{
				//should never get here because the verify button should be disabled.
				this.Context.DesktopWindow.ShowMessageBox(SR.MessageNoServersSelected, MessageBoxActions.Ok);
				return;
			}

		    try
		    {
		        var localServer = ServerDirectory.GetLocalServer();

                var msgText = new StringBuilder();
                msgText.AppendFormat(SR.MessageCEchoVerificationPrefix + "\r\n\r\n");
                foreach (var server in this.Context.SelectedServers)
                {
                    using (var scu = new VerificationScu())
                    {
                        VerificationResult result = scu.Verify(localServer.AETitle, server.AETitle, server.ScpParameters.HostName, server.ScpParameters.Port);
                        if (result == VerificationResult.Success)
                            msgText.AppendFormat(SR.MessageCEchoVerificationSingleServerResultSuccess + "\r\n", server.Name);
                        else
                            msgText.AppendFormat(SR.MessageCEchoVerificationSingleServerResultFail + "\r\n", server.Name);

                        // must wait for the SCU thread to release the connection properly before disposal, otherwise we might end up aborting the connection instead
                        scu.Join(new TimeSpan(0, 0, 2));
                    }
                }

                msgText.AppendFormat("\r\n");
                this.Context.DesktopWindow.ShowMessageBox(msgText.ToString(), MessageBoxActions.Ok);
		    }
		    catch (Exception e)
		    {
                ExceptionHandler.Report(e, base.Context.DesktopWindow);
		    }
		}
Ejemplo n.º 2
0
    public static bool EchoNode(Node node)
    {
        try
        {

            VerificationScu scu = new VerificationScu();
            var result = scu.Verify(node.LocalAe, node.AET, node.IP, node.Port);
            if (result == VerificationResult.Success)
                return true;
            else
                return false;
        }
        catch { return false; }
    }
Ejemplo n.º 3
0
 private void TestStoreServer()
 {
     try
     {
         _verificationScu = new VerificationScu();
         //if (cmdTest.Text == STR_Verify)
             StartVerify();
         //else
         //    CancelVerify();
     }
     catch
     {
     }
 }
Ejemplo n.º 4
0
		public VerifyResponse Verify(VerifyRequest request)
		{
			try
			{
				var verify = new VerificationScu();

				var result = verify.Verify(request.LocalApplicationEntity, request.RemoteApplicationEntity.AETitle, request.RemoteApplicationEntity.ScpParameters.HostName, request.RemoteApplicationEntity.ScpParameters.Port);

				if (result == VerificationResult.AssociationRejected)
				{
					var fault = new VerificationFailedFault
						{
							Description = SR.VerifyAssociationRejected,
							Result = result
						};
					throw new FaultException<VerificationFailedFault>(fault, fault.Description);
				}
				if (result == VerificationResult.Failed)
				{
					var fault = new VerificationFailedFault
						{
							Description = SR.VerifyFailed,
							Result =  result
						};
					throw new FaultException<VerificationFailedFault>(fault, fault.Description);
				}
				if (result == VerificationResult.Canceled)
				{
					var fault = new VerificationFailedFault
						{
							Description = SR.VerifyCanceled,
							Result = result
						};
					throw new FaultException<VerificationFailedFault>(fault, fault.Description);
				}
				if (result == VerificationResult.TimeoutExpired)
				{
					var fault = new VerificationFailedFault
						{
							Description = SR.VerifyTimeoutExpired,
							Result = result
						};
					throw new FaultException<VerificationFailedFault>(fault, fault.Description);
				}

				return new VerifyResponse
					{
						Result = verify.Result
					};
			}
			catch (Exception e)
			{
				Platform.Log(LogLevel.Info, "User DICOM Verification not understood: {0}", e.Message);
				var fault = new VerificationFailedFault
				{
					Description = e.Message,
					Result = VerificationResult.Failed
				};
				throw new FaultException<VerificationFailedFault>(fault, fault.Description);
			}
		}