コード例 #1
0
        /// <summary>
        /// The exit-with-save button saves the exclusion before closing the window
        /// </summary>
        private void Button_ExitWithSave_Click(object sender, EventArgs e)
        {
            switch (ValidateEntry())
            {
            case ErrorType.DUPLICATE:
                error = new ErrorPrompt(Errors.ERR_DUPL_EXCPTN);
                error.ShowDialog();
                break;

            case ErrorType.MISSING:
                error = new ErrorPrompt(Errors.ERR_MISSING_EXCPTN);
                error.ShowDialog();
                break;

            case ErrorType.VALID:
            default:
                if (isAdding)
                {
                    parent.CreateExclusion(Textbox_Name.Text, Checkbox_IsRecursive.Checked);
                }
                else
                {
                    parent.UpdatedEditedExclusion(Textbox_Name.Text, Checkbox_IsRecursive.Checked);
                }

                Close();
                break;
            }
        }