private void AddButton_Click(object sender, EventArgs e) { var newValues = HostsItemForm.ShowDialog(this.ParentForm); if (newValues == null) { return; } hosts.Add(string.Join("\t", newValues)); File.WriteAllLines(path, hosts); HostsPageView_Load(null, null); }
private void EditButton_Click(object sender, EventArgs e) { var item = listView.SelectedItems[0]; if (item?.Tag is int i) { var newValues = HostsItemForm.ShowDialog(this.ParentForm, item.SubItems[0].Text, item.SubItems[1].Text); if (newValues == null) { return; } hosts[i] = string.Join("\t", newValues); File.WriteAllLines(path, hosts); HostsPageView_Load(null, null); } }