summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-10-27 16:48:26 +0100
committeremkael <emkael@tlen.pl>2019-10-27 20:49:04 +0100
commit552e29596026ed971c36afb411e840172e64ec42 (patch)
treec2afdf3e3178ff7801f2077870298fc104f6fc12
parentfb292fde3a9ca9ecb20a988861a416b9542642a6 (diff)
Optional dump/send on program exit, according to a dialog answer
-rw-r--r--spedytor/Form1.cs20
1 files changed, 18 insertions, 2 deletions
diff --git a/spedytor/Form1.cs b/spedytor/Form1.cs
index e7ccd26..093455b 100644
--- a/spedytor/Form1.cs
+++ b/spedytor/Form1.cs
@@ -26,6 +26,13 @@ namespace spedytor
private void bExit_Click(object sender, EventArgs e)
{
+ if (this.selectedDBs.Count > 0)
+ {
+ if (MessageBox.Show("Czy chcesz zrzucić/wysłać bazy przed zakończeniem działania programu?", "Spedytor - wyjście", MessageBoxButtons.YesNo) == DialogResult.Yes)
+ {
+ tInterval_Tick(null, null);
+ }
+ }
Logger.getLogger(this.tbLog, LOG_FILENAME).cleanup();
this.Dispose();
}
@@ -84,11 +91,12 @@ namespace spedytor
return null;
}
- private void invokeSave(string filePath, string dbName, bool enableControls = false)
+ private Thread invokeSave(string filePath, string dbName, bool enableControls = false)
{
Thread t = new Thread(() => this.saveFile(filePath, dbName, this.getBucketID(), enableControls));
t.IsBackground = true;
t.Start();
+ return t;
}
private string getDirectory()
@@ -201,10 +209,18 @@ namespace spedytor
}
if (this.repeatFilePath.Length > 0)
{
+ List<Thread> threadList = new List<Thread>();
foreach (string dbName in this.selectedDBs)
{
string filePath = Path.Combine(this.repeatFilePath, dbName + DateTime.Now.ToString("-yyyyMMdd-HHmmss") + ".sql");
- this.invokeSave(filePath, dbName, false);
+ threadList.Add(this.invokeSave(filePath, dbName, false));
+ }
+ if (e == null) // programmatic invoke, not actual button click
+ {
+ foreach (Thread t in threadList)
+ {
+ t.Join();
+ }
}
}
else