From 0a8963b74ee05da73afbcd05d9e817925c79477b Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Wed, 9 Apr 2025 21:16:33 +0800 Subject: [PATCH] Remove Notification.Show & _mainViewModel.Show(); --- Flow.Launcher/App.xaml.cs | 2 +- Flow.Launcher/Helper/HotKeyMapper.cs | 2 +- .../SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs | 6 ++---- Flow.Launcher/ViewModel/MainViewModel.cs | 3 +-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs index 90fefe0a6..89faa105e 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -343,7 +343,7 @@ namespace Flow.Launcher public void OnSecondAppStarted() { - Ioc.Default.GetRequiredService().Show(); + API.ShowMainWindow(); } #endregion diff --git a/Flow.Launcher/Helper/HotKeyMapper.cs b/Flow.Launcher/Helper/HotKeyMapper.cs index de5f5295b..b7b39ff31 100644 --- a/Flow.Launcher/Helper/HotKeyMapper.cs +++ b/Flow.Launcher/Helper/HotKeyMapper.cs @@ -136,7 +136,7 @@ internal static class HotKeyMapper if (_mainViewModel.ShouldIgnoreHotkeys()) return; - _mainViewModel.Show(); + App.API.ShowMainWindow(); _mainViewModel.ChangeQueryText(hotkey.ActionKeyword, true); }); } diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs index 57eb796d3..069a7cb24 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs @@ -60,8 +60,7 @@ public partial class SettingsPaneGeneralViewModel : BaseModel } catch (Exception e) { - Notification.Show(App.API.GetTranslation("setAutoStartFailed"), - e.Message); + App.API.ShowMsg(App.API.GetTranslation("setAutoStartFailed"), e.Message); } } } @@ -88,8 +87,7 @@ public partial class SettingsPaneGeneralViewModel : BaseModel } catch (Exception e) { - Notification.Show(App.API.GetTranslation("setAutoStartFailed"), - e.Message); + App.API.ShowMsg(App.API.GetTranslation("setAutoStartFailed"), e.Message); } } } diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 66481cad6..4a6c1d639 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -16,7 +16,6 @@ using CommunityToolkit.Mvvm.Input; using Flow.Launcher.Core.Plugin; using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.Hotkey; -using Flow.Launcher.Infrastructure.Image; using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.Storage; using Flow.Launcher.Infrastructure.UserSettings; @@ -275,7 +274,7 @@ namespace Flow.Launcher.ViewModel Hide(); await PluginManager.ReloadDataAsync().ConfigureAwait(false); - Notification.Show(App.API.GetTranslation("success"), + App.API.ShowMsg(App.API.GetTranslation("success"), App.API.GetTranslation("completedSuccessfully")); }