Improve process information handler

This commit is contained in:
Jack251970 2025-06-13 14:13:52 +08:00
parent 50a8e888f0
commit d56f0a0d1a
2 changed files with 31 additions and 6 deletions

View file

@ -71,18 +71,43 @@ internal static class Program
try
{
using var process = new Process
ProcessStartInfo info;
if (argumentList.Count == 0)
{
StartInfo = new ProcessStartInfo
info = new ProcessStartInfo
{
FileName = fileName,
WorkingDirectory = workingDirectory,
Arguments = string.Join(" ", argumentList),
UseShellExecute = useShellExecute,
Verb = verb
};
}
else if (argumentList.Count == 1)
{
info = new ProcessStartInfo
{
FileName = fileName,
WorkingDirectory = workingDirectory,
Arguments = argumentList[0],
UseShellExecute = useShellExecute,
Verb = verb
};
}
else
{
info = new ProcessStartInfo
{
FileName = fileName,
WorkingDirectory = workingDirectory,
UseShellExecute = useShellExecute,
Verb = verb
};
foreach (var arg in argumentList)
{
info.ArgumentList.Add(arg);
}
};
process.Start();
}
Process.Start(info)?.Dispose();
Console.WriteLine("Success.");
return 0;
}

View file

@ -389,7 +389,7 @@ namespace Flow.Launcher.Plugin.Shell
return true;
}
private void OnWinRPressed()
private static void OnWinRPressed()
{
Context.API.ShowMainWindow();
// show the main window and set focus to the query box