BenchInfo : Exception when 2nd instance created, ver. 3.1.1632

This commit is contained in:
Milan Hanajik 2021-03-15 12:41:28 +01:00
parent f74fff9b51
commit d287902f62
2 changed files with 7 additions and 2 deletions

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.1.1631.0")]
[assembly: AssemblyFileVersion("3.1.1631.0")]
[assembly: AssemblyVersion("3.1.1632.0")]
[assembly: AssemblyFileVersion("3.1.1632.0")]

View File

@ -17,6 +17,8 @@ namespace TBF.Rig.DataContainer.BenchInfo
public class Component : ComponentBase, GenericDevices.IBenchInfo
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
static int instances = 0;
public override string ToString() { return string.Format("BenchInfo({0})", Cfg.ToString(-1)); }
readonly ComponentCfg myCfg;
@ -39,7 +41,10 @@ namespace TBF.Rig.DataContainer.BenchInfo
{
myCfg = cfg as ComponentCfg;
Events.DB.SetBenchName(myCfg.TestBenchName);
log.Warn(this.ToString());
instances++;
if (instances > 1) throw new Exception("Second or next instance of BenchInfo !!!");
}
}
}