private void editToolStripMenuItem1_Click(object sender, EventArgs e) { //find the selected server int index = lstServer.SelectedIndex; //create new server form frmServer s = new frmServer(); //add current server information to form s.txtIP.Text = watch.WatchList[index].IP; s.txtPort.Text = watch.WatchList[index].PORT.ToString(); //if the form is submitted if (s.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //update server settings lstServer.Items[index] = s.txtIP.Text + ":" + s.txtPort.Text; watch.WatchList[index].IP = s.txtIP.Text; watch.WatchList[index].PORT = Convert.ToInt32(s.txtPort.Text); //save settings saveSettings(); } //clean up s.Dispose(); }
private void addToolStripMenuItem_Click(object sender, EventArgs e) { //new server dialog frmServer s = new frmServer(); if (s.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //if a new server was entered correctly, create a new server object Server _s = new Server(); //assign server information _s.IP = s.txtIP.Text; _s.PORT = Convert.ToInt32(s.txtPort.Text); //add server to list addServer(_s); //save settings saveSettings(); } //clean up form s.Dispose(); }