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(); InitializeComponent();
} }
/// 1 parameter
public static MessageBoxResult Show(string messageBoxText) public static MessageBoxResult Show(string messageBoxText)
{ => Show(messageBoxText, string.Empty, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
return Show(messageBoxText, string.Empty, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
}
// 2 parameter public static MessageBoxResult Show(
public static MessageBoxResult Show(string messageBoxText, string caption) string messageBoxText,
{ string caption = "",
return Show(messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK); MessageBoxButton button = MessageBoxButton.OK,
} MessageBoxImage icon = MessageBoxImage.None,
MessageBoxResult defaultResult = 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)
{ {
if (!Application.Current.Dispatcher.CheckAccess()) if (!Application.Current.Dispatcher.CheckAccess())
{ {

View file

@ -301,7 +301,7 @@ namespace Flow.Launcher.Plugin
public void ReQuery(bool reselect = true); public void ReQuery(bool reselect = true);
/// <summary> /// <summary>
/// Displays a message box like <see cref="System.Windows.MessageBox"/> /// Displays a standardised Flow message box.
/// </summary> /// </summary>
/// <param name="messageBoxText">The message of the message box.</param> /// <param name="messageBoxText">The message of the message box.</param>
/// <param name="caption">The caption 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 public class Main : IAsyncPlugin, ISettingProvider, IPluginI18n, IResultUpdated
{ {
private PluginInitContext _context; internal static PluginInitContext _context;
private Settings _settings; private Settings _settings;
private SettingsViewModel _viewModel; private SettingsViewModel _viewModel;

View file

@ -41,7 +41,7 @@ namespace Flow.Launcher.Plugin.WebSearch
#if DEBUG #if DEBUG
throw; throw;
#else #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); UpdateIconAttributes(selectedSearchSource, fullPathToOriginalImage);
#endif #endif
} }