diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-10-11 10:26:41 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-10-11 10:26:41 +0300 |
| commit | 37293ed1bf4ca876d9b90a20cfd3e4ead8f4bbf9 (patch) | |
| tree | db6a793c1b43215cc9ddbb092b9d33f6781c9e5e /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels | |
| parent | b1c89925cd6e6da9666c7897f056634bf964dcb3 (diff) | |
| parent | 469ba6f2c0fdeeb942578084c3c6c1d76d040c2d (diff) | |
| download | Tango-37293ed1bf4ca876d9b90a20cfd3e4ead8f4bbf9.tar.gz Tango-37293ed1bf4ca876d9b90a20cfd3e4ead8f4bbf9.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs | 59 |
1 files changed, 43 insertions, 16 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs index b0bc613bd..3e0e3ab84 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs @@ -13,6 +13,7 @@ using Tango.MachineStudio.Logging.Navigation; using Tango.MachineStudio.Logging.Parsing; using Tango.MachineStudio.Logging.Views; using Tango.SharedUI; +using Tango.SharedUI.Components; namespace Tango.MachineStudio.Logging.ViewModels { @@ -41,6 +42,8 @@ namespace Tango.MachineStudio.Logging.ViewModels set { _logsViewSource = value; RaisePropertyChangedAuto(); } } + public SelectedObjectCollection<LogCategory> SelectedLogCategories { get; set; } + private String _filter; public String Filter { @@ -118,22 +121,7 @@ namespace Tango.MachineStudio.Logging.ViewModels { _realTimePaused = value; RaisePropertyChangedAuto(); - - if (!_realTimePaused) - { - LogsViewSource.Filter = null; - _realTimeLogs.InsertRange(0, _pausedLogs); - _pausedLogs.Clear(); - } - else - { - LogsViewSource.Filter = (x) => - { - if (String.IsNullOrWhiteSpace(Filter)) return true; - LogItemBase log = x as LogItemBase; - return log.Message.ToLower().Contains(Filter.ToLower()); - }; - } + ApplyLogsFilter(); } } @@ -149,6 +137,27 @@ namespace Tango.MachineStudio.Logging.ViewModels NavigateToHomeCommand = new RelayCommand(() => navigation.NavigateTo(LoggingNavigationView.HomeView)); + SelectedLogCategories = new SelectedObjectCollection<LogCategory>(new ObservableCollection<LogCategory>() + { + LogCategory.Info, + LogCategory.Warning, + LogCategory.Error, + LogCategory.Critical, + LogCategory.Debug, + }, new ObservableCollection<LogCategory>() + { + LogCategory.Info, + LogCategory.Warning, + LogCategory.Error, + LogCategory.Critical, + LogCategory.Debug, + }); + + SelectedLogCategories.SynchedSource.CollectionChanged += (_, __) => + { + ApplyLogsFilter(); + }; + _parser = new ApplicationLogFileParser(); _logFiles = _parser.GetLogFiles(); @@ -177,6 +186,24 @@ namespace Tango.MachineStudio.Logging.ViewModels _is_debug = LogManager.Categories.Contains(LogCategory.Debug); } + private void ApplyLogsFilter() + { + if ((_realTimePaused && _isRealTime) || !_isRealTime) + { + LogsViewSource.Filter = (x) => + { + LogItemBase log = x as LogItemBase; + return (SelectedLogCategories.SynchedSource.Contains(log.Category) && (String.IsNullOrWhiteSpace(Filter) || log.Message.ToLower().Contains(Filter.ToLower()))); + }; + } + else + { + LogsViewSource.Filter = null; + _realTimeLogs.InsertRange(0, _pausedLogs); + _pausedLogs.Clear(); + } + } + private void LogManager_NewLog(object sender, LogItemBase log) { if (log.Category == LogCategory.Debug && !DisplayDebug) return; |
