diff --git a/GeothermalResearchInstitute/GeothermalResearchInstitute.Grpc/GeothermalResearchInstitute.Grpc.csproj b/GeothermalResearchInstitute/GeothermalResearchInstitute.Grpc/GeothermalResearchInstitute.Grpc.csproj index 60811618..24f8bc83 100644 --- a/GeothermalResearchInstitute/GeothermalResearchInstitute.Grpc/GeothermalResearchInstitute.Grpc.csproj +++ b/GeothermalResearchInstitute/GeothermalResearchInstitute.Grpc/GeothermalResearchInstitute.Grpc.csproj @@ -5,9 +5,9 @@ - - - + + + diff --git a/GeothermalResearchInstitute/GeothermalResearchInstitute.PlcClient/GeothermalResearchInstitute.Plc.csproj b/GeothermalResearchInstitute/GeothermalResearchInstitute.PlcClient/GeothermalResearchInstitute.Plc.csproj index 0da32621..b801f053 100644 --- a/GeothermalResearchInstitute/GeothermalResearchInstitute.PlcClient/GeothermalResearchInstitute.Plc.csproj +++ b/GeothermalResearchInstitute/GeothermalResearchInstitute.PlcClient/GeothermalResearchInstitute.Plc.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/GrpcServices/DeviceServiceImpl.cs b/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/GrpcServices/DeviceServiceImpl.cs index 68dc518b..ca01062d 100644 --- a/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/GrpcServices/DeviceServiceImpl.cs +++ b/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/GrpcServices/DeviceServiceImpl.cs @@ -60,6 +60,11 @@ public DeviceServiceImpl( TimeSpan.FromMilliseconds(tasksOptions.Value.CollectMetricIntervalMillis), TimeSpan.FromMilliseconds(tasksOptions.Value.CollectMetricIntervalMillis)); + IOptionsSnapshot coreOptions = + this.serviceProvider.GetRequiredService>(); + this.logger.LogInformation("CoreOptions: {0}", coreOptions.Value); + this.logger.LogInformation("TasksOptions: {0}", tasksOptions.Value); + if (this.logger.IsEnabled(LogLevel.Debug)) { IOptionsSnapshot deviceOptions = this.serviceProvider.GetRequiredService>(); diff --git a/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/Options/CoreOptions.cs b/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/Options/CoreOptions.cs index da1c8808..93a65a29 100644 --- a/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/Options/CoreOptions.cs +++ b/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/Options/CoreOptions.cs @@ -3,6 +3,8 @@ // Licensed under the GPLv3 license. See LICENSE file in the project root for full license information. // +using System.Text.Json; + namespace GeothermalResearchInstitute.ServerConsole.Options { public class CoreOptions @@ -14,5 +16,10 @@ public class CoreOptions public int DefaultReadTimeoutMillis { get; set; } public int MaxFakeDeviceNum { get; set; } + + public override string ToString() + { + return JsonSerializer.Serialize(this); + } } } diff --git a/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/Options/TasksOptions.cs b/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/Options/TasksOptions.cs index 21a1efcd..5d80bdea 100644 --- a/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/Options/TasksOptions.cs +++ b/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/Options/TasksOptions.cs @@ -3,6 +3,8 @@ // Licensed under the GPLv3 license. See LICENSE file in the project root for full license information. // +using System.Text.Json; + namespace GeothermalResearchInstitute.ServerConsole.Options { public class TasksOptions @@ -10,5 +12,10 @@ public class TasksOptions public int CollectAlarmIntervalMillis { get; set; } public int CollectMetricIntervalMillis { get; set; } + + public override string ToString() + { + return JsonSerializer.Serialize(this); + } } } diff --git a/GeothermalResearchInstitute/GeothermalResearchInstitute.Wpf/GeothermalResearchInstitute.Wpf.csproj b/GeothermalResearchInstitute/GeothermalResearchInstitute.Wpf/GeothermalResearchInstitute.Wpf.csproj index f9a52e2b..1178daee 100644 --- a/GeothermalResearchInstitute/GeothermalResearchInstitute.Wpf/GeothermalResearchInstitute.Wpf.csproj +++ b/GeothermalResearchInstitute/GeothermalResearchInstitute.Wpf/GeothermalResearchInstitute.Wpf.csproj @@ -11,7 +11,7 @@ False - + @@ -19,7 +19,7 @@ - + @@ -27,8 +27,9 @@ - - + + + diff --git a/GeothermalResearchInstitute/GeothermalResearchInstitute.Wpf/Options/CoreOptions.cs b/GeothermalResearchInstitute/GeothermalResearchInstitute.Wpf/Options/CoreOptions.cs index 5b0d7fd3..9e7d8934 100644 --- a/GeothermalResearchInstitute/GeothermalResearchInstitute.Wpf/Options/CoreOptions.cs +++ b/GeothermalResearchInstitute/GeothermalResearchInstitute.Wpf/Options/CoreOptions.cs @@ -3,6 +3,8 @@ // Licensed under the GPLv3 license. See LICENSE file in the project root for full license information. // +using System.Text.Json; + namespace GeothermalResearchInstitute.Wpf.Options { public class CoreOptions @@ -20,5 +22,10 @@ public class CoreOptions public int DefaultRefreshIntervalMillis { get; set; } = 1000; public int MaxErrorToleranceNum { get; set; } = 5; + + public override string ToString() + { + return JsonSerializer.Serialize(this); + } } } diff --git a/GeothermalResearchInstitute/GeothermalResearchInstitute.Wpf/ViewModels/WelcomeViewModel.cs b/GeothermalResearchInstitute/GeothermalResearchInstitute.Wpf/ViewModels/WelcomeViewModel.cs index 2caf3f4f..587b4cee 100644 --- a/GeothermalResearchInstitute/GeothermalResearchInstitute.Wpf/ViewModels/WelcomeViewModel.cs +++ b/GeothermalResearchInstitute/GeothermalResearchInstitute.Wpf/ViewModels/WelcomeViewModel.cs @@ -7,8 +7,10 @@ using System.ComponentModel; using System.Linq; using GeothermalResearchInstitute.Wpf.Common; +using GeothermalResearchInstitute.Wpf.Options; using GeothermalResearchInstitute.Wpf.Views; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; using Prism.Commands; using Prism.Mvvm; using Prism.Regions; @@ -18,12 +20,17 @@ namespace GeothermalResearchInstitute.Wpf.ViewModels public class WelcomeViewModel : BindableBase { private readonly ILogger logger; + private readonly IOptions coreOptions; private readonly IRegionManager regionManager; private ViewModelContext viewModelContext; - public WelcomeViewModel(ILogger logger, IRegionManager regionManager) + public WelcomeViewModel( + ILogger logger, + IOptions coreOptions, + IRegionManager regionManager) { - this.logger = logger; + this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); + this.coreOptions = coreOptions ?? throw new ArgumentNullException(nameof(coreOptions)); this.regionManager = regionManager ?? throw new ArgumentNullException(nameof(regionManager)); this.NavigateToLoginViewCommand = new DelegateCommand(this.ExecuteNavigateToLoginView); @@ -33,7 +40,7 @@ public WelcomeViewModel(ILogger logger, IRegionManager regionM this.NavigateToContactViewCommand = new DelegateCommand( this.ExecuteNavigateToContactView); - this.logger.LogInformation("Hello World!"); + this.logger.LogInformation("CoreOptions: {0}", this.coreOptions.Value); } public ViewModelContext ViewModelContext diff --git a/GrpcLoggerAdapater/GrpcLoggerAdapater/GrpcLoggerAdapater.csproj b/GrpcLoggerAdapater/GrpcLoggerAdapater/GrpcLoggerAdapater.csproj index 2482e70e..09d623b1 100644 --- a/GrpcLoggerAdapater/GrpcLoggerAdapater/GrpcLoggerAdapater.csproj +++ b/GrpcLoggerAdapater/GrpcLoggerAdapater/GrpcLoggerAdapater.csproj @@ -5,7 +5,7 @@ - + diff --git a/MicrosoftExtensions/Logging/Xunit/MicrosoftExtensions.Logging.Xunit.Tests/MicrosoftExtensions.Logging.Xunit.Tests.csproj b/MicrosoftExtensions/Logging/Xunit/MicrosoftExtensions.Logging.Xunit.Tests/MicrosoftExtensions.Logging.Xunit.Tests.csproj index 93cf564f..d764d902 100644 --- a/MicrosoftExtensions/Logging/Xunit/MicrosoftExtensions.Logging.Xunit.Tests/MicrosoftExtensions.Logging.Xunit.Tests.csproj +++ b/MicrosoftExtensions/Logging/Xunit/MicrosoftExtensions.Logging.Xunit.Tests/MicrosoftExtensions.Logging.Xunit.Tests.csproj @@ -10,7 +10,7 @@ - + all diff --git a/SharpCircularList/CircularList.UnitTest/CircularList.UnitTest.csproj b/SharpCircularList/CircularList.UnitTest/CircularList.UnitTest.csproj index da68b7f1..5f75c682 100644 --- a/SharpCircularList/CircularList.UnitTest/CircularList.UnitTest.csproj +++ b/SharpCircularList/CircularList.UnitTest/CircularList.UnitTest.csproj @@ -5,7 +5,7 @@ - + diff --git a/SwigDoc2Latex/SwigDoc2Latex.CsConsoleApp/SwigDoc2Latex.CsConsoleApp.csproj b/SwigDoc2Latex/SwigDoc2Latex.CsConsoleApp/SwigDoc2Latex.CsConsoleApp.csproj index 0204725b..fdd96f0d 100644 --- a/SwigDoc2Latex/SwigDoc2Latex.CsConsoleApp/SwigDoc2Latex.CsConsoleApp.csproj +++ b/SwigDoc2Latex/SwigDoc2Latex.CsConsoleApp/SwigDoc2Latex.CsConsoleApp.csproj @@ -6,7 +6,7 @@ - + diff --git a/TimeLimiter/TimeLimiterUnitTest/TimeLimiterUnitTest.csproj b/TimeLimiter/TimeLimiterUnitTest/TimeLimiterUnitTest.csproj index 757ebd9a..681a1e0b 100644 --- a/TimeLimiter/TimeLimiterUnitTest/TimeLimiterUnitTest.csproj +++ b/TimeLimiter/TimeLimiterUnitTest/TimeLimiterUnitTest.csproj @@ -18,7 +18,7 @@ - + all diff --git a/codelab/PrismLab/PrismLab.csproj b/codelab/PrismLab/PrismLab.csproj index 55103baa..730e3cb0 100644 --- a/codelab/PrismLab/PrismLab.csproj +++ b/codelab/PrismLab/PrismLab.csproj @@ -8,8 +8,8 @@ - - - + + + \ No newline at end of file diff --git a/codelab/TcpServerLab/TcpServerLab.csproj b/codelab/TcpServerLab/TcpServerLab.csproj index a7efb7dc..903265ea 100644 --- a/codelab/TcpServerLab/TcpServerLab.csproj +++ b/codelab/TcpServerLab/TcpServerLab.csproj @@ -21,8 +21,8 @@ - - + + diff --git a/codelab/TplLab/TplLab.csproj b/codelab/TplLab/TplLab.csproj index 361f8bcf..164412bd 100644 --- a/codelab/TplLab/TplLab.csproj +++ b/codelab/TplLab/TplLab.csproj @@ -6,8 +6,8 @@ - - + +