private void PContainer_Click(object sender, EventArgs e) { if (this.itemSelected != null) { this.itemSelected.Deselect(); this.itemSelected = null; this.bEdit.Enabled = false; this.bRemove.Enabled = false; } }
void Item_ItemSelected(object sender, EventArgs e) { if (this.itemSelected != (VariableListViewItem)sender) { if (this.itemSelected != null) { this.itemSelected.Deselect(); } this.itemSelected = (VariableListViewItem)sender; this.bEdit.Enabled = true; this.bRemove.Enabled = true; } }
private void VariablesForm_Load(object sender, EventArgs e) { foreach (Variable variable in GraphManager.Project.Variables) { VariableListViewItem item = new VariableListViewItem(variable); item.Size = new Size(this.pItems.Width - 2, 18); item.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; item.ItemSelected += new EventHandler(Item_ItemSelected); this.variables.Add(variable.Name, item); this.pItems.Controls.Add(item); } this.UpdateItems(); }
private void BNew_Click(object sender, EventArgs e) { NewVariableForm newVariableForm = new NewVariableForm(); if (DialogResult.OK == newVariableForm.ShowDialog()) { GraphManager.AddVariable(newVariableForm.VariableCreated); VariableListViewItem item = new VariableListViewItem(newVariableForm.VariableCreated); item.Size = new Size(this.pItems.Width - 2, 18); item.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; item.ItemSelected += new EventHandler(Item_ItemSelected); this.variables.Add(newVariableForm.VariableCreated.Name, item); this.pItems.Controls.Add(item); this.UpdateItems(); } }
private void BRemove_Click(object sender, EventArgs e) { if (GraphManager.RemoveVariable(this.itemSelected.Text)) { this.pItems.Controls.Remove(itemSelected); this.variables.Remove(itemSelected.Text); this.UpdateItems(); this.itemSelected = null; this.bEdit.Enabled = false; this.bRemove.Enabled = false; } else { MowayMessageBox.Show(VariablesMessages.VARIABLE_IN_USE, VariablesMessages.DELETE_VARIABLE, MessageBoxButtons.OK, MessageBoxIcon.Error); } }