示例#1
0
        private void TestConnection_Click(object sender, EventArgs e)
        {
            TestConnection.Text    = "Testing...";
            username_text.Enabled  = false;
            password_text.Enabled  = false;
            TestConnection.Enabled = false;
            ms.voip.VoIPms_Service   soap  = new ms.voip.VoIPms_Service();
            ms.voip.getDIDsInfoInput input = new ms.voip.getDIDsInfoInput();
            XmlNode[]  output;
            XmlElement result_status = null;
            string     status        = null;

            input.api_username  = username_text.Text;
            input.api_password  = password_text.Text;
            input.client        = ""; // Set to nothing so we can get all the account DID's
            input.did           = ""; // Same thing. need all the DID's
            output              = (XmlNode[])soap.getDIDsInfo(input);
            result_status       = (XmlElement)output.GetValue(1);
            status              = result_status.ChildNodes[1].InnerText;
            TestConnection.Text = status;
            if (status == "success")
            {
                XmlElement result_dids = null;
                XmlElement dids        = null;
                XmlElement did         = null;
                result_dids = (XmlElement)output.GetValue(2);
                dids        = (XmlElement)result_dids.ChildNodes[1];
                for (int i = 0; i <= dids.ChildNodes.Count - 1; i++)
                {
                    did = (XmlElement)dids.ChildNodes[i];
                    if (did.ChildNodes[21].ChildNodes[1].InnerText == "1")
                    {
                        comboBox1.Items.Add(did.ChildNodes[0].ChildNodes[1].InnerText);
                    }
                    //callbackUrl_text.Text = did.ChildNodes[26].ChildNodes[1].InnerText;
                }
                if (comboBox1.Items.Count > 0)
                {
                    comboBox1.SelectedIndex = 0;
                    comboBox1.Enabled       = true;
                    dateTimePicker1.Enabled = true;
                    saveOpen_button.Enabled = true;
                }
            }
            else
            {
                comboBox1.Items.Clear();
                comboBox1.Enabled       = false;
                dateTimePicker1.Enabled = false;
                saveOpen_button.Enabled = false;
            }
            username_text.Enabled  = true;
            password_text.Enabled  = true;
            TestConnection.Enabled = true;
        }
示例#2
0
        private void voipTestConnect_btn_Click(object sender, EventArgs e)
        {
            voipTestConnect_btn.Text = "Testing...";

            voipUsername_input.Enabled  = false;
            voipPassword_input.Enabled  = false;
            voipTestConnect_btn.Enabled = false;

            ms.voip.VoIPms_Service   soap  = new ms.voip.VoIPms_Service();
            ms.voip.getDIDsInfoInput input = new ms.voip.getDIDsInfoInput();
            XmlNode[] output;

            //XML Elements
            XmlElement result_status = null;
            XmlElement result_dids   = null;
            XmlElement dids          = null;
            XmlElement did           = null;

            //String Vars
            string status   = null;
            string str_dids = null;

            //Fill Input Object
            input.api_username = voipUsername_input.Text;
            input.api_password = voipPassword_input.Text;
            input.client       = ""; // Set to nothing so we can get all the account DID's
            input.did          = ""; // Same thing. need all the DID's

            //Request Info
            output        = (XmlNode[])soap.getDIDsInfo(input);
            result_status = (XmlElement)output.GetValue(1);

            //if (output.GetType().ToString() == "System.Xml.XmlNode[]")
            //{
            //Get status
            status = result_status.ChildNodes[1].InnerText;
            //}
            voipTestConnect_btn.Text = status;

            if (status == "success")
            {
                result_dids = (XmlElement)output.GetValue(2);
                dids        = (XmlElement)result_dids.ChildNodes[1];

                for (int i = 0; i <= dids.ChildNodes.Count - 1; i++)
                {
                    //Get DID
                    did = (XmlElement)dids.ChildNodes[i];

                    if (did.ChildNodes[21].ChildNodes[1].InnerText == "1")
                    {
                        activeDID_text.Text = did.ChildNodes[0].ChildNodes[1].InnerText;
                        Properties.Settings.Default.ActiveDID = did.ChildNodes[0].ChildNodes[1].InnerText;
                        Properties.Settings.Default.Save();
                    }

                    callbackUrl_text.Text = did.ChildNodes[26].ChildNodes[1].InnerText;
                    for (int j = 0; j <= did.ChildNodes.Count - 1; j++)
                    {
                        //Get Data from DID
                        str_dids += j.ToString() + ">>" + did.ChildNodes[j].ChildNodes[0].InnerText + " => ";
                        str_dids += did.ChildNodes[j].ChildNodes[1].InnerText + "\n";
                    }

                    str_dids += "\n";
                }
                MessageBox.Show(str_dids, "a bunch of data");
            }

            voipUsername_input.Enabled  = true;
            voipPassword_input.Enabled  = true;
            voipTestConnect_btn.Enabled = true;
        }