/// <summary> /// Edits the selected host(s) /// </summary> public void EditSelectedHost() { if( listView.SelectedItems.Count > 0 ) { WOL2Host h = (WOL2Host)listView.SelectedItems[0].Tag; if( h != null ) { DlgEditHost dlg = new DlgEditHost( h ); dlg.ShowDialog( this ); // Assign the item AssignHostToListItem( h, h.GetListViewItem() ); // Mark the file as changed ChangedHostsFile(); } } }
/// <summary> /// Inserts a new host /// </summary> public void InsertNewHost(WOL2Host h) { if( h == null ) h = new WOL2Host(); DlgEditHost dlg = new DlgEditHost( h ); DialogResult dr = dlg.ShowDialog( this ); if (dr == System.Windows.Forms.DialogResult.OK) { if (h.IsValid()) { _AddHost(h); } else { // Re open the edit window InsertNewHost(h); } } }