private void Create(NewAttributeWindow window, bool close = true) { try { this.attributesVM.CreateAttribute(this.Name, this.Type, this.IsMultivalued, this.Operation, this.IsIndexable, this.IsIndexed); if (close) { window.Close(); } else { this.Name = null; this.Type = ExtendedAttributeType.String; this.IsIndexed = false; this.IsIndexable = true; this.IsMultivalued = false; window.AttributeName.Focus(); } } catch (Exception ex) { MessageBox.Show("Could not create the attribute\n\n" + ex.Message); } }
public void AddAttribute() { NewAttributeWindow window = new NewAttributeWindow(); NewAcmaSchemaAttributeViewModel vm = new NewAcmaSchemaAttributeViewModel(window, this); window.DataContext = vm; window.ShowDialog(); }
public NewAcmaSchemaAttributeViewModel(NewAttributeWindow window, AcmaSchemaAttributesViewModel attributesVM) : base() { this.attributesVM = attributesVM; this.Name = null; this.Commands.AddItem("Create", t => this.Create(window), t => this.CanCreate()); this.Commands.AddItem("CreateAndAddNew", t => this.CreateAndAddNew(window), t => this.CanCreate()); this.Type = ExtendedAttributeType.String; this.IsIndexable = true; this.IsIndexableAllowed = true; this.IsMultivaluedAllowed = true; this.ConfigureForAttributeType(); }
private void CreateAndAddNew(NewAttributeWindow window) { this.Create(window, false); }