Structure used to represent buttons of the FAMessageBox control.
        private void DisableCloseIfMultipleButtonsAndNoCancelButton()
        {
            if (_buttons.Count > 1)
            {
                if (_cancelButton != null)
                {
                    return;
                }

                //See if standard cancel button is present
                foreach (FAMessageBoxButton button in _buttons)
                {
                    if (button.Text == FAMessageBoxButtons.Cancel.ToString() && button.Value == FAMessageBoxButtons.Cancel.ToString())
                    {
                        _cancelButton = button;
                        return;
                    }
                }

                //Standard cancel button is not present, Disable
                //close button
                DisableCloseButton(this);
                _allowCancel = false;
            }
            else if (_buttons.Count == 1)
            {
                _cancelButton = _buttons[0];
            }
            else
            {
                //This condition should never get called
                _allowCancel = false;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Add DrawTab custom button to the message box
        /// </summary>
        /// <param name="button">The button to add</param>
        public void AddButton(FAMessageBoxButton button)
        {
            if (button == null)
            {
                throw new ArgumentNullException("button", "A null button cannot be added");
            }

            _msgBox.Buttons.Add(button);

            if (button.IsCancelButton)
            {
                _msgBox.CustomCancelButton = button;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Add DrawTab custom button to the message box
        /// </summary>
        /// <param name="text">The text of the button</param>
        /// <param name="val">The return value in case this button is clicked</param>
        public void AddButton(string text, string val)
        {
            if (text == null)
            {
                throw new ArgumentNullException("text", "Text of a button cannot be null");
            }

            if (val == null)
            {
                throw new ArgumentNullException("val", "Value of a button cannot be null");
            }

            var button = new FAMessageBoxButton(text, val);

            AddButton(button);
        }
Exemplo n.º 4
0
        private void DisableCloseIfMultipleButtonsAndNoCancelButton()
        {
            if (_buttons.Count > 1)
            {
                if (_cancelButton != null)
                    return;

                //See if standard cancel button is present
                foreach (FAMessageBoxButton button in _buttons)
                {
                    if (button.Text == FAMessageBoxButtons.Cancel.ToString() && button.Value == FAMessageBoxButtons.Cancel.ToString())
                    {
                        _cancelButton = button;
                        return;
                    }
                }

                //Standard cancel button is not present, Disable
                //close button
                DisableCloseButton(this);
                _allowCancel = false;

            }
            else if (_buttons.Count == 1)
            {
                _cancelButton = _buttons[0];
            }
            else
            {
                //This condition should never get called
                _allowCancel = false;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Add DrawTab custom button to the message box
        /// </summary>
        /// <param name="text">The text of the button</param>
        /// <param name="val">The return value in case this button is clicked</param>
        public void AddButton(string text, string val)
        {
            if (text == null)
                throw new ArgumentNullException("text", "Text of a button cannot be null");

            if (val == null)
                throw new ArgumentNullException("val", "Value of a button cannot be null");

            var button = new FAMessageBoxButton(text, val);
            AddButton(button);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Add DrawTab custom button to the message box
        /// </summary>
        /// <param name="button">The button to add</param>
        public void AddButton(FAMessageBoxButton button)
        {
            if (button == null)
                throw new ArgumentNullException("button", "A null button cannot be added");

            _msgBox.Buttons.Add(button);

            if (button.IsCancelButton)
            {
                _msgBox.CustomCancelButton = button;
            }
        }