mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
Migrate files from Wox to PowerLauncher (#5014)
* Moved all files from Wox to Powerlauncher * Removed Wox project * Changed namespace for imported files * Resolved errors for VM * Added build dependency order * Fixed errors in helper class * Remove Wox files * Fixed errors in SingleInstance class * Fixed wox.tests * Fixed MSI * Removed obsolete methods from PublicAPI * nit fixes * Throw null exception * Fix merge conflict
This commit is contained in:
committed by
GitHub
parent
177546bab6
commit
c85cd4ac24
37
src/modules/launcher/PowerLauncher/Storage/QueryHistory.cs
Normal file
37
src/modules/launcher/PowerLauncher/Storage/QueryHistory.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace PowerLauncher.Storage
|
||||
{
|
||||
public class QueryHistory
|
||||
{
|
||||
public List<HistoryItem> Items { get; } = new List<HistoryItem>();
|
||||
|
||||
private int _maxHistory = 300;
|
||||
|
||||
public void Add(string query)
|
||||
{
|
||||
if (string.IsNullOrEmpty(query)) return;
|
||||
if (Items.Count > _maxHistory)
|
||||
{
|
||||
Items.RemoveAt(0);
|
||||
}
|
||||
|
||||
if (Items.Count > 0 && Items.Last().Query == query)
|
||||
{
|
||||
Items.Last().ExecutedDateTime = DateTime.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
Items.Add(new HistoryItem
|
||||
{
|
||||
Query = query,
|
||||
ExecutedDateTime = DateTime.Now
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user