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:
bao-qian
2016-03-28 03:09:57 +01:00
parent c596039453
commit b22a4501cc
36 changed files with 402 additions and 343 deletions

View File

@@ -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)