Winify
/trunk/Winify/MainForm.cs |
@@ -30,6 +30,8 @@ |
|
public ScheduledContinuation ChangedConfigurationContinuation { get; set; } |
|
public bool MemorySinkEnabled { get; set; } |
|
#endregion |
|
#region Private Delegates, Events, Enums, Properties, Indexers and Fields |
@@ -46,6 +48,10 @@ |
|
private readonly CancellationToken _cancellationToken; |
|
private LogViewForm _logViewForm; |
|
private readonly LogMemorySink _memorySink; |
|
#endregion |
|
#region Constructors, Destructors and Finalizers |
@@ -62,8 +68,10 @@ |
{ |
InitializeComponent(); |
|
_memorySink = new LogMemorySink(); |
Log.Logger = new LoggerConfiguration() |
.MinimumLevel.Debug() |
.WriteTo.Conditional(condition => MemorySinkEnabled, configureSink => configureSink.Sink(_memorySink)) |
.WriteTo.File(Path.Combine(Constants.UserApplicationDirectory, "Logs", $"{Constants.AssemblyName}.log"), |
rollingInterval: RollingInterval.Day) |
.CreateLogger(); |
@@ -298,6 +306,7 @@ |
{ |
Server = new BindingListWithCollectionChanged<Server>() |
}; |
|
foreach (var server in servers.Server) |
{ |
var password = Encoding.UTF8.GetBytes(server.Password); |
@@ -377,5 +386,29 @@ |
} |
|
#endregion |
|
private void LogViewToolStripMenuItem_Click(object sender, EventArgs e) |
{ |
if (_logViewForm != null) |
{ |
return; |
} |
|
_logViewForm = new LogViewForm(this, _memorySink, _cancellationToken); |
_logViewForm.Closing += LogViewForm_Closing; |
_logViewForm.Show(); |
} |
|
private void LogViewForm_Closing(object sender, CancelEventArgs e) |
{ |
if (_logViewForm == null) |
{ |
return; |
} |
|
_logViewForm.Closing -= LogViewForm_Closing; |
_logViewForm.Close(); |
_logViewForm = null; |
} |
} |
} |