updated user selected record

This commit is contained in:
AT 2019-12-03 23:37:55 +02:00
parent c90dd0e818
commit b3fdc4bb96

View File

@ -12,21 +12,23 @@ namespace Wox.Storage
public void Add(Result result) public void Add(Result result)
{ {
if (records.ContainsKey(result.ToString())) var key = result.ToString();
if (records.TryGetValue(key, out int value))
{ {
records[result.ToString()] += 1; records[key] = value + 1;
} }
else else
{ {
records.Add(result.ToString(), 1); records.Add(key, 1);
} }
} }
public int GetSelectedCount(Result result) public int GetSelectedCount(Result result)
{ {
if (records.ContainsKey(result.ToString())) if (records.TryGetValue(result.ToString(), out int value))
{ {
return records[result.ToString()]; return value;
} }
return 0; return 0;
} }