mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Use new api function to open application
This commit is contained in:
parent
100c21a83e
commit
fc53efd6a6
1 changed files with 5 additions and 27 deletions
|
|
@ -208,38 +208,16 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
|
||||
private void Launch(bool elevated = false)
|
||||
{
|
||||
var info = new ProcessStartInfo
|
||||
if (Main.IsAdmin && elevated)
|
||||
{
|
||||
FileName = FullPath,
|
||||
WorkingDirectory = ParentDirectory,
|
||||
UseShellExecute = true,
|
||||
Verb = elevated ? "runas" : "",
|
||||
};
|
||||
|
||||
if (Main.IsAdmin)
|
||||
{
|
||||
if (elevated)
|
||||
// Since we are already elevated, we need to create UAC dialog manually
|
||||
if (UACDialog.Show(IcoPath, Name, FullPath) != MessageBoxResult.Yes)
|
||||
{
|
||||
// Since we are already elevated, we need to create UAC dialog manually
|
||||
if (UACDialog.Show(IcoPath, Name, FullPath) != MessageBoxResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use explorer.exe as workaround to start process as standard user
|
||||
info = new ProcessStartInfo
|
||||
{
|
||||
FileName = "explorer.exe",
|
||||
Arguments = $"\"{FullPath}\"",
|
||||
WorkingDirectory = ParentDirectory,
|
||||
UseShellExecute = true,
|
||||
};
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_ = Task.Run(() => Main.StartProcess(Process.Start, info)).ConfigureAwait(false);
|
||||
_ = Task.Run(() => Main.Context.API.StartProcess(FullPath, ParentDirectory, "", elevated)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public List<Result> ContextMenus(IPublicAPI api)
|
||||
|
|
|
|||
Loading…
Reference in a new issue