Esempio n. 1
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            //TODO: ERROR CHECK

            Computer c;

            c = c_mgmt.getComputer(this.m_selComputer);

            c.addProcess(new Process(this.textProcessName.Text.ToString(),
                                     this.textProcessOwner.Text.ToString(),
                                     this.textProcessGroup.Text.ToString(),
                                     c));
            this.Close();
            this.Dispose();
        }
Esempio n. 2
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            int port;

            if (this.textboxComputerName.Text.Equals(""))
            {
                MessageBox.Show(this, "A computer must have an IP address or a host name", "Warning!", MessageBoxButtons.OK);
                return;
            }
            if (this.checkBoxDefault.Checked)
            {
                port = 1234;
            }
            else
            {
                if (this.textBoxPort.Text.Equals(""))
                {
                    MessageBox.Show(this, "You must specify a port number!!!", "Warning!", MessageBoxButtons.OK);
                    return;
                }
                else
                {
                    try
                    {
                        port = Convert.ToInt32(this.textBoxPort.Text.ToString());
                    }
                    catch (Exception exception)
                    {
                        MessageBox.Show(this, "Port number must be numeric!!!", "Warning!", MessageBoxButtons.OK);
                        return;
                    }
                }
            }

            if (mgmt.getComputer(this.textboxComputerName.Text) == null)
            {
                mgmt.AddComputer(this.textboxComputerName.Text.ToString(), port);
            }
            else
            {
                MessageBox.Show("This computer does already exist!", "Add computer");
                return;
            }

            this.Dispose();
        }