private void buttonAdd_Click(object sender, EventArgs e) { addPopServ formAdd=new addPopServ(); formAdd.StartPosition = FormStartPosition.CenterParent; if (formAdd.ShowDialog(this) != DialogResult.OK) { return; } // formAdd.strDomain; //check null if (String.IsNullOrEmpty(formAdd.strDomain) || String.IsNullOrEmpty(formAdd.strPop) || String.IsNullOrEmpty(formAdd.strPort)) { MessageBox.Show("不能为空"); return; } //check if exists foreach (data d in list) { try { //nsole.WriteLine(d.domain); if (formAdd.strDomain.ToLower() == d.domain.ToLower()) { MessageBox.Show("该域名已经存在,请先删除然后再添加"); return; } } catch (Exception ee) { } } //save data try { list.Add(new data() { domain = formAdd.strDomain, pop3 = formAdd.strPop, port = Convert.ToInt32(formAdd.strPort), isSSL = formAdd.isSSL }); //add to liveview bool bTmp; string strTmp; if (formAdd.isSSL) { strTmp = "是"; } else { strTmp = "否"; } ListViewItem item1 = new ListViewItem(formAdd.strDomain, 0); // Place a check mark next to the item. //item1.Checked = true; item1.SubItems.Add(formAdd.strPop); item1.SubItems.Add(formAdd.strPort); item1.SubItems.Add(strTmp); listPopServ.Items.Add(item1); //Console.WriteLine(formAdd.ToString()); } catch (Exception eaa) { } }
private void buttonAdd_Click(object sender, EventArgs e) { addPopServ formAdd = new addPopServ(); formAdd.StartPosition = FormStartPosition.CenterParent; if (formAdd.ShowDialog(this) != DialogResult.OK) { return; } // formAdd.strDomain; //check null if (String.IsNullOrEmpty(formAdd.strDomain) || String.IsNullOrEmpty(formAdd.strPop) || String.IsNullOrEmpty(formAdd.strPort)) { MessageBox.Show("不能为空"); return; } //check if exists foreach (data d in list) { try { //nsole.WriteLine(d.domain); if (formAdd.strDomain.ToLower() == d.domain.ToLower()) { MessageBox.Show("该域名已经存在,请先删除然后再添加"); return; } } catch (Exception ee) { } } //save data try { list.Add(new data() { domain = formAdd.strDomain, pop3 = formAdd.strPop, port = Convert.ToInt32(formAdd.strPort), isSSL = formAdd.isSSL }); //add to liveview bool bTmp; string strTmp; if (formAdd.isSSL) { strTmp = "是"; } else { strTmp = "否"; } ListViewItem item1 = new ListViewItem(formAdd.strDomain, 0); // Place a check mark next to the item. //item1.Checked = true; item1.SubItems.Add(formAdd.strPop); item1.SubItems.Add(formAdd.strPort); item1.SubItems.Add(strTmp); listPopServ.Items.Add(item1); //Console.WriteLine(formAdd.ToString()); } catch (Exception eaa) { } }