From 32a8b95c324d5bb9679e20262f2678cabec3a4c0 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Tue, 19 Jul 2016 10:13:57 +0200 Subject: [PATCH] Multiple running instances of TBF program tested. --- TestBenchFramework/Program.cs | 8 ++++++++ TestBenchFramework/Resources/Strings.Designer.cs | 9 +++++++++ TestBenchFramework/Resources/Strings.cs.resx | 3 +++ TestBenchFramework/Resources/Strings.de.resx | 3 +++ TestBenchFramework/Resources/Strings.resx | 3 +++ 5 files changed, 26 insertions(+) diff --git a/TestBenchFramework/Program.cs b/TestBenchFramework/Program.cs index edc84bb45..741d9100f 100644 --- a/TestBenchFramework/Program.cs +++ b/TestBenchFramework/Program.cs @@ -66,6 +66,14 @@ namespace TBF Version = string.Format("{0}.{1}.{2}", ver.Major, ver.Minor, ver.Build); BuildDateTime = new System.IO.FileInfo(thisAssembly.Location).LastWriteTime; + /// Check if another instance is running + string processName = System.IO.Path.GetFileNameWithoutExtension(thisAssembly.Location); + if (System.Diagnostics.Process.GetProcessesByName(processName).Length > 1) + { + MessageBox.Show(Strings.Another_instance_is_running, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); + return; + } + /// Local program configuration directory including the trailing backslash string locAppDataDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + Path.DirectorySeparatorChar + "TestBenchFramework" + Path.DirectorySeparatorChar; diff --git a/TestBenchFramework/Resources/Strings.Designer.cs b/TestBenchFramework/Resources/Strings.Designer.cs index 781298615..ebb11b903 100644 --- a/TestBenchFramework/Resources/Strings.Designer.cs +++ b/TestBenchFramework/Resources/Strings.Designer.cs @@ -222,6 +222,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Another instance of Test Bench Framework program is running. Please, close it using Task Manager.. + /// + internal static string Another_instance_is_running { + get { + return ResourceManager.GetString("Another_instance_is_running", resourceCulture); + } + } + /// /// Looks up a localized string similar to Approval. /// diff --git a/TestBenchFramework/Resources/Strings.cs.resx b/TestBenchFramework/Resources/Strings.cs.resx index 171091e57..f73f15de4 100644 --- a/TestBenchFramework/Resources/Strings.cs.resx +++ b/TestBenchFramework/Resources/Strings.cs.resx @@ -1266,4 +1266,7 @@ Stručný popis + + Další instance programu Test Bench Framework je spuštěna. Uzavřete jí prosím s použitím 'Správce úloh'. + \ No newline at end of file diff --git a/TestBenchFramework/Resources/Strings.de.resx b/TestBenchFramework/Resources/Strings.de.resx index 4d48f8f82..f37327e3e 100644 --- a/TestBenchFramework/Resources/Strings.de.resx +++ b/TestBenchFramework/Resources/Strings.de.resx @@ -1341,4 +1341,7 @@ Kurzbeschreibung + + Ein weiteres Test Bench Framework Programm-Instanz ausgeführt wird. Bitte schließen Sie es dem Taskmanager. + \ No newline at end of file diff --git a/TestBenchFramework/Resources/Strings.resx b/TestBenchFramework/Resources/Strings.resx index 2fb311880..5c031a7fc 100644 --- a/TestBenchFramework/Resources/Strings.resx +++ b/TestBenchFramework/Resources/Strings.resx @@ -1510,4 +1510,7 @@ T hi. ref. + + Another instance of Test Bench Framework program is running. Please, close it using Task Manager. + \ No newline at end of file