diff --git a/Client/Controls/MainWindow.xaml b/Client/Controls/MainWindow.xaml index 18af96c6..c836bb3e 100644 --- a/Client/Controls/MainWindow.xaml +++ b/Client/Controls/MainWindow.xaml @@ -187,8 +187,14 @@ - - + + + + + + + + @@ -266,11 +272,11 @@ - - + @@ -368,8 +374,16 @@ - - - + + + + + + + + + + + diff --git a/Client/MainWindowViewModel.cs b/Client/MainWindowViewModel.cs index fe9f6f38..c623de63 100644 --- a/Client/MainWindowViewModel.cs +++ b/Client/MainWindowViewModel.cs @@ -20,7 +20,8 @@ namespace Client { - public class MainWindowViewModel + // INotifyPropertyChanged interface implemented to notify UI for status bar changes. + public class MainWindowViewModel : INotifyPropertyChanged { private CollectionView _myView; private FileChangeObserver _changefile; @@ -39,16 +40,41 @@ public SortType SortType get { return _sortType; } set { + bool raiseEvent = false; if (_sortType != value) { User.Default.CurrentSort = (int)value; User.Default.Save(); + raiseEvent = true; } _sortType = value; + + if(raiseEvent) + { + RaiseProperyChanged(nameof(SortType)); + } + } + } + + private String _filterDescription = String.Empty; + public String FilterDescription + { + get + { + return _filterDescription; + } + private set + { + if (!_filterDescription.Equals(value)) + { + _filterDescription = value; + RaiseProperyChanged(nameof(FilterDescription)); + } } } + public event PropertyChangedEventHandler PropertyChanged; public MainWindowViewModel(MainWindow window) { @@ -61,6 +87,7 @@ public MainWindowViewModel(MainWindow window) SortType = (SortType)User.Default.CurrentSort; + FilterDescription = "Filter: None"; if (!string.IsNullOrEmpty(User.Default.FilePath)) { @@ -571,8 +598,9 @@ private void ApplyFilterPreset(int filterPresetNumber) SetSelectedTasks(); User.Default.Save(); + + FilterDescription = String.Format("Filter #{0}", filterPresetNumber); } - #endregion #region Sort Methods @@ -1645,5 +1673,15 @@ private string EmitGroupHeader() } #endregion + + #region Utility Methods + private void RaiseProperyChanged(String propertyName) + { + if (PropertyChanged != null) + { + PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + } + #endregion } } \ No newline at end of file