From c7043303d96ec48af6af105a93d80dca2aed627b Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Fri, 4 Sep 2020 22:43:27 +0300 Subject: Fixed issue with insights settings persistence. ObjectCreationHandling. --- .../Modules/Tango.FSE.Insights/Config/AnnotationsConfiguration.cs | 5 ++++- .../FSE/Modules/Tango.FSE.Insights/InsightsSettings.cs | 6 ++++-- .../FSE/Modules/Tango.FSE.Insights/Tango.FSE.Insights.csproj | 5 ++--- .../FSE/Modules/Tango.FSE.Insights/ViewModels/InsightsViewVM.cs | 2 +- .../Visual_Studio/FSE/Modules/Tango.FSE.Insights/packages.config | 2 +- Software/Visual_Studio/Tango.Settings/SettingsManager.cs | 2 +- 6 files changed, 13 insertions(+), 9 deletions(-) (limited to 'Software/Visual_Studio') diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/Config/AnnotationsConfiguration.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/Config/AnnotationsConfiguration.cs index fc7b5259c..5d38f8a3b 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/Config/AnnotationsConfiguration.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/Config/AnnotationsConfiguration.cs @@ -1,4 +1,5 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; @@ -54,6 +55,7 @@ namespace Tango.FSE.Insights.Config } private ObservableCollection _eventsCategories; + [JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Replace)] public ObservableCollection EventsCategories { get { return _eventsCategories; } @@ -61,6 +63,7 @@ namespace Tango.FSE.Insights.Config } private ObservableCollection _eventsGroups; + [JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Replace)] public ObservableCollection EventsGroups { get { return _eventsGroups; } diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/InsightsSettings.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/InsightsSettings.cs index e96167b30..a34796b6a 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/InsightsSettings.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/InsightsSettings.cs @@ -1,4 +1,5 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -15,12 +16,13 @@ namespace Tango.FSE.Insights public List VisibleMonitors { get; set; } public bool DisplayAnnotations { get; set; } public int DefaultDiffDays { get; set; } + public AnnotationsConfiguration AnnotationsConfiguration { get; set; } public InsightsSettings() { - VisibleMonitors = new List(); DefaultDiffDays = 7; + VisibleMonitors = new List(); AnnotationsConfiguration = AnnotationsConfiguration.CreateDefault(); } } diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/Tango.FSE.Insights.csproj b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/Tango.FSE.Insights.csproj index 8d8d2b9fb..1599d484a 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/Tango.FSE.Insights.csproj +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/Tango.FSE.Insights.csproj @@ -85,9 +85,8 @@ ..\..\..\packages\Microsoft.ML.1.5.1\lib\netstandard2.0\Microsoft.ML.Transforms.dll - - ..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll - False + + ..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll False diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/ViewModels/InsightsViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/ViewModels/InsightsViewVM.cs index e200ba409..cb41974e1 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/ViewModels/InsightsViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/ViewModels/InsightsViewVM.cs @@ -236,7 +236,6 @@ namespace Tango.FSE.Insights.ViewModels VisibleCharts = new ObservableCollection(); Annotations = new AnnotationCollection(); AnnotationsConfiguration = AnnotationsConfiguration.CreateDefault(); - InitEventsSelection(); GetInsightsCommand = new RelayCommand(GetInsights, () => IsFree); PeekApplicationLogsCommand = new RelayCommand(PeekAnnotationApplicationLogs); @@ -267,6 +266,7 @@ namespace Tango.FSE.Insights.ViewModels DisplayAnnotations = ModuleSettings.DisplayAnnotations; AnnotationsConfiguration = ModuleSettings.AnnotationsConfiguration; + InitEventsSelection(); MachineProvider.MachineConnected += MachineProvider_MachineConnected; } diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/packages.config b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/packages.config index e06be2064..3bd90bbb3 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/packages.config +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Insights/packages.config @@ -11,7 +11,7 @@ - + diff --git a/Software/Visual_Studio/Tango.Settings/SettingsManager.cs b/Software/Visual_Studio/Tango.Settings/SettingsManager.cs index d106ebaca..350bdf790 100644 --- a/Software/Visual_Studio/Tango.Settings/SettingsManager.cs +++ b/Software/Visual_Studio/Tango.Settings/SettingsManager.cs @@ -69,7 +69,7 @@ namespace Tango.Settings Error = (sender, args) => { args.ErrorContext.Handled = true; - Logging.LogManager.Default.Log(args.ErrorContext.Error.Message); + LogManager.Default.Log(args.ErrorContext.Error.Message, LogCategory.Error); } }; -- cgit v1.3.1