コード例 #1
0
ファイル: MainForm.cs プロジェクト: siga111/BachelorThesis
 public MainForm()
 {
     InitializeComponent();
     textBoxMODAServer.Text = Constants.DEFAULT_IP;
     Connection             = null;
     Phx = null;
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: siga111/BachelorThesis
        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);
            }
        }