public AddMenuItemForm(SourceModMenuItem item)
            : this()
        {
            this.item = item;

            itemNameTextBox.Text = item.ItemName;
            displayNameTextBox.Text = item.DisplayName;

            if ((item.DrawRules & SourceModMenuItem.ItemDraw.Disabled) == SourceModMenuItem.ItemDraw.Disabled)
            {
                disabledCheckBox.Checked = true;
            }

            if ((item.DrawRules & SourceModMenuItem.ItemDraw.RawLine) == SourceModMenuItem.ItemDraw.RawLine)
            {
                rawLineCheckBox.Checked = true;
            }

            if ((item.DrawRules & SourceModMenuItem.ItemDraw.NoText) == SourceModMenuItem.ItemDraw.NoText)
            {
                noTextCheckBox.Checked = true;
            }

            if ((item.DrawRules & SourceModMenuItem.ItemDraw.Spacer) == SourceModMenuItem.ItemDraw.Spacer)
            {
                spacerCheckBox.Checked = true;
            }

            this.Text = "Edit Menu Item";
            addEditButton.Text = "Edit";
        }
        private void addEditButton_Click(object sender, EventArgs e)
        {
            if (item == null)
            {
                item = new SourceModMenuItem();
            }

            var errorList = new StringBuilder();

            errorProvider1.Clear();

            if (string.IsNullOrEmpty(displayNameTextBox.Text))
            {
                errorProvider1.SetError(displayNameTextBox, "Display Name must be set");
                errorList.AppendLine("Display Name must be set");
            }

            if (string.IsNullOrEmpty(itemNameTextBox.Text))
            {
                errorProvider1.SetError(itemNameTextBox, "Item Name must be set");
                errorList.AppendLine("Item Name must be set");
            }

            if (errorList.Length > 0)
            {
                MessageBox.Show(errorList.ToString(), "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            item.ItemName = itemNameTextBox.Text;
            item.DisplayName = displayNameTextBox.Text;

            item.DrawRules = SourceModMenuItem.ItemDraw.Default;

            if (disabledCheckBox.Checked)
            {
                item.DrawRules |= SourceModMenuItem.ItemDraw.Disabled;
            }

            if (rawLineCheckBox.Checked)
            {
                item.DrawRules |= SourceModMenuItem.ItemDraw.RawLine;
            }

            if (noTextCheckBox.Checked)
            {
                item.DrawRules |= SourceModMenuItem.ItemDraw.NoText;
            }

            if (spacerCheckBox.Checked)
            {
                item.DrawRules |= SourceModMenuItem.ItemDraw.Spacer;
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }