Пример #1
0
 public MainForm()
 {
     InitializeComponent();
     textBoxMODAServer.Text = Constants.DEFAULT_IP;
     Connection             = null;
     Phx = null;
 }
Пример #2
0
        private void buttonConnect_Click(object sender, EventArgs e)
        {
            if (textBoxMODAServer.Text.Length != 0)
            {
                if (Connection != null)
                {
                    //close the current connection
                    Connection.Disconnect();
                    Connection = null;
                    Phx        = null;
                }

                Connection = new Moda.Connection(true);
                if (Connection.Connect(textBoxMODAServer.Text))
                {
                    Phx = Connection.QueryRobotPHX(Constants.ROBOT_PHX);
                    if (Phx == null)
                    {
                        MessageBox.Show("Connected to MODA server " + textBoxMODAServer.Text + ", /phx0 not found");
                    }
                    else
                    {
                        buttonConnect.Enabled = false;
                        buttonConnect.Text    = "Connected";
                        buttonStart.Enabled   = true;
                    }
                }
                else
                {
                    MessageBox.Show("Unable to connected to MODA server " + textBoxMODAServer.Text);
                }
            }
            else
            {
                MessageBox.Show("Unable to connected to MODA server " + textBoxMODAServer.Text);
            }
        }