summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-08-28 19:09:56 +0200
committeremkael <emkael@tlen.pl>2019-10-27 14:53:42 +0100
commit7d2530a3ed498b129c3949b4c7d33f913ad34a94 (patch)
tree965fb8d7ec7fcefb163ca9a1f085f6e071f2818f
parentfdd66605fac1f10401601f8faf4bedbe1b58ce1c (diff)
Flushing file-based log on form exit
-rw-r--r--spedytor/Form1.Designer.cs1
-rw-r--r--spedytor/Form1.cs5
-rw-r--r--spedytor/Logger.cs8
3 files changed, 14 insertions, 0 deletions
diff --git a/spedytor/Form1.Designer.cs b/spedytor/Form1.Designer.cs
index f411cae..a0f77e3 100644
--- a/spedytor/Form1.Designer.cs
+++ b/spedytor/Form1.Designer.cs
@@ -204,6 +204,7 @@
this.MinimizeBox = false;
this.Name = "Form1";
this.Text = "Spedytor";
+ this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed);
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.nInterval)).EndInit();
this.ResumeLayout(false);
diff --git a/spedytor/Form1.cs b/spedytor/Form1.cs
index f3f47c6..928682a 100644
--- a/spedytor/Form1.cs
+++ b/spedytor/Form1.cs
@@ -181,5 +181,10 @@ namespace spedytor
{
Logger.getLogger(this.tbLog, LOG_FILENAME).tick();
}
+
+ private void Form1_FormClosed(object sender, FormClosedEventArgs e)
+ {
+ Logger.getLogger(this.tbLog, LOG_FILENAME).cleanup();
+ }
}
}
diff --git a/spedytor/Logger.cs b/spedytor/Logger.cs
index c32d91a..7b88177 100644
--- a/spedytor/Logger.cs
+++ b/spedytor/Logger.cs
@@ -80,5 +80,13 @@ namespace spedytor
}
}
}
+
+ public void cleanup()
+ {
+ if (this.file != null)
+ {
+ this.file.Close();
+ }
+ }
}
}