Example #1
0
        private void _cb_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ItemSelected == null)
            {
                return;
            }
            FileComboBoxItem item = _cb.SelectedItem as FileComboBoxItem;

            if (item != null)
            {
                ItemSelected(item);
            }
        }
Example #2
0
        public void Load()
        {
            try
            {
                _cb.Items.Clear();
                string[] flist = Directory.GetFiles(FolderPath);

                SortedList <string, string> slist = new SortedList <string, string>();
                foreach (string f in flist)
                {
                    slist.Add(f, f);
                }

                foreach (KeyValuePair <string, string> p in slist)
                {
                    FileComboBoxItem i = new FileComboBoxItem(p.Value);
                    _cb.Items.Add(i);
                }
            }
            catch (Exception err)
            {
                Program.Context.Log.Write(err);
            }
        }
Example #3
0
        private void RunAll(int times)
        {
            if (times < 1)
            {
                return;
            }

            FileComboBoxItem i = _ctrlSampleMsg.GetSelectedItem();

            if (i == null)
            {
                return;
            }

            string sndSoap = "";
            string rcvSoap = "";

            HYS.IM.Messaging.Objects.Message rcvMsg = null;
            HYS.IM.Messaging.Objects.Message sndMsg =
                XObjectManager.CreateObject <HYS.IM.Messaging.Objects.Message>(i.FileContent);

            if (sndMsg == null)
            {
                MessageBox.Show(this,
                                "Deserialize XDS Gateway message failed. \r\n" +
                                "Please check whether the XML string conforms to XDS Gateway message schema.",
                                this.Text,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return;
            }

            string     uri    = this.textBoxURI.Text;
            string     action = this.textBoxAction.Text;
            SOAPSender s      = new SOAPSender(
                Program.Context.ConfigMgr.Config.GetWCFConfigFileNameWithFullPath(),
                Program.Context.Log);

            bool            res    = false;
            List <TimeSpan> tsList = new List <TimeSpan>();

            for (int t = 0; t < times; t++)
            {
                DateTime dtB = DateTime.Now;
                if (_controler.GenerateSOAPMessage(sndMsg, out sndSoap))
                {
                    if (s.SendMessage(
                            this.textBoxURI.Text.Trim(),    // Program.Context.ConfigMgr.Config.SOAPServiceURI,
                            this.textBoxAction.Text.Trim(), //Program.Context.ConfigMgr.Config.SOAPAction,
                            sndSoap, ref rcvSoap))
                    {
                        res = _controler.GenerateXDSGWMessage(rcvSoap, out rcvMsg);
                        if (!res)
                        {
                            break;
                        }
                    }
                    else
                    {
                        res = false;
                        break;
                    }
                }
                else
                {
                    res = false;
                    break;
                }
                DateTime dtE = DateTime.Now;
                TimeSpan ts  = dtE.Subtract(dtB);
                tsList.Add(ts);
            }

            if (res)
            {
                double totalMs = 0;
                foreach (TimeSpan ts in tsList)
                {
                    totalMs += ts.TotalMilliseconds;
                }
                this.labelRunPerform.Text = (double)(totalMs / (double)times) + " ms";

                _ctrlSndMsg.Open("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + sndMsg.ToXMLString());
                _ctrlSndSoap.Open("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + sndSoap);
                _ctrlRcvSoap.Open("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + rcvSoap);
                _ctrlRcvMsg.Open("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + rcvMsg.ToXMLString());
            }
            else
            {
                MessageBox.Show(this,
                                "Transform or send message error. Please see log file for details.",
                                this.Text,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
            }
        }