mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
code refactoring and add web searches setting window.
This commit is contained in:
47
WinAlfred/Models/UserSelectedRecords.cs
Normal file
47
WinAlfred/Models/UserSelectedRecords.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using WinAlfred.Helper;
|
||||
using WinAlfred.Plugin;
|
||||
|
||||
namespace WinAlfred.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class UserSelectedRecords
|
||||
{
|
||||
private static int hasAddedCount = 0;
|
||||
|
||||
public Dictionary<string,int> Records = new Dictionary<string, int>();
|
||||
|
||||
public void Add(Result result)
|
||||
{
|
||||
if (Records.ContainsKey(result.ToString()))
|
||||
{
|
||||
Records[result.ToString()] += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Records.Add(result.ToString(), 1);
|
||||
}
|
||||
|
||||
//hasAddedCount++;
|
||||
//if (hasAddedCount == 10)
|
||||
//{
|
||||
// hasAddedCount = 0;
|
||||
//}
|
||||
CommonStorage.Instance.Save();
|
||||
|
||||
}
|
||||
|
||||
public int GetSelectedCount(Result result)
|
||||
{
|
||||
if (Records.ContainsKey(result.ToString()))
|
||||
{
|
||||
return Records[result.ToString()];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
WinAlfred/Models/UserSetting.cs
Normal file
14
WinAlfred/Models/UserSetting.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace WinAlfred.Models
|
||||
{
|
||||
public class UserSetting
|
||||
{
|
||||
public string Theme { get; set; }
|
||||
public bool ReplaceWinR { get; set; }
|
||||
public List<WebSearch> WebSearches { get; set; }
|
||||
}
|
||||
}
|
||||
10
WinAlfred/Models/WebSearch.cs
Normal file
10
WinAlfred/Models/WebSearch.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace WinAlfred.Models
|
||||
{
|
||||
public class WebSearch
|
||||
{
|
||||
public string Keyword { get; set; }
|
||||
public string IconPath { get; set; }
|
||||
public string Website { get; set; }
|
||||
public string Enabled { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user