add defaults to MessageBoxEx Show & update WebSearch to use api call

This commit is contained in:
Jeremy 2024-12-07 22:21:08 +11:00
parent 57cbe10ef0
commit 676a5b1590
4 changed files with 10 additions and 27 deletions

View file

@ -22,32 +22,15 @@ namespace Flow.Launcher.Core
InitializeComponent();
}
/// 1 parameter
public static MessageBoxResult Show(string messageBoxText)
{
return Show(messageBoxText, string.Empty, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
}
=> Show(messageBoxText, string.Empty, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
// 2 parameter
public static MessageBoxResult Show(string messageBoxText, string caption)
{
return Show(messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
}
/// 3 parameter
public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button)
{
return Show(messageBoxText, caption, button, MessageBoxImage.None, MessageBoxResult.OK);
}
// 4 parameter
public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon)
{
return Show(messageBoxText, caption, button, icon, MessageBoxResult.OK);
}
// 5 parameter, Final Display Message.
public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult)
public static MessageBoxResult Show(
string messageBoxText,
string caption = "",
MessageBoxButton button = MessageBoxButton.OK,
MessageBoxImage icon = MessageBoxImage.None,
MessageBoxResult defaultResult = MessageBoxResult.OK)
{
if (!Application.Current.Dispatcher.CheckAccess())
{

View file

@ -301,7 +301,7 @@ namespace Flow.Launcher.Plugin
public void ReQuery(bool reselect = true);
/// <summary>
/// Displays a message box like <see cref="System.Windows.MessageBox"/>
/// Displays a standardised Flow message box.
/// </summary>
/// <param name="messageBoxText">The message of the message box.</param>
/// <param name="caption">The caption of the message box.</param>

View file

@ -13,7 +13,7 @@ namespace Flow.Launcher.Plugin.WebSearch
{
public class Main : IAsyncPlugin, ISettingProvider, IPluginI18n, IResultUpdated
{
private PluginInitContext _context;
internal static PluginInitContext _context;
private Settings _settings;
private SettingsViewModel _viewModel;

View file

@ -41,7 +41,7 @@ namespace Flow.Launcher.Plugin.WebSearch
#if DEBUG
throw;
#else
Flow.Launcher.Core.MessageBoxEx.Show(string.Format("Copying the selected image file to {0} has failed, changes will now be reverted", destinationFileNameFullPath));
Main._context.API.ShowMsgBox(string.Format("Copying the selected image file to {0} has failed, changes will now be reverted", destinationFileNameFullPath));
UpdateIconAttributes(selectedSearchSource, fullPathToOriginalImage);
#endif
}