/Zzz/MainForm.cs |
@@ -10,7 +10,6 @@ |
using System.Threading.Tasks; |
using System.Windows.Forms; |
using Configuration; |
using MQTTnet.Client.Subscribing; |
using NetSparkleUpdater.Enums; |
using NetSparkleUpdater.SignatureVerifiers; |
using NetSparkleUpdater.UI.WinForms; |
@@ -24,6 +23,8 @@ |
using Zzz.Utilities.Serialization; |
using System.Reflection; |
using System.Net; |
using MQTTnet.Client; |
using MqttClient = Zzz.Clients.MqttClient; |
|
namespace Zzz |
{ |
@@ -55,6 +56,8 @@ |
|
private LogMemorySink _memorySink; |
|
private readonly object _memorySinkLock; |
|
private LogViewForm _logViewForm; |
|
private SparkleUpdater _sparkle; |
@@ -71,13 +74,19 @@ |
{ |
InitializeComponent(); |
_memorySink = new LogMemorySink(); |
_memorySinkLock = new object(); |
|
lock (_memorySinkLock) |
{ |
Log.Logger = new LoggerConfiguration() |
.MinimumLevel.Debug() |
.WriteTo.Conditional(condition => MemorySinkEnabled, configureSink => configureSink.Sink(_memorySink)) |
.WriteTo.File(Path.Combine(Constants.UserApplicationDirectory, "Logs", $"{Constants.AssemblyName}.log"), |
.WriteTo.Conditional(condition => MemorySinkEnabled, |
configureSink => configureSink.Sink(_memorySink)) |
.WriteTo.File( |
Path.Combine(Constants.UserApplicationDirectory, "Logs", $"{Constants.AssemblyName}.log"), |
rollingInterval: RollingInterval.Day) |
.CreateLogger(); |
} |
|
// Initialize the sleeper. |
_trigger = new ActionTrigger(Handle); |
@@ -167,10 +176,13 @@ |
return; |
} |
|
_logViewForm = new LogViewForm(this, _memorySink); |
lock (_memorySinkLock) |
{ |
_logViewForm = new LogViewForm(this, _memorySink, _memorySinkLock); |
_logViewForm.Closing += LogViewFormClosing; |
_logViewForm.Show(); |
} |
} |
|
private void LogViewFormClosing(object sender, CancelEventArgs e) |
{ |