Пример #1
0
        private void RunDicomEcho(object state)
        {
            bool   success = false;
            string msg     = "Unknown failure!";

            try {
                CEchoClient scu = new CEchoClient();
                scu.CallingAE        = Config.LocalAE;
                scu.CalledAE         = Config.RemoteAE;
                scu.MaxPduSize       = Config.MaxPdu;
                scu.ConnectTimeout   = 0;
                scu.SocketTimeout    = 5;
                scu.DimseTimeout     = 5;
                scu.OnCEchoResponse += delegate(byte presentationId, ushort messageId, DcmStatus status) {
                    msg = status.ToString();
                };
                scu.Connect(Config.RemoteHost, Config.RemotePort, Config.UseTls ? DcmSocketType.TLS : DcmSocketType.TCP);
                success = scu.Wait();

                if (!success)
                {
                    msg = scu.ErrorMessage;
                }
            }
            catch (Exception ex) {
                msg = ex.Message;
            }

            Invoke(new MessageBoxDelegate(ShowMessageBox), msg, "DICOM C-Echo Result", !success);
            Invoke(new BoolDelegate(ToggleEchoButtons), true);
        }
Пример #2
0
        private bool DoEcho(string host, int port, string calledAet, string callingAet, out string message)
        {
            var success = false;
            var msg     = "Unidentified failure";

            var echoScu = new CEchoClient {
                CalledAE = calledAet, CallingAE = callingAet
            };

            echoScu.OnCEchoResponse += delegate(byte presentationID, ushort messageID, DcmStatus status)
            {
                success = status.State == DcmState.Success; msg = status.Description;
            };

            echoScu.Connect(host, port, DcmSocketType.TCP);
            if (!echoScu.Wait())
            {
                msg = echoScu.ErrorMessage;
            }

            message = msg;
            return(success);
        }
Пример #3
0
        private void TestButton_Click(object sender, RoutedEventArgs e)
        {
            var success = false;
            var message = "Unidentified failure";

            var echoClient = new CEchoClient {
                CalledAE = calledAetTextBox.Text, CallingAE = callingAetTextBox.Text
            };

            echoClient.OnCEchoResponse += delegate(byte presentationId, ushort messageId, DcmStatus status)
            {
                success = status.State == DcmState.Success;
                message = success ? "Connection successful" : status.ErrorComment;
            };

            echoClient.Connect(hostTextBox.Text, Int32.Parse(portTextBox.Text), DcmSocketType.TCP);
            if (!echoClient.Wait())
            {
                success = false;
                message = "Connection failed";
            }

            MessageBox.Show(message, "C-ECHO result", MessageBoxButton.OK);
        }