Пример #1
0
        private void AddDeviceTree_Load(object sender, EventArgs e)
        {
            potocolType.SelectedIndex = 0;
            Lonip.Select();

            if (memoryData.LonDeviceTemp.Count != 0)
            {
                for (int i = 0; i < memoryData.LonDeviceTemp.Count; i++)
                {
                    LonDeviceIp add = (LonDeviceIp)memoryData.LonDeviceTemp[i];
                    comboBox2.Items.Add(add.ip);
                }
            }
        }
Пример #2
0
 private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
 {
     Lonip.Text = comboBox2.Text;
     for (int i = 0; i < memoryData.LonDeviceTemp.Count; i++)
     {
         LonDeviceIp tar = (LonDeviceIp)memoryData.LonDeviceTemp[i];
         if (tar.ip == comboBox2.Text)
         {
             tempList.Items.Clear();
             tempListpath.Items.Clear();
             for (int c = 0; c < tar.device.Count; c++)
             {
                 tempList.Items.Add(tar.device[c]);
                 tempListpath.Items.Add(tar.path[c]);
             }
         }
     }
 }
Пример #3
0
        private void backSOAP_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Cancelled == true)
            {
                //resultLabel.Text = "Canceled!";
                StatusLabel.Text    = "connect canceled!";
                waitIMG.Visible     = false;
                connectStop.Visible = false;
                g1.Enabled          = true;
                g2.Enabled          = true;
            }
            else if (e.Error != null)
            {
                //resultLabel.Text = "Error: " + e.Error.Message;
                StatusLabel.Text    = "Error: " + e.Error.Message;
                waitIMG.Visible     = false;
                connectStop.Visible = false;
                g1.Enabled          = true;
                g2.Enabled          = true;
            }
            else
            {
                Boolean chkip      = false;
                int     chkipindex = 0;
                for (int i = 0; i < memoryData.LonDeviceTemp.Count; i++)
                {
                    LonDeviceIp chk = (LonDeviceIp)memoryData.LonDeviceTemp[i];
                    if (Lonip.Text == chk.ip)
                    {
                        chkip      = true;
                        chkipindex = i;
                        break;
                    }
                }

                LonDeviceIp addip     = new LonDeviceIp();
                ArrayList   adddevice = new ArrayList();
                ArrayList   addpath   = new ArrayList();
                if (chkip != true)
                {
                    addip.ip = Lonip.Text;
                    comboBox2.Items.Add(Lonip.Text);
                }



                tempList.Items.Clear();
                LonDeviceList.Items.Clear();
                LonDeviceListPath.Items.Clear();

                for (int i = 0; i < backSOAPrun.Items.Count; i++)
                {
                    adddevice.Add(backSOAPrun.Items[i]);
                    addpath.Add(backSOAPrunPath.Items[i]);

                    tempList.Items.Add(backSOAPrun.Items[i]);
                    LonDeviceList.Items.Add(backSOAPrun.Items[i]);
                    LonDeviceListPath.Items.Add(backSOAPrunPath.Items[i]);
                }

                if (chkip != true)
                {
                    addip.device = adddevice;
                    addip.path   = addpath;
                    memoryData.LonDeviceTemp.Add(addip);
                }
                else
                {
                    LonDeviceIp edit = (LonDeviceIp)memoryData.LonDeviceTemp[chkipindex];

                    edit.device.Clear();
                    edit.path.Clear();

                    edit.device = adddevice;
                    edit.path   = addpath;
                    memoryData.LonDeviceTemp[chkipindex] = edit;
                }
                comboBox2.Text = Lonip.Text;
                //resultLabel.Text = "Done!";
                StatusLabel.Text    = "connect down";
                waitIMG.Visible     = false;
                connectStop.Visible = false;
                g1.Enabled          = true;
                g2.Enabled          = true;
                soapcount           = 0;
                //pictureBox1.Visible = false;
                // ic.Close();
            }
        }