An extended MessageBox with lot of customizing capabilities.
Inheritance: IDisposable
        /// <summary>
        /// Creates a new <see cref="FAMessageBox"/> with the specified unique name. If null is specified
        /// in the name parameter of the <see cref="FAMessageBox"/> control, the instance is not managed by the Manager and will be 
        /// disposed automatically after call to <see cref="FAMessageBox.Show()"/> method.
        /// Set rtl value to true, if the control is supposed to run a RTL messagebox, else set it to false, or use the overloaded method.
        /// </summary>
        /// <param name="name">The name of the <see cref="FAMessageBox"/> which should be unique.</param>
        /// <param name="rtl">Is the instance has RTL or LTR layout.</param>
        /// <returns>A new message box</returns>
        public static FAMessageBox CreateMessageBox(string name, bool rtl)
        {
            if (string.IsNullOrEmpty(name))
                throw new InvalidOperationException("name can not be empty.");

            FAMessageBox msgBox;

            if (_messageBoxes.ContainsKey(name))
            {
                msgBox = _messageBoxes[name];
                if(msgBox.IsDisposed)
                {
                    DeleteMessageBox(name);
                }
                else
                {
                    return msgBox;
                }
            }

            msgBox = new FAMessageBox(name, rtl);

            if (msgBox.Name != null)
                _messageBoxes[name] = msgBox;

            return msgBox;
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new <see cref="FAMessageBox"/> with the specified unique name. If null is specified
        /// in the name parameter of the <see cref="FAMessageBox"/> control, the instance is not managed by the Manager and will be
        /// disposed automatically after call to <see cref="FAMessageBox.Show()"/> method.
        /// Set rtl value to true, if the control is supposed to run a RTL messagebox, else set it to false, or use the overloaded method.
        /// </summary>
        /// <param name="name">The name of the <see cref="FAMessageBox"/> which should be unique.</param>
        /// <param name="rtl">Is the instance has RTL or LTR layout.</param>
        /// <returns>A new message box</returns>
        public static FAMessageBox CreateMessageBox(string name, bool rtl)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new InvalidOperationException("name can not be empty.");
            }

            FAMessageBox msgBox;

            if (_messageBoxes.ContainsKey(name))
            {
                msgBox = _messageBoxes[name];
                if (msgBox.IsDisposed)
                {
                    DeleteMessageBox(name);
                }
                else
                {
                    return(msgBox);
                }
            }

            msgBox = new FAMessageBox(name, rtl);

            if (msgBox.Name != null)
            {
                _messageBoxes[name] = msgBox;
            }

            return(msgBox);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the saved response for the specified message box
        /// </summary>
        /// <param name="msgBox">The message box whose saved response is to be retrieved</param>
        /// <returns>The saved response if exists, null otherwise</returns>
        internal static string GetSavedResponse(FAMessageBox msgBox)
        {
            string msgBoxName = msgBox.Name;

            if (_savedResponses.ContainsKey(msgBoxName))
            {
                return(_savedResponses[msgBox.Name]);
            }

            return(null);
        }
        /// <summary>
        /// Deletes the message box with the specified name
        /// </summary>
        /// <param name="name">The name of the message box to delete</param>
        public static void DeleteMessageBox(string name)
        {
            if (name == null)
            {
                return;
            }

            if (_messageBoxes.Contains(name))
            {
                FAMessageBox msgBox = _messageBoxes[name] as FAMessageBox;
                msgBox.Dispose();
                _messageBoxes.Remove(name);
            }
        }
        /// <summary>
        /// Creates a new <see cref="FAMessageBox"/> with the specified unique name. If null is specified
        /// in the name parameter of the <see cref="FAMessageBox"/> control, the instance is not managed by the Manager and will be
        /// disposed automatically after call to <see cref="FAMessageBox.Show()"/> method.
        /// Set IsRightToLeft value to true, if the control is supposed to run a RTL messagebox, else set it to false, or use the overloaded method.
        /// </summary>
        /// <param name="name">The name of the <see cref="FAMessageBox"/> which should be unique.</param>
        /// <param name="IsRightToLeft">Is the instance has RTL or LTR layout.</param>
        /// <returns>A new message box</returns>
        public static FAMessageBox CreateMessageBox(string name, bool IsRightToLeft)
        {
            if (name != null && _messageBoxes.ContainsKey(name))
            {
                throw new ArgumentException(string.Format("A MessageBox with the name {0} already exists.", name), "name");
            }

            FAMessageBox msgBox = new FAMessageBox(IsRightToLeft);

            msgBox.Name = name;

            if (msgBox.Name != null)
            {
                _messageBoxes[name] = msgBox;
            }

            return(msgBox);
        }
 /// <summary>
 /// Set the saved response for the specified message box
 /// </summary>
 /// <param name="msgBox">The message box whose response is to be set</param>
 /// <param name="response">The response to save for the message box</param>
 internal static void SetSavedResponse(FAMessageBox msgBox, string response)
 {
     _savedResponses[msgBox.Name] = response;
 }
        /// <summary>
        /// Gets the saved response for the specified message box
        /// </summary>
        /// <param name="msgBox">The message box whose saved response is to be retrieved</param>
        /// <returns>The saved response if exists, null otherwise</returns>
        internal static string GetSavedResponse(FAMessageBox msgBox)
        {
            string msgBoxName = msgBox.Name;
            if (_savedResponses.ContainsKey(msgBoxName))
            {
                return _savedResponses[msgBox.Name];
            }

            return null;
        }
Esempio n. 8
0
 /// <summary>
 /// Set the saved response for the specified message box
 /// </summary>
 /// <param name="msgBox">The message box whose response is to be set</param>
 /// <param name="response">The response to save for the message box</param>
 internal static void SetSavedResponse(FAMessageBox msgBox, string response)
 {
     _savedResponses[msgBox.Name] = response;
 }