mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #107 from jjw24/add_programplugin_hidewhenrunasadmin
For Program plugin hide context menu immediately after selected run as administrator
This commit is contained in:
commit
b08c1eeaa9
3 changed files with 18 additions and 13 deletions
|
|
@ -191,22 +191,19 @@ namespace Wox.Plugin.Program
|
|||
);
|
||||
}
|
||||
|
||||
public static bool StartProcess(Func<ProcessStartInfo, Process> runProcess, ProcessStartInfo info)
|
||||
public static void StartProcess(Func<ProcessStartInfo, Process> runProcess, ProcessStartInfo info)
|
||||
{
|
||||
bool hide;
|
||||
try
|
||||
{
|
||||
runProcess(info);
|
||||
hide = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
var name = "Plugin: Program";
|
||||
var message = $"Can't start: {info.FileName}";
|
||||
var message = $"Unable to start: {info.FileName}";
|
||||
_context.API.ShowMsg(name, message, string.Empty);
|
||||
hide = false;
|
||||
}
|
||||
return hide;
|
||||
}
|
||||
|
||||
public void ReloadData()
|
||||
|
|
|
|||
|
|
@ -319,11 +319,14 @@ namespace Wox.Plugin.Program.Programs
|
|||
new Result
|
||||
{
|
||||
Title = api.GetTranslation("wox_plugin_program_open_containing_folder"),
|
||||
|
||||
Action = _ =>
|
||||
{
|
||||
var hide = Main.StartProcess(Process.Start, new ProcessStartInfo(Package.Location));
|
||||
return hide;
|
||||
Main.StartProcess(Process.Start, new ProcessStartInfo(Package.Location));
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
IcoPath = "Images/folder.png"
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -64,8 +64,10 @@ namespace Wox.Plugin.Program.Programs
|
|||
FileName = FullPath,
|
||||
WorkingDirectory = ParentDirectory
|
||||
};
|
||||
var hide = Main.StartProcess(Process.Start, info);
|
||||
return hide;
|
||||
|
||||
Main.StartProcess(Process.Start, info);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -119,8 +121,10 @@ namespace Wox.Plugin.Program.Programs
|
|||
WorkingDirectory = ParentDirectory,
|
||||
Verb = "runas"
|
||||
};
|
||||
var hide = Main.StartProcess(Process.Start, info);
|
||||
return hide;
|
||||
|
||||
Task.Run(() => Main.StartProcess(Process.Start, info));
|
||||
|
||||
return true;
|
||||
},
|
||||
IcoPath = "Images/cmd.png"
|
||||
},
|
||||
|
|
@ -129,8 +133,9 @@ namespace Wox.Plugin.Program.Programs
|
|||
Title = api.GetTranslation("wox_plugin_program_open_containing_folder"),
|
||||
Action = _ =>
|
||||
{
|
||||
var hide = Main.StartProcess(Process.Start, new ProcessStartInfo(ParentDirectory));
|
||||
return hide;
|
||||
Main.StartProcess(Process.Start, new ProcessStartInfo(ParentDirectory));
|
||||
|
||||
return true;
|
||||
},
|
||||
IcoPath = "Images/folder.png"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue