Combine ShowMsgBox into one function.

This commit is contained in:
Jack251970 2024-12-01 19:55:07 +08:00
parent 0d362b30dd
commit b568d2dd95
2 changed files with 9 additions and 84 deletions

View file

@ -299,81 +299,16 @@ namespace Flow.Launcher.Plugin
/// </summary>
/// <param name="reselect">Choose the first result after reload if true; keep the last selected result if false. Default is true.</param>
public void ReQuery(bool reselect = true);
/// <summary>
/// Displays a message box that has a message and that returns a result.
/// </summary>
/// <param name="messageBoxText">A System.String that specifies the text to display.</param>
/// <returns>
/// A System.Windows.MessageBoxResult value that specifies which message box button
/// is clicked by the user.
/// </returns>
public MessageBoxResult ShowMsgBox(string messageBoxText);
/// <summary>
/// Displays a message box that has a message and title bar caption; and that returns
/// a result.
/// Displays a message box like <see cref="System.Windows.MessageBox"/>
/// </summary>
/// <param name="messageBoxText">A System.String that specifies the text to display.</param>
/// <param name="caption">A System.String that specifies the title bar caption to display.</param>
/// <returns>
/// A System.Windows.MessageBoxResult value that specifies which message box button
/// is clicked by the user.
/// </returns>
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption);
/// <summary>
/// Displays a message box that has a message, title bar caption, and button; and
/// that returns a result.
/// </summary>
/// <param name="messageBoxText">A System.String that specifies the text to display.</param>
/// <param name="caption">A System.String that specifies the title bar caption to display.</param>
/// <param name="button">
/// A System.Windows.MessageBoxButton value that specifies which button or buttons
/// to display.
/// </param>
/// <returns>
/// A System.Windows.MessageBoxResult value that specifies which message box button
/// is clicked by the user.
/// </returns>
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption, MessageBoxButton button);
/// <summary>
/// Displays a message box that has a message, title bar caption, button, and icon;
/// and that returns a result.
/// </summary>
/// <param name="messageBoxText">A System.String that specifies the text to display.</param>
/// <param name="caption">A System.String that specifies the title bar caption to display.</param>
/// <param name="button">
/// A System.Windows.MessageBoxButton value that specifies which button or buttons
/// to display.
/// </param>
/// <param name="icon">A System.Windows.MessageBoxImage value that specifies the icon to display.</param>
/// <returns>
/// A System.Windows.MessageBoxResult value that specifies which message box button
/// is clicked by the user.
/// </returns>
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon);
/// <summary>
/// Displays a message box that has a message, title bar caption, button, and icon;
/// and that accepts a default message box result and returns a result.
/// </summary>
/// <param name="messageBoxText">A System.String that specifies the text to display.</param>
/// <param name="caption">A System.String that specifies the title bar caption to display.</param>
/// <param name="button">
/// A System.Windows.MessageBoxButton value that specifies which button or buttons
/// to display.
/// </param>
/// <param name="icon">A System.Windows.MessageBoxImage value that specifies the icon to display.</param>
/// <param name="defaultResult">
/// A System.Windows.MessageBoxResult value that specifies the default result of
/// the message box.
/// </param>
/// <returns>
/// A System.Windows.MessageBoxResult value that specifies which message box button
/// is clicked by the user.
/// </returns>
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult);
/// <param name="messageBoxText">The message of the message box.</param>
/// <param name="caption">The caption of the message box.</param>
/// <param name="button">Specifies which button or buttons to display.</param>
/// <param name="icon">Specifies the icon to display.</param>
/// <param name="defaultResult">Specifies the default result of the message box.</param>
/// <returns>Specifies which message box button is clicked by the user.</returns>
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.OK);
}
}

View file

@ -319,17 +319,7 @@ namespace Flow.Launcher
public void ReQuery(bool reselect = true) => _mainVM.ReQuery(reselect);
public MessageBoxResult ShowMsgBox(string messageBoxText) => MessageBoxEx.Show(messageBoxText);
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption) => MessageBoxEx.Show(messageBoxText, caption);
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption, MessageBoxButton button) =>
MessageBoxEx.Show(messageBoxText, caption, button);
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon) =>
MessageBoxEx.Show(messageBoxText, caption, button, icon);
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult) =>
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.OK) =>
MessageBoxEx.Show(messageBoxText, caption, button, icon, defaultResult);
#endregion