Пример #1
0
        public string connect_Boombarrier()
        {
            string ConnectionStaue = "";

            if (!_con.IsConnected)
            {
                string    ip = classGlobalVariables.AntenaSet1Loc_BoomBarrier_IP.ToString();
                IPAddress address;
                if (IPAddress.TryParse(ip, out address))
                {
                    if (_con.ConnectByEthernetmodule(ip))
                    {
                        ConnectionStaue = "Connected";
                    }
                }
                else
                {
                    MessageBox.Show("Check IP!");
                }
            }
            else
            {
                _con.Disconnect();
                ConnectionStaue = "Disconnected";
            }
            return(ConnectionStaue);
        }
        public static cMGCConnector _conSet2 = new cMGCConnector(); //Set2
        #region Boom Barrier Connection
        public static string BoomBarriorConnection(string BoomBarrierIP, cMGCConnector _con)
        {
            string ConnectionStatus = "NotConnected";

            if (!_con.IsConnected)
            {
                string    ip = BoomBarrierIP;
                IPAddress address;
                if (IPAddress.TryParse(ip, out address))
                {
                    if (_con.ConnectByEthernetmodule(ip))
                    {
                        ConnectionStatus = "Connected";
                    }
                }
                else
                {
                    ConnectionStatus = "Check IP!";
                }
            }
            else
            {
                _con.Disconnect();
                ConnectionStatus = "Discooected";
            }

            return(ConnectionStatus);
        }
Пример #3
0
 /// <summary>
 /// Connect to the barrier
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnConnect_Click(object sender, EventArgs e)
 {
     if (!_con.IsConnected)
     {
         string    ip = tbIp1.Text + "." + tbIp2.Text + "." + tbIp3.Text + "." + tbIp4.Text;
         IPAddress address;
         if (IPAddress.TryParse(ip, out address))
         {
             if (_con.ConnectByEthernetmodule(ip))
             {
                 btnConnect.Text = "Disconnect";
             }
         }
         else
         {
             MessageBox.Show("Check IP!");
         }
     }
     else
     {
         _con.Disconnect();
         btnConnect.Text = "Connect";
     }
 }