示例#1
0
 private void newMonitorToolStripMenuItem_Click(object sender, EventArgs e)
 {
     //Open new monitor window with its own server and port
     if (FormsManager._openForms.Count < 4)
     {
         monitorscreen_picturebox mp = new monitorscreen_picturebox(2015 + FormsManager._openForms.Count, false);
         mp.Tag = (monitorscreen)Tag;
         mp.Show();
     }
     else
     {
         MessageBox.Show("Can only open max of 4");
     }
 }
        //Handles the listen btn click event
        private void listen_btn_Click(object sender, EventArgs e)
        {
            //new monitorscreen_picturebox(int.Parse(port_tb.Text)).Show();

            //Try parse the port no or send an error message
            if (int.TryParse(port_tb.Text, out portno))
            {
                //The monitorscreen object handles the port no and turns the server on
                monitorscreen_picturebox mp = new monitorscreen_picturebox(portno, true);
                mp.Tag = this;
                mp.Show(this);
                Hide();
            }
            else
            {
                MessageBox.Show("Make the port no a four digit integer (xxxx)");
            }
        }