Пример #1
0
        /// <summary>
        /// Asks user for the name of a Resource Action
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnBeforeAddResourceAction(object sender, ResourceActionEventArgs e)
        {
            if (!m_controller.AllowPreAddNameChange(e.ResourceAction))
            {
                return;
            }

            StringInputBox sib = null;
            try
            {
                sib = new StringInputBox(Properties.AdminUIResources.ACTION_NAME_ENTRY, Properties.AdminUIResources.GENERAL_CAPTION);
                sib.MaxLength = ResourceListController.ACTION_NAME_MAX_LENGTH;
                sib.CustomValidating += new CancelEventHandler(sib_CustomValidating);

                if (sib.ShowDialog() == DialogResult.OK)
                {
                    e.ResourceAction.Name = sib.Value;
                }
                else
                {
                    e.Cancel = true;
                }
            }
            finally
            {
                if (null != sib)
                {
                    sib.CustomValidating -= new CancelEventHandler(sib_CustomValidating);
                }
            }
        }
Пример #2
0
		private void linkCreateNewCustomProperty_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
		{
            StringInputBox inputBox = null;
            try
            {
                inputBox = new StringInputBox(Properties.AdminUIResources.CUSTOMPROPERTY_NAME, Properties.AdminUIResources.CUSTOMPROPERTY_TITLE);
                inputBox.CustomValidating += inputBox_CustomValidating;
                if (inputBox.ShowDialog() != DialogResult.OK)
                    return;
                m_controller.CreateCustomProperty(inputBox.Value);
            }
            catch (Exception ex)
            {
                ReportError("An error occurred while attempting to add a new custom property", ex);
            }
            finally
            {
                if (null != inputBox)
                {
                    inputBox.CustomValidating -= inputBox_CustomValidating;
                }
            }
		}
Пример #3
0
        /// <summary>
        /// Asks user for an alternate name for a Resource Action
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnDuplicateResourceAction(object sender, ResourceActionEventArgs e)
        {
            StringInputBox sib = null;
            try
            {
                sib = new StringInputBox(Properties.AdminUIResources.ACTION_NAME_EXISTS, Properties.AdminUIResources.GENERAL_CAPTION);
                sib.MaxLength = ResourceListController.ACTION_NAME_MAX_LENGTH;
                sib.Value = e.ResourceAction.Name;
                sib.CustomValidating += new CancelEventHandler(sib_CustomValidating);

                if (sib.ShowDialog() == DialogResult.OK)
                {
                    e.ResourceAction.Name = sib.Value;
                }
                else
                {
                    e.Cancel = true;
                }
            }
            finally
            {
                if (null != sib)
                {
                    sib.CustomValidating -= new CancelEventHandler(sib_CustomValidating);
                }
            }
        }