From 525c00ea18dfbac0ae3e256275589f5307e1c66e Mon Sep 17 00:00:00 2001 From: bao-qian Date: Sun, 21 Feb 2016 13:53:20 +0000 Subject: [PATCH 01/15] ResultPanel -> ResultListBox, part 1 part of refactoring for PR #494 --- Wox/{ResultPanel.xaml => ResultListBox.xaml} | 0 Wox/{ResultPanel.xaml.cs => ResultListBox.xaml.cs} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename Wox/{ResultPanel.xaml => ResultListBox.xaml} (100%) rename Wox/{ResultPanel.xaml.cs => ResultListBox.xaml.cs} (100%) diff --git a/Wox/ResultPanel.xaml b/Wox/ResultListBox.xaml similarity index 100% rename from Wox/ResultPanel.xaml rename to Wox/ResultListBox.xaml diff --git a/Wox/ResultPanel.xaml.cs b/Wox/ResultListBox.xaml.cs similarity index 100% rename from Wox/ResultPanel.xaml.cs rename to Wox/ResultListBox.xaml.cs From 0aeba7c5af3ba71099d7b1336621e94272fdca66 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Sun, 21 Feb 2016 14:14:27 +0000 Subject: [PATCH 02/15] tmp rename --- Wox/Wox.csproj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 5f45652b01..13edf3ec8c 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -128,6 +128,9 @@ + + ResultListBox.xaml + @@ -169,9 +172,6 @@ Msg.xaml - - ResultPanel.xaml - SettingWindow.xaml @@ -243,9 +243,9 @@ Designer MSBuild:Compile - - Designer + MSBuild:Compile + Designer Designer From 0e6cd0f72acf8a0a7157f8ec198e55220e060eb0 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Sun, 21 Feb 2016 14:22:34 +0000 Subject: [PATCH 03/15] ResultPanel -> ResultListBox, part 2 part of refactoring for PR #494 --- Wox/MainWindow.xaml | 4 +- Wox/ResultListBox.xaml | 2 +- Wox/ResultListBox.xaml.cs | 4 +- Wox/SettingWindow.xaml | 2 +- Wox/SettingWindow.xaml.cs | 4 +- Wox/ViewModel/MainViewModel.cs | 67 +++++++++++++++------------------- 6 files changed, 38 insertions(+), 45 deletions(-) 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; } } From 78b44a1319e9dcf43208fa10c6cbecf27730e542 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Sun, 21 Feb 2016 14:30:13 +0000 Subject: [PATCH 04/15] ResultPanelViewModel -> ResultsViewModel, part 1 part of refactoring for PR #494 --- Wox/ViewModel/{ResultPanelViewModel.cs => ResultsViewModel.cs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Wox/ViewModel/{ResultPanelViewModel.cs => ResultsViewModel.cs} (100%) diff --git a/Wox/ViewModel/ResultPanelViewModel.cs b/Wox/ViewModel/ResultsViewModel.cs similarity index 100% rename from Wox/ViewModel/ResultPanelViewModel.cs rename to Wox/ViewModel/ResultsViewModel.cs From 45246bccd7821e74fbca0da5fd9ff182da9d96f8 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Sun, 21 Feb 2016 14:33:18 +0000 Subject: [PATCH 05/15] ResultPanelViewModel -> ResultsViewModel, part 1 part of refactoring for PR #494 --- Wox/MainWindow.xaml | 2 +- Wox/ResultListBox.xaml | 2 +- Wox/ResultListBox.xaml.cs | 2 +- Wox/SettingWindow.xaml.cs | 2 +- Wox/ViewModel/MainViewModel.cs | 10 +++++----- Wox/ViewModel/ResultsViewModel.cs | 4 ++-- Wox/Wox.csproj | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Wox/MainWindow.xaml b/Wox/MainWindow.xaml index 2c7421081f..d6a6dc5a38 100644 --- a/Wox/MainWindow.xaml +++ b/Wox/MainWindow.xaml @@ -21,7 +21,7 @@ Visibility="{Binding IsVisible,Converter={converters:VisibilityConverter}}" PreviewKeyDown="Window_PreviewKeyDown" d:DataContext="{d:DesignInstance vm:MainViewModel, IsDesignTimeCreatable=True}"> - + diff --git a/Wox/ResultListBox.xaml b/Wox/ResultListBox.xaml index 890c36cc37..0962b7df25 100644 --- a/Wox/ResultListBox.xaml +++ b/Wox/ResultListBox.xaml @@ -6,7 +6,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:converters="clr-namespace:Wox.Converters" xmlns:vm ="clr-namespace:Wox.ViewModel" - mc:Ignorable="d" d:DesignWidth="100" d:DesignHeight="100" d:DataContext="{d:DesignInstance vm:ResultPanelViewModel}"> + mc:Ignorable="d" d:DesignWidth="100" d:DesignHeight="100" d:DataContext="{d:DesignInstance vm:ResultsViewModel}"> newResults, string resultId) { - var vm = this.DataContext as ResultPanelViewModel; + var vm = this.DataContext as ResultsViewModel; vm.AddResults(newResults, resultId); } diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index ed76e8c523..7eeaa464bb 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -37,7 +37,7 @@ namespace Wox { this._api = api; InitializeComponent(); - this.ResultListBoxPreview.DataContext = new ResultPanelViewModel(); + this.ResultListBoxPreview.DataContext = new ResultsViewModel(); Loaded += Setting_Loaded; } diff --git a/Wox/ViewModel/MainViewModel.cs b/Wox/ViewModel/MainViewModel.cs index 9793a36966..3584041385 100644 --- a/Wox/ViewModel/MainViewModel.cs +++ b/Wox/ViewModel/MainViewModel.cs @@ -21,7 +21,7 @@ namespace Wox.ViewModel { #region Private Fields - private ResultPanelViewModel _actionPanel; + private ResultsViewModel _actionPanel; private string _queryText; private bool _isVisible; private bool _isResultListBoxVisible; @@ -56,9 +56,9 @@ namespace Wox.ViewModel #region ViewModel Properties - public ResultPanelViewModel Results { get; private set; } + public ResultsViewModel Results { get; private set; } - public ResultPanelViewModel ActionPanel + public ResultsViewModel ActionPanel { get { @@ -408,7 +408,7 @@ namespace Wox.ViewModel private void InitializeResultListBox() { - this.Results = new ResultPanelViewModel(); + this.Results = new ResultsViewModel(); this.IsResultListBoxVisible = false; } @@ -478,7 +478,7 @@ namespace Wox.ViewModel private void InitializeActionPanel() { - this._actionPanel = new ResultPanelViewModel(); + this._actionPanel = new ResultsViewModel(); this.IsActionPanelVisible = false; } diff --git a/Wox/ViewModel/ResultsViewModel.cs b/Wox/ViewModel/ResultsViewModel.cs index 2cc946df62..04a1e43fce 100644 --- a/Wox/ViewModel/ResultsViewModel.cs +++ b/Wox/ViewModel/ResultsViewModel.cs @@ -13,7 +13,7 @@ using Wox.Storage; namespace Wox.ViewModel { - public class ResultPanelViewModel : BaseViewModel + public class ResultsViewModel : BaseViewModel { #region Private Fields @@ -28,7 +28,7 @@ namespace Wox.ViewModel #region Constructor - public ResultPanelViewModel() + public ResultsViewModel() { this._results = new ResultCollection(); } diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 13edf3ec8c..164fdc5846 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -137,7 +137,7 @@ - + WoxUpdate.xaml From 4643810b755ea8306b74be7816250464065bcbc1 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Sun, 21 Feb 2016 14:40:10 +0000 Subject: [PATCH 06/15] ActionPanel -> ContextMenu part of refactoring for PR #494 --- Wox/MainWindow.xaml | 2 +- Wox/PublicAPIInstance.cs | 2 +- Wox/ResultListBox.xaml | 4 +- Wox/ViewModel/MainViewModel.cs | 83 +++++++++++++--------------- Wox/ViewModel/ResultItemViewModel.cs | 21 +++---- 5 files changed, 49 insertions(+), 63 deletions(-) diff --git a/Wox/MainWindow.xaml b/Wox/MainWindow.xaml index d6a6dc5a38..7ce73b08ec 100644 --- a/Wox/MainWindow.xaml +++ b/Wox/MainWindow.xaml @@ -39,7 +39,7 @@ - + diff --git a/Wox/PublicAPIInstance.cs b/Wox/PublicAPIInstance.cs index 7cb7f296f4..2374d46e19 100644 --- a/Wox/PublicAPIInstance.cs +++ b/Wox/PublicAPIInstance.cs @@ -181,7 +181,7 @@ namespace Wox o.PluginID = plugin.ID; }); - this.MainVM.ShowActionPanel(results, plugin.ID); + this.MainVM.ShowContextMenu(results, plugin.ID); } } diff --git a/Wox/ResultListBox.xaml b/Wox/ResultListBox.xaml index 0962b7df25..9f4894f9d4 100644 --- a/Wox/ResultListBox.xaml +++ b/Wox/ResultListBox.xaml @@ -17,9 +17,9 @@ -