aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-07-23 11:37:09 +0300
committerShlomo Hecht <shlomo@twine-s.com>2018-07-23 11:37:09 +0300
commit8a84d33ab8d8a44b1036bb8c5707858d7a25b123 (patch)
tree26658a7d67adade1389a4d71ded4d9a56c0e7e04 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs
parent81dd84b2749ee06fa592ac64075c0d8195972aa5 (diff)
parent87444d2a16e63e9b992c25a9e9fbaf3bb5b91025 (diff)
downloadTango-8a84d33ab8d8a44b1036bb8c5707858d7a25b123.tar.gz
Tango-8a84d33ab8d8a44b1036bb8c5707858d7a25b123.zip
merge
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs65
1 files changed, 62 insertions, 3 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 2b12b1670..b0bc613bd 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
@@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Windows.Data;
using Tango.Core.Commands;
using Tango.Logging;
using Tango.MachineStudio.Common.Notifications;
@@ -19,6 +21,8 @@ namespace Tango.MachineStudio.Logging.ViewModels
private ApplicationLogFileParser _parser;
private List<LogFile> _logFiles;
private INotificationProvider _notification;
+ private bool _dialog_shown;
+ private bool _is_debug;
private ControlledObservableCollection<LogItemBase> _realTimeLogs;
private List<LogItemBase> _pausedLogs;
@@ -30,6 +34,39 @@ namespace Tango.MachineStudio.Logging.ViewModels
set { _logs = value; RaisePropertyChangedAuto(); }
}
+ private ICollectionView _logsViewSource;
+ public ICollectionView LogsViewSource
+ {
+ get { return _logsViewSource; }
+ set { _logsViewSource = value; RaisePropertyChangedAuto(); }
+ }
+
+ private String _filter;
+ public String Filter
+ {
+ get { return _filter; }
+ set
+ {
+ _filter = value;
+ RaisePropertyChangedAuto();
+
+ if (RealTimePaused)
+ {
+ LogsViewSource.Refresh();
+ }
+ }
+ }
+
+ private bool _displayDebug;
+ /// <summary>
+ /// Gets or sets a value indicating whether display debug logs.
+ /// </summary>
+ public bool DisplayDebug
+ {
+ get { return _displayDebug; }
+ set { _displayDebug = value; RaisePropertyChangedAuto(); }
+ }
+
private LogItemBase _selectedLog;
public LogItemBase SelectedLog
{
@@ -84,9 +121,19 @@ namespace Tango.MachineStudio.Logging.ViewModels
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());
+ };
+ }
}
}
@@ -126,10 +173,14 @@ namespace Tango.MachineStudio.Logging.ViewModels
ToggleRealTimePaused = new RelayCommand(() => RealTimePaused = !RealTimePaused);
ClearRealTimeLogsCommand = new RelayCommand(() => { _realTimeLogs.Clear(); });
+
+ _is_debug = LogManager.Categories.Contains(LogCategory.Debug);
}
private void LogManager_NewLog(object sender, LogItemBase log)
{
+ if (log.Category == LogCategory.Debug && !DisplayDebug) return;
+
if (!RealTimePaused)
{
InvokeUI(() =>
@@ -166,14 +217,22 @@ namespace Tango.MachineStudio.Logging.ViewModels
Logs = new ControlledObservableCollection<LogItemBase>(logs);
}
+
+ LogsViewSource = CollectionViewSource.GetDefaultView(Logs);
}
private void OnSelectedLogChanged()
{
- if (SelectedLog != null)
+ if (SelectedLog != null && !_dialog_shown)
{
- _notification.ShowModalDialog<LogDetailsViewVM, ApplicationLogDetailsView>(new LogDetailsViewVM(SelectedLog), (x) => { }, () => { });
- SelectedLog = null;
+ _dialog_shown = true;
+ _notification.ShowModalDialog<LogDetailsViewVM, ApplicationLogDetailsView>(new LogDetailsViewVM(SelectedLog), (x) =>
+ {
+
+ }, () =>
+ {
+ _dialog_shown = false;
+ });
}
}
}