Prefer injected Context over static Main.Context

This commit is contained in:
Jack251970 2025-06-15 12:29:05 +08:00
parent 39de484d2d
commit 44b25b487a

View file

@ -347,8 +347,6 @@ namespace Flow.Launcher.Plugin.Explorer
};
}
private Result CreateOpenWithEditorResult(SearchResult record, string editorPath)
{
var name = $"{Context.API.GetTranslation("plugin_explorer_openwitheditor")} {Path.GetFileNameWithoutExtension(editorPath)}";
@ -360,7 +358,7 @@ namespace Flow.Launcher.Plugin.Explorer
{
try
{
Main.Context.API.StartProcess(editorPath, arguments: record.FullPath);
Context.API.StartProcess(editorPath, arguments: record.FullPath);
return true;
}
catch (Exception e)
@ -390,7 +388,7 @@ namespace Flow.Launcher.Plugin.Explorer
{
try
{
Main.Context.API.StartProcess(shellPath, workingDirectory: record.FullPath, arguments: string.Empty);
Context.API.StartProcess(shellPath, workingDirectory: record.FullPath, arguments: string.Empty);
return true;
}
catch (Exception e)