Multiple running instances of TBF program tested.

This commit is contained in:
Milan Hanajik
2016-07-19 10:13:57 +02:00
parent 687bc3ed0c
commit 32a8b95c32
5 changed files with 26 additions and 0 deletions
+8
View File
@@ -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;