void colImplement_Clicked(object sender, MouseEventArgs e) { SelectedType = SelectedTypes.Implement; ColumnItem col = (ColumnItem)sender; CustomImplement ci = EntitySet.CustomImplements.First(n => n.Value == col.Text); if (e.Button == MouseButtons.Left) { Input.Text = ci.Value; Input.AutoAddToEntities = ci.AutoAddToEntities; Input.DisplayName = "Base name:"; if (Input.ShowDialog(this) == DialogResult.OK) { if (col.Text != Input.Text) { ci.Value = Input.Text; ci.AutoAddToEntities = Input.AutoAddToEntities; PopulateEntitiesGrid(); } } } else if (e.Button == MouseButtons.Right) { Point pt = this.PointToScreen(e.Location); SelectedImplement = col.Text; contextMenuStrip1.Show(pt); } }
public void AddNewBaseName() { Input.Text = ""; Input.AutoAddToEntities = true; Input.DisplayName = "Base name:"; if (Input.ShowDialog(this) == DialogResult.OK) { CustomImplement ci = new CustomImplement(Input.Text); ci.AutoAddToEntities = Input.AutoAddToEntities; EntitySet.AddCustomImplement(ci, true); PopulateEntitiesGrid(); } }
private void mnuEditNamespace_Click(object sender, EventArgs e) { switch (SelectedType) { case SelectedTypes.Namespace: CustomNamespace ns = EntitySet.CustomNamespaces.First(n => n.Value == SelectedNamespace); Input.Text = ns.Value; Input.AutoAddToEntities = ns.AutoAddToEntities; if (Input.ShowDialog(this) == DialogResult.OK) { if (SelectedNamespace != Input.Text) { ns.Value = Input.Text; ns.AutoAddToEntities = Input.AutoAddToEntities; PopulateEntitiesGrid(); } } break; case SelectedTypes.Implement: CustomImplement ci = EntitySet.CustomImplements.First(n => n.Value == SelectedImplement); Input.Text = ci.Value; Input.AutoAddToEntities = ci.AutoAddToEntities; if (Input.ShowDialog(this) == DialogResult.OK) { if (SelectedImplement != Input.Text) { ci.Value = Input.Text; ci.AutoAddToEntities = Input.AutoAddToEntities; PopulateEntitiesGrid(); } } break; case SelectedTypes.Attribute: CustomAttribute ca = EntitySet.CustomAttributes.First(n => n.RawName == SelectedAttribute); FormAttributeEditor form = new FormAttributeEditor(ca.RawName, ca.RawArgumentString, ca.AutoAddToEntities); if (form.ShowDialog(this) == DialogResult.OK) { if (ca.RawName != form.RawName || ca.RawArgumentString != form.RawArgumentString || ca.AutoAddToEntities != form.AutoAddToEntities) { ca.RawName = form.RawName; ca.RawArgumentString = form.RawArgumentString; ca.AutoAddToEntities = form.AutoAddToEntities; PopulateEntitiesGrid(); } } break; case SelectedTypes.Property: CustomProperty cp = EntitySet.CustomProperties.First(n => n.Name == SelectedProperty); FormCodeInput.FillData(cp); if (FormCodeInput.ShowDialog(this) == DialogResult.OK) { PopulateEntitiesGrid(); } break; case SelectedTypes.Function: CustomFunction cm = EntitySet.CustomFunctions.First(n => n.Name == SelectedFunction); FormCodeInput.FillData(cm); if (FormCodeInput.ShowDialog(this) == DialogResult.OK) { PopulateEntitiesGrid(); } break; default: throw new NotImplementedException("Type not handled yet: " + SelectedType.ToString()); } }
void slyceGridEntities_CellValueChanged(int row, int cell, int column, string columnHeader, ref object tag, object newValue) { if (slyceGridEntities.Columns[column].Tag is CustomNamespace) { CustomNamespace ns = (CustomNamespace)slyceGridEntities.Columns[column].Tag; Entity entity = (Entity)slyceGridEntities.Items[row].Tag; bool isChecked = (bool)newValue; if (isChecked) { ns.Entities.Add(entity); } else { ns.Entities.Remove(entity); } } else if (slyceGridEntities.Columns[column].Tag is CustomImplement) { CustomImplement ci = (CustomImplement)slyceGridEntities.Columns[column].Tag; Entity entity = (Entity)slyceGridEntities.Items[row].Tag; bool isChecked = (bool)newValue; if (isChecked) { ci.Entities.Add(entity); } else { ci.Entities.Remove(entity); } } else if (slyceGridEntities.Columns[column].Tag is CustomAttribute) { CustomAttribute ca = (CustomAttribute)slyceGridEntities.Columns[column].Tag; Entity entity = (Entity)slyceGridEntities.Items[row].Tag; bool isChecked = (bool)newValue; if (isChecked) { ca.Entities.Add(entity); } else { ca.Entities.Remove(entity); } } else if (slyceGridEntities.Columns[column].Tag is CustomProperty) { CustomProperty cp = (CustomProperty)slyceGridEntities.Columns[column].Tag; Entity entity = (Entity)slyceGridEntities.Items[row].Tag; bool isChecked = (bool)newValue; if (isChecked) { cp.Entities.Add(entity); } else { cp.Entities.Remove(entity); } } else if (slyceGridEntities.Columns[column].Tag is CustomFunction) { CustomFunction cm = (CustomFunction)slyceGridEntities.Columns[column].Tag; Entity entity = (Entity)slyceGridEntities.Items[row].Tag; bool isChecked = (bool)newValue; if (isChecked) { cm.Entities.Add(entity); } else { cm.Entities.Remove(entity); } } }