Add ShowMsgBox functions in public api

This commit is contained in:
Jack251970 2024-11-27 10:07:03 +08:00
parent 7ba8d58bfc
commit 9b75acdf21
2 changed files with 91 additions and 0 deletions

View file

@ -7,6 +7,7 @@ using System.IO;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
namespace Flow.Launcher.Plugin
{
@ -298,5 +299,81 @@ 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.
/// </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);
}
}

View file

@ -25,6 +25,7 @@ using Flow.Launcher.Infrastructure.Storage;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Collections.Specialized;
using Flow.Launcher.Core;
namespace Flow.Launcher
{
@ -318,6 +319,19 @@ 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) =>
MessageBoxEx.Show(messageBoxText, caption, button, icon, defaultResult);
#endregion
#region Private Methods