ResultPanelViewModel -> ResultsViewModel, part 1

part of refactoring for PR #494
This commit is contained in:
bao-qian 2016-02-21 14:33:18 +00:00
parent 78b44a1319
commit 45246bccd7
7 changed files with 12 additions and 12 deletions

View File

@ -21,7 +21,7 @@
Visibility="{Binding IsVisible,Converter={converters:VisibilityConverter}}" Visibility="{Binding IsVisible,Converter={converters:VisibilityConverter}}"
PreviewKeyDown="Window_PreviewKeyDown" d:DataContext="{d:DesignInstance vm:MainViewModel, IsDesignTimeCreatable=True}"> PreviewKeyDown="Window_PreviewKeyDown" d:DataContext="{d:DesignInstance vm:MainViewModel, IsDesignTimeCreatable=True}">
<Window.Resources> <Window.Resources>
<DataTemplate DataType="{x:Type vm:ResultPanelViewModel}"> <DataTemplate DataType="{x:Type vm:ResultsViewModel}">
<wox:ResultListBox></wox:ResultListBox> <wox:ResultListBox></wox:ResultListBox>
</DataTemplate> </DataTemplate>
<converters:VisibilityConverter x:Key="VisibilityConverter" /> <converters:VisibilityConverter x:Key="VisibilityConverter" />

View File

@ -6,7 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:converters="clr-namespace:Wox.Converters" xmlns:converters="clr-namespace:Wox.Converters"
xmlns:vm ="clr-namespace:Wox.ViewModel" 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}">
<ListBox x:Name="lbResults" MaxHeight="{Binding MaxHeight}" SelectedItem="{Binding SelectedResult}" <ListBox x:Name="lbResults" MaxHeight="{Binding MaxHeight}" SelectedItem="{Binding SelectedResult}"
HorizontalContentAlignment="Stretch" ItemsSource="{Binding Results}" Margin="{Binding Margin}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding Results}" Margin="{Binding Margin}"
Style="{DynamicResource BaseListboxStyle}" SelectionChanged="lbResults_SelectionChanged" Focusable="False" Style="{DynamicResource BaseListboxStyle}" SelectionChanged="lbResults_SelectionChanged" Focusable="False"

View File

@ -19,7 +19,7 @@ namespace Wox
{ {
public void AddResults(List<Result> newResults, string resultId) public void AddResults(List<Result> newResults, string resultId)
{ {
var vm = this.DataContext as ResultPanelViewModel; var vm = this.DataContext as ResultsViewModel;
vm.AddResults(newResults, resultId); vm.AddResults(newResults, resultId);
} }

View File

@ -37,7 +37,7 @@ namespace Wox
{ {
this._api = api; this._api = api;
InitializeComponent(); InitializeComponent();
this.ResultListBoxPreview.DataContext = new ResultPanelViewModel(); this.ResultListBoxPreview.DataContext = new ResultsViewModel();
Loaded += Setting_Loaded; Loaded += Setting_Loaded;
} }

View File

@ -21,7 +21,7 @@ namespace Wox.ViewModel
{ {
#region Private Fields #region Private Fields
private ResultPanelViewModel _actionPanel; private ResultsViewModel _actionPanel;
private string _queryText; private string _queryText;
private bool _isVisible; private bool _isVisible;
private bool _isResultListBoxVisible; private bool _isResultListBoxVisible;
@ -56,9 +56,9 @@ namespace Wox.ViewModel
#region ViewModel Properties #region ViewModel Properties
public ResultPanelViewModel Results { get; private set; } public ResultsViewModel Results { get; private set; }
public ResultPanelViewModel ActionPanel public ResultsViewModel ActionPanel
{ {
get get
{ {
@ -408,7 +408,7 @@ namespace Wox.ViewModel
private void InitializeResultListBox() private void InitializeResultListBox()
{ {
this.Results = new ResultPanelViewModel(); this.Results = new ResultsViewModel();
this.IsResultListBoxVisible = false; this.IsResultListBoxVisible = false;
} }
@ -478,7 +478,7 @@ namespace Wox.ViewModel
private void InitializeActionPanel() private void InitializeActionPanel()
{ {
this._actionPanel = new ResultPanelViewModel(); this._actionPanel = new ResultsViewModel();
this.IsActionPanelVisible = false; this.IsActionPanelVisible = false;
} }

View File

@ -13,7 +13,7 @@ using Wox.Storage;
namespace Wox.ViewModel namespace Wox.ViewModel
{ {
public class ResultPanelViewModel : BaseViewModel public class ResultsViewModel : BaseViewModel
{ {
#region Private Fields #region Private Fields
@ -28,7 +28,7 @@ namespace Wox.ViewModel
#region Constructor #region Constructor
public ResultPanelViewModel() public ResultsViewModel()
{ {
this._results = new ResultCollection(); this._results = new ResultCollection();
} }

View File

@ -137,7 +137,7 @@
<Compile Include="ViewModel\BaseViewModel.cs" /> <Compile Include="ViewModel\BaseViewModel.cs" />
<Compile Include="ViewModel\MainViewModel.cs" /> <Compile Include="ViewModel\MainViewModel.cs" />
<Compile Include="ViewModel\ResultItemViewModel.cs" /> <Compile Include="ViewModel\ResultItemViewModel.cs" />
<Compile Include="ViewModel\ResultPanelViewModel.cs" /> <Compile Include="ViewModel\ResultsViewModel.cs" />
<Compile Include="WoxUpdate.xaml.cs"> <Compile Include="WoxUpdate.xaml.cs">
<DependentUpon>WoxUpdate.xaml</DependentUpon> <DependentUpon>WoxUpdate.xaml</DependentUpon>
</Compile> </Compile>