private void btnAddPortal_Click(object sender, EventArgs e) { try { var form = new AddPortalForm(); var ret = form.ShowDialog(); if (ret != DialogResult.OK) { return; } currentServer.AddPortal(form.Model); addPortalToListView(form.Model); Config.Save(); } catch (Exception ex) { MessageBox.Show("Add portal error,reason:" + ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void btnEditPortal_Click(object sender, EventArgs e) { if (lvPortals.SelectedItems.Count <= 0) { return; } var lvi = lvPortals.SelectedItems[0]; var model = (Model.PortalModel)lvi.Tag; var form = new AddPortalForm(); form.Model = model; var ret = form.ShowDialog(); if (ret != DialogResult.OK) { return; } currentServer.RemovePortal(model); currentServer.AddPortal(model); Config.Save(); refreshPortalListView(); }