/// <summary> /// Add a new DisplaySet item and opens the edit scenario /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddItem_Click(object sender, EventArgs e) { // Only custom DisplaySets can be modified if (SelectedDisplaySet == null || !SelectedDisplaySet.Custom) { return; } try { List <string> agents = new List <string>(); agents.Add(Logics.Logic.Agent.ClassName); DisplaySetItem item = new DisplaySetItem("", "", "", ModelType.String, agents, 0, true); SelectedDisplaySet.DisplaySetItems.Add(item); EditDisplaySetItemForm form = new EditDisplaySetItemForm(); form.Initialize(item); if (form.ShowDialog() != DialogResult.OK) { SelectedDisplaySet.DisplaySetItems.Remove(item); return; } } catch { } ShowDisplaySetItems(SelectedDisplaySet); gridItems.Rows[gridItems.Rows.Count - 1].Selected = true; }
/// <summary> /// Edit the selected row in the grid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GridCell_DoubleClick(object sender, DataGridViewCellEventArgs e) { // Only custom DisplaySets can be modified if (SelectedDisplaySet == null || !SelectedDisplaySet.Custom) { return; } int itemIndex = e.RowIndex; try { DisplaySetItem item = SelectedDisplaySet.DisplaySetItems[itemIndex]; EditDisplaySetItemForm form = new EditDisplaySetItemForm(); form.Initialize(item); if (form.ShowDialog() != DialogResult.OK) { return; } } catch { } ShowDisplaySetItems(SelectedDisplaySet); gridItems.Rows[itemIndex].Selected = true; }
/// <summary> /// Edit the selected row in the grid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GridCell_DoubleClick(object sender, DataGridViewCellEventArgs e) { // Only custom DisplaySets can be modified if (SelectedDisplaySet == null || !SelectedDisplaySet.Custom) return; int itemIndex = e.RowIndex; try { DisplaySetItem item = SelectedDisplaySet.DisplaySetItems[itemIndex]; EditDisplaySetItemForm form = new EditDisplaySetItemForm(); form.Initialize(item); if (form.ShowDialog() != DialogResult.OK) return; } catch { } ShowDisplaySetItems(SelectedDisplaySet); gridItems.Rows[itemIndex].Selected = true; }
/// <summary> /// Add a new DisplaySet item and opens the edit scenario /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddItem_Click(object sender, EventArgs e) { // Only custom DisplaySets can be modified if (SelectedDisplaySet == null || !SelectedDisplaySet.Custom) return; try { List<string> agents = new List<string>(); agents.Add(Logics.Logic.Agent.ClassName); DisplaySetItem item = new DisplaySetItem("", "", "", ModelType.String, agents, 0, true); SelectedDisplaySet.DisplaySetItems.Add(item); EditDisplaySetItemForm form = new EditDisplaySetItemForm(); form.Initialize(item); if (form.ShowDialog() != DialogResult.OK) { SelectedDisplaySet.DisplaySetItems.Remove(item); return; } } catch { } ShowDisplaySetItems(SelectedDisplaySet); gridItems.Rows[gridItems.Rows.Count - 1].Selected = true; }