mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-22 17:13:07 +08:00
program lock bug
This commit is contained in:
parent
09c7955149
commit
132d0631d2
@ -68,19 +68,25 @@ namespace Wox.Plugin.Program
|
|||||||
|
|
||||||
public List<Result> Query(Query query)
|
public List<Result> Query(Query query)
|
||||||
{
|
{
|
||||||
|
Win32[] win32;
|
||||||
|
UWP.Application[] uwps;
|
||||||
|
|
||||||
lock (IndexLock)
|
lock (IndexLock)
|
||||||
{
|
{ // just take the reference inside the lock to eliminate query time issues.
|
||||||
var results1 = _win32s.AsParallel()
|
win32 = _win32s;
|
||||||
.Where(p => p.Enabled)
|
uwps = _uwps;
|
||||||
.Select(p => p.Result(query.Search, _context.API));
|
|
||||||
|
|
||||||
var results2 = _uwps.AsParallel()
|
|
||||||
.Where(p => p.Enabled)
|
|
||||||
.Select(p => p.Result(query.Search, _context.API));
|
|
||||||
|
|
||||||
var result = results1.Concat(results2).Where(r => r.Score > 0).ToList();
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var results1 = win32.AsParallel()
|
||||||
|
.Where(p => p.Enabled)
|
||||||
|
.Select(p => p.Result(query.Search, _context.API));
|
||||||
|
|
||||||
|
var results2 = uwps.AsParallel()
|
||||||
|
.Where(p => p.Enabled)
|
||||||
|
.Select(p => p.Result(query.Search, _context.API));
|
||||||
|
|
||||||
|
var result = results1.Concat(results2).Where(r => r != null && r.Score > 0).ToList();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Init(PluginInitContext context)
|
public void Init(PluginInitContext context)
|
||||||
|
@ -276,11 +276,17 @@ namespace Wox.Plugin.Program.Programs
|
|||||||
|
|
||||||
public Result Result(string query, IPublicAPI api)
|
public Result Result(string query, IPublicAPI api)
|
||||||
{
|
{
|
||||||
|
var score = Score(query);
|
||||||
|
if (score <= 0)
|
||||||
|
{ // no need to create result if score is 0
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var result = new Result
|
var result = new Result
|
||||||
{
|
{
|
||||||
SubTitle = Package.Location,
|
SubTitle = Package.Location,
|
||||||
Icon = Logo,
|
Icon = Logo,
|
||||||
Score = Score(query),
|
Score = score,
|
||||||
ContextData = this,
|
ContextData = this,
|
||||||
Action = e =>
|
Action = e =>
|
||||||
{
|
{
|
||||||
|
@ -45,11 +45,17 @@ namespace Wox.Plugin.Program.Programs
|
|||||||
|
|
||||||
public Result Result(string query, IPublicAPI api)
|
public Result Result(string query, IPublicAPI api)
|
||||||
{
|
{
|
||||||
|
var score = Score(query);
|
||||||
|
if (score <= 0)
|
||||||
|
{ // no need to create result if this is zero
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var result = new Result
|
var result = new Result
|
||||||
{
|
{
|
||||||
SubTitle = FullPath,
|
SubTitle = FullPath,
|
||||||
IcoPath = IcoPath,
|
IcoPath = IcoPath,
|
||||||
Score = Score(query),
|
Score = score,
|
||||||
ContextData = this,
|
ContextData = this,
|
||||||
Action = e =>
|
Action = e =>
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user