From c00583dd9822eb20f89636f3d7dabb8135c674e0 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Sat, 27 Feb 2016 00:09:12 +0000 Subject: [PATCH] Remove harder coded text 1. Remove harder coded text, part of refactoring for PR #494 2. Remove other arguments redundant --- Wox/ViewModel/BaseViewModel.cs | 3 ++- Wox/ViewModel/MainViewModel.cs | 20 ++++++++++---------- Wox/ViewModel/ResultViewModel.cs | 6 +++--- Wox/ViewModel/ResultsViewModel.cs | 4 ++-- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Wox/ViewModel/BaseViewModel.cs b/Wox/ViewModel/BaseViewModel.cs index 5f659f0956..daa6976e00 100644 --- a/Wox/ViewModel/BaseViewModel.cs +++ b/Wox/ViewModel/BaseViewModel.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel; +using System.Runtime.CompilerServices; using System.Windows.Input; namespace Wox.ViewModel @@ -7,7 +8,7 @@ namespace Wox.ViewModel public class BaseViewModel : INotifyPropertyChanged { - protected void OnPropertyChanged(string propertyName) + protected void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } diff --git a/Wox/ViewModel/MainViewModel.cs b/Wox/ViewModel/MainViewModel.cs index d702a4a7d7..8eb0c1ab73 100644 --- a/Wox/ViewModel/MainViewModel.cs +++ b/Wox/ViewModel/MainViewModel.cs @@ -66,7 +66,7 @@ namespace Wox.ViewModel set { _queryText = value; - OnPropertyChanged("QueryText"); + OnPropertyChanged(); HandleQueryTextUpdated(); } } @@ -80,7 +80,7 @@ namespace Wox.ViewModel set { _isProgressBarTooltipVisible = value; - OnPropertyChanged("IsProgressBarTooltipVisible"); + OnPropertyChanged(); } } @@ -93,7 +93,7 @@ namespace Wox.ViewModel set { _left = value; - OnPropertyChanged("Left"); + OnPropertyChanged(); } } @@ -106,7 +106,7 @@ namespace Wox.ViewModel set { _top = value; - OnPropertyChanged("Top"); + OnPropertyChanged(); } } @@ -119,7 +119,7 @@ namespace Wox.ViewModel set { _contextMenuVisibility = value; - OnPropertyChanged("ContextMenuVisibility"); + OnPropertyChanged(); } } @@ -132,7 +132,7 @@ namespace Wox.ViewModel set { _progressBarVisibility = value; - OnPropertyChanged("ProgressBarVisibility"); + OnPropertyChanged(); } } @@ -145,7 +145,7 @@ namespace Wox.ViewModel set { _resultListBoxVisibility = value; - OnPropertyChanged("ResultListBoxVisibility"); + OnPropertyChanged(); } } @@ -158,7 +158,7 @@ namespace Wox.ViewModel set { _mainWindowVisibility = value; - OnPropertyChanged("MainWindowVisibility"); + OnPropertyChanged(); MainWindowVisibilityChanged?.Invoke(this, new EventArgs()); if (!value.IsVisible() && ContextMenuVisibility.IsVisible()) @@ -335,7 +335,7 @@ namespace Wox.ViewModel Action = _ => { TopMostRecordStorage.Instance.Remove(result); - App.API.ShowMsg("Succeed", "", ""); + App.API.ShowMsg("Succeed"); return false; } }; @@ -348,7 +348,7 @@ namespace Wox.ViewModel Action = _ => { TopMostRecordStorage.Instance.AddOrUpdate(result); - App.API.ShowMsg("Succeed", "", ""); + App.API.ShowMsg("Succeed"); return false; } }; diff --git a/Wox/ViewModel/ResultViewModel.cs b/Wox/ViewModel/ResultViewModel.cs index aa59b1e9f6..7208be68e7 100644 --- a/Wox/ViewModel/ResultViewModel.cs +++ b/Wox/ViewModel/ResultViewModel.cs @@ -77,7 +77,7 @@ namespace Wox.ViewModel set { _isSelected = value; - OnPropertyChanged("IsSelected"); + OnPropertyChanged(); } } @@ -105,7 +105,7 @@ namespace Wox.ViewModel Action = _ => { TopMostRecordStorage.Instance.Remove(result); - App.API.ShowMsg("Succeed", "", ""); + App.API.ShowMsg("Succeed"); return false; } }; @@ -118,7 +118,7 @@ namespace Wox.ViewModel Action = _ => { TopMostRecordStorage.Instance.AddOrUpdate(result); - App.API.ShowMsg("Succeed", "", ""); + App.API.ShowMsg("Succeed"); return false; } }; diff --git a/Wox/ViewModel/ResultsViewModel.cs b/Wox/ViewModel/ResultsViewModel.cs index 8e9f69d58d..192009bff5 100644 --- a/Wox/ViewModel/ResultsViewModel.cs +++ b/Wox/ViewModel/ResultsViewModel.cs @@ -51,7 +51,7 @@ namespace Wox.ViewModel } - OnPropertyChanged("SelectedResult"); + OnPropertyChanged(); } } @@ -65,7 +65,7 @@ namespace Wox.ViewModel set { _margin = value; - OnPropertyChanged("Margin"); + OnPropertyChanged(); } }