mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[PTRun]Add history plugin (#19569)
* Progress! * Progress... * POC level. * Added ability to delete from history using IPublicAPI * Some sorting, works in some cases. * Rename "Run History" back to just "History". * Updated item from review. * Slight change to PowerLauncher ref, set Copy Local = False * Fixed missing history items if added to history without search term. * Added placeholder unit test project * Updates for new History plugin. * Update Product.wxs, removed useless Unit Test project * Removed actual files for "Microsoft.PowerToys.Run.Plugin.History.UnitTests" * Added history.md, updated ESRPSigning_core.json * Changes for review * Removed now global CodeAnalysis/stylecop
This commit is contained in:
@@ -266,6 +266,16 @@ namespace PowerLauncher.ViewModel
|
||||
sorted = Results.OrderByDescending(x => (x.Result.Metadata.WeightBoost + x.Result.Score + (x.Result.SelectedCount * 5))).ToList();
|
||||
}
|
||||
|
||||
// remove history items in they are in the list as non-history items
|
||||
foreach (var nonHistoryResult in sorted.Where(x => x.Result.Metadata.Name != "History").ToList())
|
||||
{
|
||||
var historyToRemove = sorted.FirstOrDefault(x => x.Result.Metadata.Name == "History" && x.Result.Title == nonHistoryResult.Result.Title && x.Result.SubTitle == nonHistoryResult.Result.SubTitle);
|
||||
if (historyToRemove != null)
|
||||
{
|
||||
sorted.Remove(historyToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
Clear();
|
||||
Results.AddRange(sorted);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user