Пример #1
0
        private void btnConnected_Click(object sender, EventArgs e)
        {
            IniSettings.PortName = cmbPortName.Text;
            IniSettings.BaudRate = Convert.ToInt32(cmbBaudRate.Text);
            IniSettings.IP       = txtRemoteIP.Text;
            IniSettings.IPPort   = Convert.ToInt32(txtRemotePort.Text);

            if (!SystemPub.ADRcp.bConnected)
            {
                if (IniSettings.Communication == CommType.NET)
                {
                    IPStatus ipsta = SystemBase.Ping(IniSettings.HostName);
                    if (ipsta != IPStatus.Success)
                    {
                        MessageBox.Show("PING:" + txtRemoteIP.Text + " " + ipsta.ToString());
                        return;
                    }
                }

                SystemPub.ADRcp.Connect(IniSettings.HostName, IniSettings.HostPort, (int)IniSettings.Communication);
                Application.DoEvents();

                if (IniSettings.Communication == CommType.USB)
                {
                    if (!chkAutoConnect.Enabled)
                    {
                        chkAutoConnect.Enabled = true;
                    }
                    else
                    {
                        if (chkAutoConnect.Checked)
                        {
                            chkAutoConnect.Enabled = false;
                            if (SystemPub.ADRcp.bConnected)
                            {
                                SystemPub.ADRcp.Send("AutoConnectStart");
                            }
                        }
                    }
                }
                Application.DoEvents();
            }
        }
Пример #2
0
 private void btnPing_Click(object sender, EventArgs e)
 {
     MessageBox.Show("PING:" + txtRemoteIP.Text + " " + SystemBase.Ping(txtRemoteIP.Text).ToString());
 }