mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
Use variable instead of global static method
1. introduce variable 2. part of #389 3. refactoring program suffix in program plugin 4. 全局变量一时爽,代码重构火葬场
This commit is contained in:
@@ -20,12 +20,20 @@ namespace Wox.ViewModel
|
||||
private Thickness _margin;
|
||||
|
||||
private readonly object _resultsUpdateLock = new object();
|
||||
private UserSettingStorage _settings;
|
||||
private TopMostRecordStorage _topMostRecord;
|
||||
|
||||
public ResultsViewModel(UserSettingStorage settings, TopMostRecordStorage topMostRecord)
|
||||
{
|
||||
_settings = settings;
|
||||
_topMostRecord = topMostRecord;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ViewModel Properties
|
||||
|
||||
public int MaxHeight => UserSettingStorage.Instance.MaxResultsToShow * 50;
|
||||
public int MaxHeight => _settings.MaxResultsToShow * 50;
|
||||
|
||||
public ResultViewModel SelectedResult
|
||||
{
|
||||
@@ -75,7 +83,7 @@ namespace Wox.ViewModel
|
||||
|
||||
private bool IsTopMostResult(Result result)
|
||||
{
|
||||
return TopMostRecordStorage.Instance.IsTopMost(result);
|
||||
return _topMostRecord.IsTopMost(result);
|
||||
}
|
||||
|
||||
private int InsertIndexOf(int newScore, IList<ResultViewModel> list)
|
||||
|
||||
Reference in New Issue
Block a user