Skip to content

Commit 534a111

Browse files
committed
Use public api to call ShowMsgBox functions & remove useless Core project import
1 parent 9b75acd commit 534a111

File tree

15 files changed

+38
-55
lines changed

15 files changed

+38
-55
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using Mages.Core;
88
using Flow.Launcher.Plugin.Calculator.ViewModels;
99
using Flow.Launcher.Plugin.Calculator.Views;
10-
using Flow.Launcher.Core;
1110

1211
namespace Flow.Launcher.Plugin.Calculator
1312
{
@@ -101,7 +100,7 @@ public List<Result> Query(Query query)
101100
}
102101
catch (ExternalException)
103102
{
104-
MessageBoxEx.Show("Copy failed, please try later");
103+
Context.API.ShowMsgBox("Copy failed, please try later");
105104
return false;
106105
}
107106
}

Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using System.Linq;
1212
using Flow.Launcher.Plugin.Explorer.Helper;
1313
using Flow.Launcher.Plugin.Explorer.ViewModels;
14-
using Flow.Launcher.Core;
1514

1615
namespace Flow.Launcher.Plugin.Explorer
1716
{
@@ -174,7 +173,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
174173
{
175174
try
176175
{
177-
if (MessageBoxEx.Show(
176+
if (Context.API.ShowMsgBox(
178177
string.Format(Context.API.GetTranslation("plugin_explorer_delete_folder_link"), record.FullPath),
179178
string.Empty,
180179
MessageBoxButton.YesNo,

Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingDownloadHelper.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Droplex;
2-
using Flow.Launcher.Core;
32
using Flow.Launcher.Plugin.SharedCommands;
43
using Microsoft.Win32;
54
using System;
@@ -21,7 +20,7 @@ public static async Task<string> PromptDownloadIfNotInstallAsync(string installe
2120

2221
if (string.IsNullOrEmpty(installedLocation))
2322
{
24-
if (MessageBoxEx.Show(
23+
if (api.ShowMsgBox(
2524
string.Format(api.GetTranslation("flowlauncher_plugin_everything_installing_select"), Environment.NewLine),
2625
api.GetTranslation("flowlauncher_plugin_everything_installing_title"),
2726
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
@@ -52,7 +51,7 @@ public static async Task<string> PromptDownloadIfNotInstallAsync(string installe
5251

5352
installedLocation = "C:\\Program Files\\Everything\\Everything.exe";
5453

55-
FilesFolders.OpenPath(installedLocation, MessageBoxEx.Show);
54+
FilesFolders.OpenPath(installedLocation, api.ShowMsgBox);
5655

5756
return installedLocation;
5857

Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55
using System.IO;
66
using System.Linq;
77
using System.Threading.Tasks;
8-
using System.Windows;
98
using Flow.Launcher.Plugin.Explorer.Search.Everything;
109
using System.Windows.Input;
1110
using Path = System.IO.Path;
1211
using System.Windows.Controls;
1312
using Flow.Launcher.Plugin.Explorer.Views;
1413
using Peter;
15-
using Flow.Launcher.Core;
1614

1715
namespace Flow.Launcher.Plugin.Explorer.Search
1816
{
@@ -124,7 +122,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string
124122
}
125123
catch (Exception ex)
126124
{
127-
MessageBoxEx.Show(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
125+
Context.API.ShowMsgBox(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
128126
return false;
129127
}
130128
}
@@ -138,7 +136,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string
138136
}
139137
catch (Exception ex)
140138
{
141-
MessageBoxEx.Show(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
139+
Context.API.ShowMsgBox(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
142140
return false;
143141
}
144142
}
@@ -153,7 +151,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string
153151
}
154152
catch (Exception ex)
155153
{
156-
MessageBoxEx.Show(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
154+
Context.API.ShowMsgBox(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
157155
return false;
158156
}
159157
}
@@ -316,7 +314,7 @@ internal static Result CreateFileResult(string filePath, Query query, int score
316314
}
317315
catch (Exception ex)
318316
{
319-
MessageBoxEx.Show(ex.Message, Context.API.GetTranslation("plugin_explorer_openfile_error"));
317+
Context.API.ShowMsgBox(ex.Message, Context.API.GetTranslation("plugin_explorer_openfile_error"));
320318
}
321319

322320
return true;
@@ -338,7 +336,7 @@ private static bool IsMedia(string extension)
338336
private static void OpenFile(string filePath, string workingDir = "", bool asAdmin = false)
339337
{
340338
IncrementEverythingRunCounterIfNeeded(filePath);
341-
FilesFolders.OpenFile(filePath, MessageBoxEx.Show, workingDir, asAdmin);
339+
FilesFolders.OpenFile(filePath, Context.API.ShowMsgBox, workingDir, asAdmin);
342340
}
343341

344342
private static void OpenFolder(string folderPath, string fileNameOrFilePath = null)

Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#nullable enable
2-
using Flow.Launcher.Core;
32
using Flow.Launcher.Plugin.Explorer.Search;
43
using Flow.Launcher.Plugin.Explorer.Search.Everything;
54
using Flow.Launcher.Plugin.Explorer.Search.Everything.Exceptions;
@@ -358,7 +357,7 @@ private void EditLink(object commandParameter)
358357
private void ShowUnselectedMessage()
359358
{
360359
var warning = Context.API.GetTranslation("plugin_explorer_make_selection_warning");
361-
MessageBoxEx.Show(warning);
360+
Context.API.ShowMsgBox(warning);
362361
}
363362

364363

Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Runtime.CompilerServices;
44
using System.Windows;
55
using System.Windows.Input;
6-
using Flow.Launcher.Core;
76

87
namespace Flow.Launcher.Plugin.Explorer.Views
98
{
@@ -63,10 +62,10 @@ private void OnDoneButtonClick(object sender, RoutedEventArgs e)
6362
switch (CurrentActionKeyword.KeywordProperty, KeywordEnabled)
6463
{
6564
case (Settings.ActionKeyword.FileContentSearchActionKeyword, true):
66-
MessageBoxEx.Show(api.GetTranslation("plugin_explorer_globalActionKeywordInvalid"));
65+
api.ShowMsgBox(api.GetTranslation("plugin_explorer_globalActionKeywordInvalid"));
6766
return;
6867
case (Settings.ActionKeyword.QuickAccessActionKeyword, true):
69-
MessageBoxEx.Show(api.GetTranslation("plugin_explorer_quickaccess_globalActionKeywordInvalid"));
68+
api.ShowMsgBox(api.GetTranslation("plugin_explorer_quickaccess_globalActionKeywordInvalid"));
7069
return;
7170
}
7271

@@ -78,7 +77,7 @@ private void OnDoneButtonClick(object sender, RoutedEventArgs e)
7877
}
7978

8079
// The keyword is not valid, so show message
81-
MessageBoxEx.Show(api.GetTranslation("newActionKeywordsHasBeenAssigned"));
80+
api.ShowMsgBox(api.GetTranslation("newActionKeywordsHasBeenAssigned"));
8281
}
8382

8483
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)

Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using Flow.Launcher.Core;
2-
using Flow.Launcher.Core.ExternalPlugins;
1+
using Flow.Launcher.Core.ExternalPlugins;
32
using Flow.Launcher.Core.Plugin;
43
using Flow.Launcher.Infrastructure;
54
using Flow.Launcher.Infrastructure.Http;
@@ -132,7 +131,7 @@ internal async Task InstallOrUpdateAsync(UserPlugin plugin)
132131
Environment.NewLine);
133132
}
134133

135-
if (MessageBoxEx.Show(message, Context.API.GetTranslation("plugin_pluginsmanager_install_title"),
134+
if (Context.API.ShowMsgBox(message, Context.API.GetTranslation("plugin_pluginsmanager_install_title"),
136135
MessageBoxButton.YesNo) == MessageBoxResult.No)
137136
return;
138137

@@ -266,7 +265,7 @@ where string.Compare(existingPlugin.Metadata.Version, pluginUpdateSource.Version
266265
Environment.NewLine);
267266
}
268267

269-
if (MessageBoxEx.Show(message,
268+
if (Context.API.ShowMsgBox(message,
270269
Context.API.GetTranslation("plugin_pluginsmanager_update_title"),
271270
MessageBoxButton.YesNo) != MessageBoxResult.Yes)
272271
{
@@ -361,7 +360,7 @@ await Http.DownloadAsync(x.PluginNewUserPlugin.UrlDownload, downloadToFilePath)
361360
resultsForUpdate.Count());
362361
}
363362

364-
if (MessageBoxEx.Show(message,
363+
if (Context.API.ShowMsgBox(message,
365364
Context.API.GetTranslation("plugin_pluginsmanager_update_title"),
366365
MessageBoxButton.YesNo) == MessageBoxResult.No)
367366
{
@@ -475,7 +474,7 @@ internal List<Result> InstallFromWeb(string url)
475474
if (Settings.WarnFromUnknownSource)
476475
{
477476
if (!InstallSourceKnown(plugin.UrlDownload)
478-
&& MessageBoxEx.Show(string.Format(
477+
&& Context.API.ShowMsgBox(string.Format(
479478
Context.API.GetTranslation("plugin_pluginsmanager_install_unknown_source_warning"),
480479
Environment.NewLine),
481480
Context.API.GetTranslation(
@@ -512,7 +511,7 @@ internal List<Result> InstallFromLocalPath(string localPath)
512511
if (Settings.WarnFromUnknownSource)
513512
{
514513
if (!InstallSourceKnown(plugin.Website)
515-
&& MessageBoxEx.Show(string.Format(
514+
&& Context.API.ShowMsgBox(string.Format(
516515
Context.API.GetTranslation(
517516
"plugin_pluginsmanager_install_unknown_source_warning"),
518517
Environment.NewLine),
@@ -649,7 +648,7 @@ internal List<Result> RequestUninstall(string search)
649648
Environment.NewLine);
650649
}
651650

652-
if (MessageBoxEx.Show(message,
651+
if (Context.API.ShowMsgBox(message,
653652
Context.API.GetTranslation("plugin_pluginsmanager_uninstall_title"),
654653
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
655654
{

Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Windows;
2-
using Flow.Launcher.Core;
32
using Flow.Launcher.Plugin.Program.ViewModels;
43

54
namespace Flow.Launcher.Plugin.Program
@@ -33,7 +32,7 @@ private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
3332
var (modified, msg) = ViewModel.AddOrUpdate();
3433
if (modified == false && msg != null)
3534
{
36-
MessageBoxEx.Show(msg); // Invalid
35+
ViewModel.API.ShowMsgBox(msg); // Invalid
3736
return;
3837
}
3938
DialogResult = modified;

Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
</ItemGroup>
5555

5656
<ItemGroup>
57-
<ProjectReference Include="..\..\Flow.Launcher.Core\Flow.Launcher.Core.csproj" />
5857
<ProjectReference Include="..\..\Flow.Launcher.Infrastructure\Flow.Launcher.Infrastructure.csproj" />
5958
<ProjectReference Include="..\..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
6059
</ItemGroup>

Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Windows;
4-
using Flow.Launcher.Core;
54

65
namespace Flow.Launcher.Plugin.Program
76
{
@@ -40,14 +39,14 @@ private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
4039
if (suffixes.Length == 0 && UseCustomSuffixes)
4140
{
4241
string warning = context.API.GetTranslation("flowlauncher_plugin_program_suffixes_cannot_empty");
43-
MessageBoxEx.Show(warning);
42+
context.API.ShowMsgBox(warning);
4443
return;
4544
}
4645

4746
if (protocols.Length == 0 && UseCustomProtocols)
4847
{
4948
string warning = context.API.GetTranslation("flowlauncher_plugin_protocols_cannot_empty");
50-
MessageBoxEx.Show(warning);
49+
context.API.ShowMsgBox(warning);
5150
return;
5251
}
5352

0 commit comments

Comments
 (0)