/// <summary> /// 编辑Host /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Edit(object sender, EventArgs e) { if (listViewHost.SelectedItems.Count != 1) { return; } FrmHostEditor hostEditor = new FrmHostEditor() { Text = "编辑Host", Host = listViewHost.SelectedItems[0].Tag as Host }; if (hostEditor.ShowDialog() == DialogResult.OK) { listViewHost.ReloadList(); Edited = true; } }
/// <summary> /// 添加Host /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void New(object sender, EventArgs e) { FrmHostEditor HostEditor = new FrmHostEditor() { Text = "添加Host", Host = new Host() { Container = hostList } }; HostEditor.ShowDialog(); if (HostEditor.DialogResult == DialogResult.OK) { hostList.Add(HostEditor.Host); listViewHost.ReloadList(); Edited = true; } }