From 7611b002873d33e2054f3f4122ddfb8c875d471b Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Thu, 22 May 2025 21:46:27 +0800 Subject: [PATCH] Add new restart api --- Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs | 6 ++++++ Flow.Launcher/PublicAPIInstance.cs | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs index cb60251ed..b30454277 100644 --- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs +++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs @@ -33,6 +33,12 @@ namespace Flow.Launcher.Plugin /// void RestartApp(); + /// + /// Restart Flow Launcher with arguments + /// + /// Application start arguments + void RestartApp(string arguments); + /// /// Run a shell command /// diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index 66e11f881..751e38c42 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -11,7 +11,6 @@ using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; using System.Windows; -using System.Windows.Input; using System.Windows.Media; using CommunityToolkit.Mvvm.DependencyInjection; using Flow.Launcher.Core; @@ -73,8 +72,10 @@ namespace Flow.Launcher _mainVM.ChangeQueryText(query, requery); } + public void RestartApp() => RestartApp(null); + [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "")] - public async void RestartApp() + public async void RestartApp(string arguments) { _mainVM.Hide(); @@ -89,7 +90,7 @@ namespace Flow.Launcher // Restart requires Squirrel's Update.exe to be present in the parent folder, // it is only published from the project's release pipeline. When debugging without it, // the project may not restart or just terminates. This is expected. - UpdateManager.RestartApp(Constant.ApplicationFileName); + UpdateManager.RestartApp(Constant.ApplicationFileName, arguments); } public void ShowMainWindow() => _mainVM.Show();