Skip to content

Commit 676a5b1

Browse files
committed
add defaults to MessageBoxEx Show & update WebSearch to use api call
1 parent 57cbe10 commit 676a5b1

File tree

4 files changed

+10
-27
lines changed

4 files changed

+10
-27
lines changed

Flow.Launcher.Core/MessageBoxEx.xaml.cs

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,15 @@ private MessageBoxEx(MessageBoxButton button)
2222
InitializeComponent();
2323
}
2424

25-
/// 1 parameter
2625
public static MessageBoxResult Show(string messageBoxText)
27-
{
28-
return Show(messageBoxText, string.Empty, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
29-
}
30-
31-
// 2 parameter
32-
public static MessageBoxResult Show(string messageBoxText, string caption)
33-
{
34-
return Show(messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
35-
}
36-
37-
/// 3 parameter
38-
public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button)
39-
{
40-
return Show(messageBoxText, caption, button, MessageBoxImage.None, MessageBoxResult.OK);
41-
}
42-
43-
// 4 parameter
44-
public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon)
45-
{
46-
return Show(messageBoxText, caption, button, icon, MessageBoxResult.OK);
47-
}
26+
=> Show(messageBoxText, string.Empty, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
4827

49-
// 5 parameter, Final Display Message.
50-
public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult)
28+
public static MessageBoxResult Show(
29+
string messageBoxText,
30+
string caption = "",
31+
MessageBoxButton button = MessageBoxButton.OK,
32+
MessageBoxImage icon = MessageBoxImage.None,
33+
MessageBoxResult defaultResult = MessageBoxResult.OK)
5134
{
5235
if (!Application.Current.Dispatcher.CheckAccess())
5336
{

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public interface IPublicAPI
301301
public void ReQuery(bool reselect = true);
302302

303303
/// <summary>
304-
/// Displays a message box like <see cref="System.Windows.MessageBox"/>
304+
/// Displays a standardised Flow message box.
305305
/// </summary>
306306
/// <param name="messageBoxText">The message of the message box.</param>
307307
/// <param name="caption">The caption of the message box.</param>

Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Flow.Launcher.Plugin.WebSearch
1313
{
1414
public class Main : IAsyncPlugin, ISettingProvider, IPluginI18n, IResultUpdated
1515
{
16-
private PluginInitContext _context;
16+
internal static PluginInitContext _context;
1717

1818
private Settings _settings;
1919
private SettingsViewModel _viewModel;

Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void CopyNewImageToUserDataDirectoryIfRequired(
4141
#if DEBUG
4242
throw;
4343
#else
44-
Flow.Launcher.Core.MessageBoxEx.Show(string.Format("Copying the selected image file to {0} has failed, changes will now be reverted", destinationFileNameFullPath));
44+
Main._context.API.ShowMsgBox(string.Format("Copying the selected image file to {0} has failed, changes will now be reverted", destinationFileNameFullPath));
4545
UpdateIconAttributes(selectedSearchSource, fullPathToOriginalImage);
4646
#endif
4747
}

0 commit comments

Comments
 (0)