Esempio n. 1
0
        //Connecter
        private void button2_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(IpBox.Text))
            {
                hostname = IpBox.Text.ToString();
            }
            if (!String.IsNullOrEmpty(PortBox.Text))
            {
                port = Convert.ToInt32(PortBox.Text);
            }
            if (!String.IsNullOrEmpty(PassBox.Text))
            {
                password = Convert.ToString(PassBox.ToString());
            }
            if (checkBox1.Checked && firspass)
            {
                param.UsePasswordAuthentication(password); firspass = false;
            }


            bool retry = true;

            while (retry)
            {
                try
                {
                    ConnectToIED.Connect(hostname, port);
                    Disconnect_button.Enabled = true;
                    Connect_button.Enabled    = false;
                    Exit_button.Enabled       = false;
                    CreateButton.Enabled      = true;
                    Get_reports.Enabled       = true;
                    IpBox.Clear();
                    PortBox.Clear();
                    PassBox.Clear();
                    retry           = false;
                    toolStatus.Text = "Connected";
                    IEDConnected    = true;
                    int i = 1;
                    for (i = 1; i < 65; i++)
                    {
                        refer.Add("GEDeviceF650/vinGGIO1.SPCSO" + i.ToString() + "");
                        control.Add(ConnectToIED.CreateControlObject(refer[i - 1]));
                    }
                }
                catch (IedConnectionException ex)
                {
                    IEDConnected    = false;
                    toolStatus.Text = "Failed to connect";
                    if (MessageBox.Show(ex.Message + "for the following reason" + ex.GetIedClientError(), "Erreur", MessageBoxButtons.RetryCancel) == DialogResult.Cancel)
                    {
                        retry = false;
                    }
                    else
                    {
                        retry = true;
                    }
                }
            }
        }
Esempio n. 2
0
 private void ClearTextBoxes()
 {
     UserNameBox.Clear();
     ComputerNameBox.Clear();
     RamBox.Clear();
     RamUsageBox.Clear();
     CpuUsageBox.Clear();
     CpuBox.Clear();
     IpBox.Clear();
     AverageDiskQueueLengthBox.Clear();
     AvailableDiskSpaceGBBox.Clear();
     VideoCardBox.Clear();
 }