private void BtnVarEditClick(object sender, EventArgs e) { var listViewItem = ((ServerVariableListViewItem)lvVariables.SelectedItems[0]); var dialog = new AddServerVariableDialog(ServiceProvider, listViewItem.Item); if (dialog.ShowDialog() != DialogResult.OK) { return; } listViewItem.Update(); InformChanges(); }
private void BtnVarAddClick(object sender, EventArgs e) { using (var dialog = new AddServerVariableDialog(ServiceProvider, null)) { if (dialog.ShowDialog() != DialogResult.OK) { return; } var newItem = dialog.Item; Rule.ServerVariables.Add(newItem); var listViewItem = new ServerVariableListViewItem(newItem); lvVariables.Items.Add(listViewItem); listViewItem.Selected = true; } InformChanges(); }