mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 11:16:51 +02:00
fix #151 Add context menu for programs
This commit is contained in:
@@ -42,6 +42,31 @@ namespace Wox.Plugin.SystemPlugins.Program
|
||||
context.API.HideApp();
|
||||
context.API.ShellRun(c.ExecutePath);
|
||||
return true;
|
||||
},
|
||||
ContextMenu = new List<Result>()
|
||||
{
|
||||
new Result()
|
||||
{
|
||||
Title = "Open",
|
||||
Action = _ =>
|
||||
{
|
||||
context.API.HideApp();
|
||||
context.API.ShellRun(c.ExecutePath);
|
||||
return true;
|
||||
},
|
||||
IcoPath = "Images/open.png"
|
||||
},
|
||||
new Result()
|
||||
{
|
||||
Title = "Open With Administrator",
|
||||
Action = _ =>
|
||||
{
|
||||
context.API.HideApp();
|
||||
context.API.ShellRun(c.ExecutePath,true);
|
||||
return true;
|
||||
},
|
||||
IcoPath = "Images/cmd.png"
|
||||
}
|
||||
}
|
||||
}).ToList();
|
||||
}
|
||||
@@ -84,11 +109,11 @@ namespace Wox.Plugin.SystemPlugins.Program
|
||||
Type sourceClass;
|
||||
if (SourceTypes.TryGetValue(source.Type, out sourceClass))
|
||||
{
|
||||
ConstructorInfo constructorInfo = sourceClass.GetConstructor(new[] {typeof (ProgramSource)});
|
||||
ConstructorInfo constructorInfo = sourceClass.GetConstructor(new[] { typeof(ProgramSource) });
|
||||
if (constructorInfo != null)
|
||||
{
|
||||
IProgramSource programSource =
|
||||
constructorInfo.Invoke(new object[] {source}) as IProgramSource;
|
||||
constructorInfo.Invoke(new object[] { source }) as IProgramSource;
|
||||
sources.Add(programSource);
|
||||
}
|
||||
}
|
||||
@@ -106,7 +131,7 @@ namespace Wox.Plugin.SystemPlugins.Program
|
||||
}
|
||||
|
||||
// filter duplicate program
|
||||
tempPrograms = tempPrograms.GroupBy(x => new {x.ExecutePath, x.ExecuteName})
|
||||
tempPrograms = tempPrograms.GroupBy(x => new { x.ExecutePath, x.ExecuteName })
|
||||
.Select(g => g.First()).ToList();
|
||||
|
||||
programs = tempPrograms;
|
||||
|
||||
Reference in New Issue
Block a user