void colAttribute_Clicked(object sender, MouseEventArgs e) { SelectedType = SelectedTypes.Attribute; ColumnItem col = (ColumnItem)sender; CustomAttribute ca = EntitySet.CustomAttributes.First(a => a.RawName == col.Text); if (e.Button == MouseButtons.Left) { FormAttributeEditor form = new FormAttributeEditor(ca.RawName, ca.RawArgumentString, ca.AutoAddToEntities); if (form.ShowDialog(this) == DialogResult.OK) { if (col.Text != ca.RawName) { ca.RawName = form.RawName; ca.RawArgumentString = form.RawArgumentString; ca.AutoAddToEntities = form.AutoAddToEntities; PopulateEntitiesGrid(); } } } else if (e.Button == MouseButtons.Right) { Point pt = this.PointToScreen(e.Location); SelectedAttribute = col.Text; contextMenuStrip1.Show(pt); } }
public void AddNewAttribute() { FormAttributeEditor form = new FormAttributeEditor("", "", true); if (form.ShowDialog(this) == DialogResult.OK) { CustomAttribute ca = new CustomAttribute(form.RawName, form.RawArgumentString); ca.AutoAddToEntities = form.AutoAddToEntities; EntitySet.AddCustomAttribute(ca, 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()); } }
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()); } }