/// <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(MessageBoxBA msgBox, string response) { if (msgBox.Name == null) { return; } _savedResponses[msgBox.Name] = response; }
/// <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)) { MessageBoxBA msgBox = _messageBoxes[name] as MessageBoxBA; msgBox.Dispose(); _messageBoxes.Remove(name); } }
/// <summary> /// Creates a new message box with the specified name. If null is specified /// in the message name then the message box is not managed by the Manager and /// will be disposed automatically after a call to Show() /// </summary> /// <param name="name">The name of the message box</param> /// <returns>A new message box</returns> /// public static MessageBoxBA CreateMessageBox(string name) { if (name != null && _messageBoxes.ContainsKey(name)) { string err = string.Format("A MessageBox with the name {0} already exists.", name); throw new ArgumentException(err, "name"); } MessageBoxBA msgBox = new MessageBoxBA(); msgBox.Name = name; if (msgBox.Name != null) { _messageBoxes[name] = msgBox; } return(msgBox); }
/// <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(MessageBoxBA msgBox) { string msgBoxName = msgBox.Name; if (msgBoxName == null) { return(null); } if (_savedResponses.ContainsKey(msgBoxName)) { return(_savedResponses[msgBox.Name].ToString()); } else { return(null); } }