Example #1
0
        /// <exception cref="BadSyntaxException">
        /// The <paramref name="text"/> does not fit to the syntax.
        /// </exception>
        /// <exception cref="ReservedNameException">
        /// The <paramref name="text"/> contains a reserved name.
        /// </exception>
        protected override void AddToList(string text)
        {
            var command = new AddEnumMemberCommand(parent, text);

            command.Execute();
            diagram.TrackCommand(command);

            var value = command.EnumValue;
            var item  = lstItems.Items.Add(value.ToString());

            item.Tag        = value;
            item.ImageIndex = Icons.EnumItemImageIndex;
        }
Example #2
0
 private void AddNewValue()
 {
     if (!noNewValue && ValidateName())
     {
         try
         {
             var command = new AddEnumMemberCommand(shape.EnumType, txtNewValue.Text);
             command.Execute();
             shape.Diagram.TrackCommand(command);
             ClearNewValueField();
         }
         catch (BadSyntaxException ex)
         {
             SetError(ex.Message);
         }
     }
 }