Пример #1
0
        private void OpenSocket()
        {
            if (_client != null)
            {
                return;
            }

            SocketClientConfig cfg = new SocketClientConfig();

            cfg.SocketClientType = this.comboBoxType.SelectedItem as string;
            cfg.IPAddress        = _serverIP;
            cfg.Port             = _serverPort;

            _client = SocketClientFactory.Create(cfg);

            if (_client != null && _client.Open())
            {
                this.buttonOpen.Enabled   = false;
                this.buttonSend.Enabled   = true;
                this.buttonClose.Enabled  = true;
                this.comboBoxType.Enabled = false;
            }
            else
            {
                this.buttonOpen.Enabled   = true;
                this.buttonSend.Enabled   = false;
                this.buttonClose.Enabled  = false;
                this.comboBoxType.Enabled = true;

                MessageBox.Show(this, "Open socket failed. \r\n\r\n"
                                + SocketLogMgt.LastErrorInfor, this.Text,
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Пример #2
0
        private void AutoSend()
        {
            decimal count = this.numericUpDownAutoSendTimes.Value;

            if (count < 1)
            {
                return;
            }

            SocketClientConfig cfg = new SocketClientConfig();

            cfg.SocketClientType = this.comboBoxType.SelectedItem as string;
            cfg.IPAddress        = _serverIP;
            cfg.Port             = _serverPort;

            IClient cln = SocketClientFactory.Create(cfg);

            for (decimal i = 1; i <= count; i++)
            {
                this.labelTimesCounter.Text = string.Format("{0}/{1}", i, count);

                if (cln == null || !cln.Open())
                {
                    MessageBox.Show(this, "Open socket failed. \r\n\r\n"
                                    + SocketLogMgt.LastErrorInfor, this.Text,
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                if (!SendMessages(cln))
                {
                    break;
                }

                if (!cln.Close())
                {
                    MessageBox.Show(this, "Close socket failed. \r\n\r\n"
                                    + SocketLogMgt.LastErrorInfor, this.Text,
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }
            }
        }
Пример #3
0
 public HL7OutboundControler(EntityImpl entity)
 {
     _entity      = entity;
     _client      = SocketClientFactory.Create(_entity.Context.ConfigMgr.Config.SocketConfig);
     _transformer = XmlTransformerFactory.CreateTransformer(_entity.Context.ConfigMgr.Config.HL7XMLTransformerType, _entity.Context.Log);
 }