Skip to content

Commit 20ffff6

Browse files
committed
Use api to call api functions
1 parent 7cccbb0 commit 20ffff6

10 files changed

+19
-17
lines changed

Flow.Launcher/ActionKeywords.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private void btnDone_OnClick(object sender, RoutedEventArgs _)
4444
else
4545
{
4646
string msg = translater.GetTranslation("newActionKeywordsHasBeenAssigned");
47-
MessageBoxEx.Show(msg);
47+
App.API.ShowMsgBox(msg);
4848
}
4949
}
5050
}

Flow.Launcher/App.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@
1515
using Flow.Launcher.Infrastructure.Image;
1616
using Flow.Launcher.Infrastructure.Logger;
1717
using Flow.Launcher.Infrastructure.UserSettings;
18+
using Flow.Launcher.Plugin;
1819
using Flow.Launcher.ViewModel;
1920
using Stopwatch = Flow.Launcher.Infrastructure.Stopwatch;
2021

2122
namespace Flow.Launcher
2223
{
23-
public partial class App : IDisposable, ISingleInstanceApp
24+
public partial class App : IDisposable, ISingleInstanceApp, IApp
2425
{
26+
public IPublicAPI PublicAPI => API;
2527
public static PublicAPIInstance API { get; private set; }
2628
private const string Unique = "Flow.Launcher_Unique_Application_Mutex";
2729
private static bool _disposed;

Flow.Launcher/CustomQueryHotkeySetting.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void UpdateItem(CustomPluginHotkey item)
6363
o.ActionKeyword == item.ActionKeyword && o.Hotkey == item.Hotkey);
6464
if (updateCustomHotkey == null)
6565
{
66-
MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation("invalidPluginHotkey"));
66+
App.API.ShowMsgBox(InternationalizationManager.Instance.GetTranslation("invalidPluginHotkey"));
6767
Close();
6868
return;
6969
}

Flow.Launcher/CustomShortcutSetting.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
4343
{
4444
if (String.IsNullOrEmpty(Key) || String.IsNullOrEmpty(Value))
4545
{
46-
MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation("emptyShortcut"));
46+
App.API.ShowMsgBox(InternationalizationManager.Instance.GetTranslation("emptyShortcut"));
4747
return;
4848
}
4949
// Check if key is modified or adding a new one
5050
if (((update && originalKey != Key) || !update) && _hotkeyVm.DoesShortcutExist(Key))
5151
{
52-
MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation("duplicateShortcut"));
52+
App.API.ShowMsgBox(InternationalizationManager.Instance.GetTranslation("duplicateShortcut"));
5353
return;
5454
}
5555
DialogResult = !update || originalKey != Key || originalValue != Value;

Flow.Launcher/Helper/HotKeyMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ internal static void SetHotkey(HotkeyModel hotkey, EventHandler<HotkeyEventArgs>
4646
{
4747
string errorMsg = string.Format(InternationalizationManager.Instance.GetTranslation("registerHotkeyFailed"), hotkeyStr);
4848
string errorMsgTitle = InternationalizationManager.Instance.GetTranslation("MessageBoxTitle");
49-
MessageBoxEx.Show(errorMsg, errorMsgTitle);
49+
App.API.ShowMsgBox(errorMsg, errorMsgTitle);
5050
}
5151
}
5252

Flow.Launcher/PriorityChangeWindow.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public PriorityChangeWindow(string pluginId, PluginViewModel pluginViewModel)
2424
this.pluginViewModel = pluginViewModel;
2525
if (plugin == null)
2626
{
27-
MessageBoxEx.Show(translater.GetTranslation("cannotFindSpecifiedPlugin"));
27+
App.API.ShowMsgBox(translater.GetTranslation("cannotFindSpecifiedPlugin"));
2828
Close();
2929
}
3030
}
@@ -44,7 +44,7 @@ private void btnDone_OnClick(object sender, RoutedEventArgs e)
4444
else
4545
{
4646
string msg = translater.GetTranslation("invalidPriority");
47-
MessageBoxEx.Show(msg);
47+
App.API.ShowMsgBox(msg);
4848
}
4949

5050
}

Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private void OpenWelcomeWindow()
6262
[RelayCommand]
6363
private void AskClearLogFolderConfirmation()
6464
{
65-
var confirmResult = MessageBoxEx.Show(
65+
var confirmResult = App.API.ShowMsgBox(
6666
InternationalizationManager.Instance.GetTranslation("clearlogfolderMessage"),
6767
InternationalizationManager.Instance.GetTranslation("clearlogfolder"),
6868
MessageBoxButton.YesNo

Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ private void CustomHotkeyDelete()
4242
var item = SelectedCustomPluginHotkey;
4343
if (item is null)
4444
{
45-
MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
45+
App.API.ShowMsgBox(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
4646
return;
4747
}
4848

49-
var result = MessageBoxEx.Show(
49+
var result = App.API.ShowMsgBox(
5050
string.Format(
5151
InternationalizationManager.Instance.GetTranslation("deleteCustomHotkeyWarning"), item.Hotkey
5252
),
@@ -67,7 +67,7 @@ private void CustomHotkeyEdit()
6767
var item = SelectedCustomPluginHotkey;
6868
if (item is null)
6969
{
70-
MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
70+
App.API.ShowMsgBox(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
7171
return;
7272
}
7373

@@ -88,11 +88,11 @@ private void CustomShortcutDelete()
8888
var item = SelectedCustomShortcut;
8989
if (item is null)
9090
{
91-
MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
91+
App.API.ShowMsgBox(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
9292
return;
9393
}
9494

95-
var result = MessageBoxEx.Show(
95+
var result = App.API.ShowMsgBox(
9696
string.Format(
9797
InternationalizationManager.Instance.GetTranslation("deleteCustomShortcutWarning"), item.Key, item.Value
9898
),
@@ -112,7 +112,7 @@ private void CustomShortcutEdit()
112112
var item = SelectedCustomShortcut;
113113
if (item is null)
114114
{
115-
MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
115+
App.API.ShowMsgBox(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
116116
return;
117117
}
118118

Flow.Launcher/SettingPages/ViewModels/SettingsPaneProxyViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public SettingsPaneProxyViewModel(Settings settings, Updater updater)
2222
private void OnTestProxyClicked()
2323
{
2424
var message = TestProxy();
25-
MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation(message));
25+
App.API.ShowMsgBox(InternationalizationManager.Instance.GetTranslation(message));
2626
}
2727

2828
private string TestProxy()

Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public bool DropShadowEffect
4949
{
5050
if (ThemeManager.Instance.BlurEnabled && value)
5151
{
52-
MessageBoxEx.Show(InternationalizationManager.Instance.GetTranslation("shadowEffectNotAllowed"));
52+
App.API.ShowMsgBox(InternationalizationManager.Instance.GetTranslation("shadowEffectNotAllowed"));
5353
return;
5454
}
5555

0 commit comments

Comments
 (0)