diff --git a/Wox/MainWindow.xaml b/Wox/MainWindow.xaml index fd00239538..2c7421081f 100644 --- a/Wox/MainWindow.xaml +++ b/Wox/MainWindow.xaml @@ -22,7 +22,7 @@ PreviewKeyDown="Window_PreviewKeyDown" d:DataContext="{d:DesignInstance vm:MainViewModel, IsDesignTimeCreatable=True}"> - + @@ -37,7 +37,7 @@ - + diff --git a/Wox/ResultListBox.xaml b/Wox/ResultListBox.xaml index d4e088186e..890c36cc37 100644 --- a/Wox/ResultListBox.xaml +++ b/Wox/ResultListBox.xaml @@ -1,4 +1,4 @@ - newResults, string resultId) { @@ -24,7 +24,7 @@ namespace Wox } - public ResultPanel() + public ResultListBox() { InitializeComponent(); } diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index 9495da2cb2..2ac62a076e 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -149,7 +149,7 @@ - + diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index f47bbbde3b..ed76e8c523 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -37,7 +37,7 @@ namespace Wox { this._api = api; InitializeComponent(); - this.resultPanelPreview.DataContext = new ResultPanelViewModel(); + this.ResultListBoxPreview.DataContext = new ResultPanelViewModel(); Loaded += Setting_Loaded; } @@ -387,7 +387,7 @@ namespace Wox )); } - resultPanelPreview.AddResults(new List + ResultListBoxPreview.AddResults(new List { new Result { diff --git a/Wox/ViewModel/MainViewModel.cs b/Wox/ViewModel/MainViewModel.cs index e6e5912376..9793a36966 100644 --- a/Wox/ViewModel/MainViewModel.cs +++ b/Wox/ViewModel/MainViewModel.cs @@ -21,11 +21,10 @@ namespace Wox.ViewModel { #region Private Fields - private ResultPanelViewModel _searchResultPanel; private ResultPanelViewModel _actionPanel; private string _queryText; private bool _isVisible; - private bool _isSearchResultPanelVisible; + private bool _isResultListBoxVisible; private bool _isActionPanelVisible; private bool _isProgressBarVisible; private bool _isProgressBarTooltipVisible; @@ -46,7 +45,7 @@ namespace Wox.ViewModel public MainViewModel() { - this.InitializeResultPanel(); + this.InitializeResultListBox(); this.InitializeActionPanel(); this.InitializeKeyCommands(); @@ -57,13 +56,7 @@ namespace Wox.ViewModel #region ViewModel Properties - public ResultPanelViewModel SearchResultPanel - { - get - { - return this._searchResultPanel; - } - } + public ResultPanelViewModel Results { get; private set; } public ResultPanelViewModel ActionPanel { @@ -132,16 +125,16 @@ namespace Wox.ViewModel } } - public bool IsSearchResultPanelVisible + public bool IsResultListBoxVisible { get { - return this._isSearchResultPanelVisible; + return this._isResultListBoxVisible; } set { - this._isSearchResultPanelVisible = value; - OnPropertyChanged("IsSearchResultPanelVisible"); + this._isResultListBoxVisible = value; + OnPropertyChanged("IsResultListBoxVisible"); } } @@ -311,7 +304,7 @@ namespace Wox.ViewModel } else { - this._searchResultPanel.SelectNextResult(); + this.Results.SelectNextResult(); } }); @@ -325,7 +318,7 @@ namespace Wox.ViewModel } else { - this._searchResultPanel.SelectPrevResult(); + this.Results.SelectPrevResult(); } }); @@ -339,7 +332,7 @@ namespace Wox.ViewModel } else { - ShowActionPanel(this._searchResultPanel.SelectedResult.RawResult); + ShowActionPanel(this.Results.SelectedResult.RawResult); } }); @@ -362,14 +355,14 @@ namespace Wox.ViewModel this.SelectNextPageCommand = new RelayCommand((parameter) => { - this._searchResultPanel.SelectNextPage(); + this.Results.SelectNextPage(); }); this.SelectPrevPageCommand = new RelayCommand((parameter) => { - this._searchResultPanel.SelectPrevPage(); + this.Results.SelectPrevPage(); }); @@ -381,9 +374,9 @@ namespace Wox.ViewModel this.ShiftEnterCommand = new RelayCommand((parameter) => { - if (!this.IsActionPanelVisible && null != this._searchResultPanel.SelectedResult) + if (!this.IsActionPanelVisible && null != this.Results.SelectedResult) { - this.ShowActionPanel(this._searchResultPanel.SelectedResult.RawResult); + this.ShowActionPanel(this.Results.SelectedResult.RawResult); } }); @@ -394,12 +387,12 @@ namespace Wox.ViewModel if (null != parameter) { var index = int.Parse(parameter.ToString()); - this._searchResultPanel.SelectResult(index); + this.Results.SelectResult(index); } - if (null != this._searchResultPanel.SelectedResult) + if (null != this.Results.SelectedResult) { - this._searchResultPanel.SelectedResult.OpenResultCommand.Execute(null); + this.Results.SelectedResult.OpenResultCommand.Execute(null); } }); @@ -413,10 +406,10 @@ namespace Wox.ViewModel }); } - private void InitializeResultPanel() + private void InitializeResultListBox() { - this._searchResultPanel = new ResultPanelViewModel(); - this.IsSearchResultPanelVisible = false; + this.Results = new ResultPanelViewModel(); + this.IsResultListBoxVisible = false; } private void ShowActionPanel(Result result) @@ -448,7 +441,7 @@ namespace Wox.ViewModel CurrentContextMenus = actions; this.IsActionPanelVisible = true; - this.IsSearchResultPanelVisible = false; + this.IsResultListBoxVisible = false; this.QueryText = ""; } @@ -509,7 +502,7 @@ namespace Wox.ViewModel } else { - this._searchResultPanel.Clear(); + this.Results.Clear(); } } } @@ -551,18 +544,18 @@ namespace Wox.ViewModel { if (!string.IsNullOrEmpty(keyword)) { - this._searchResultPanel.RemoveResultsExcept(PluginManager.NonGlobalPlugins[keyword].Metadata); + this.Results.RemoveResultsExcept(PluginManager.NonGlobalPlugins[keyword].Metadata); } } else { if (string.IsNullOrEmpty(keyword)) { - this._searchResultPanel.RemoveResultsFor(PluginManager.NonGlobalPlugins[lastKeyword].Metadata); + this.Results.RemoveResultsFor(PluginManager.NonGlobalPlugins[lastKeyword].Metadata); } else if (lastKeyword != keyword) { - this._searchResultPanel.RemoveResultsExcept(PluginManager.NonGlobalPlugins[keyword].Metadata); + this.Results.RemoveResultsExcept(PluginManager.NonGlobalPlugins[keyword].Metadata); } } _lastQuery = query; @@ -593,21 +586,21 @@ namespace Wox.ViewModel private void ResetQueryHistoryIndex() { - this._searchResultPanel.RemoveResultsFor(QueryHistoryStorage.MetaData); + this.Results.RemoveResultsFor(QueryHistoryStorage.MetaData); QueryHistoryStorage.Instance.Reset(); } private void UpdateResultViewInternal(List list, PluginMetadata metadata) { Infrastructure.Stopwatch.Normal($"UI update cost for {metadata.Name}", - () => { this._searchResultPanel.AddResults(list, metadata.ID); }); + () => { this.Results.AddResults(list, metadata.ID); }); } private void BackToSearchMode() { this.QueryText = _textBeforeEnterContextMenuMode; this.IsActionPanelVisible = false; - this.IsSearchResultPanelVisible = true; + this.IsResultListBoxVisible = true; this.CaretIndex = this.QueryText.Length; } @@ -622,7 +615,7 @@ namespace Wox.ViewModel var executeQueryHistoryTitle = InternationalizationManager.Instance.GetTranslation("executeQuery"); var lastExecuteTime = InternationalizationManager.Instance.GetTranslation("lastExecuteTime"); - this._searchResultPanel.RemoveResultsExcept(historyMetadata); + this.Results.RemoveResultsExcept(historyMetadata); UpdateResultViewInternal(new List { new Result @@ -666,7 +659,7 @@ namespace Wox.ViewModel if (list.Count > 0) { - this.IsSearchResultPanelVisible = true; + this.IsResultListBoxVisible = true; } }