From 08aed03cef694e9b113a3dee2b35f514998a5bed Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Mon, 24 Aug 2015 16:04:31 +0200 Subject: [PATCH] Info message when at least one of the components is in Simulation mode, version 1.5.98. --- TestBenchFramework/BenchControl/StateMachine.cs | 16 +++++++++++++++- TestBenchFramework/MainWnd.cs | 7 ++++++- TestBenchFramework/Properties/AssemblyInfo.cs | 4 ++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/TestBenchFramework/BenchControl/StateMachine.cs b/TestBenchFramework/BenchControl/StateMachine.cs index 82a591774..1816eecbb 100644 --- a/TestBenchFramework/BenchControl/StateMachine.cs +++ b/TestBenchFramework/BenchControl/StateMachine.cs @@ -252,11 +252,20 @@ namespace TBF.BenchControl ControlBoard.InitializeComponent(ctrlBrdComponent, valvesToInvert, tankCapacities); } - public static void InitializeDevices() + public static string InitializeDevices() { + bool anyComponentIsInSimulMode = false; + StringBuilder inSimulMode = new StringBuilder(); + /// Add all devices to the state machine and initialize them foreach (var cmpnt in components) { + if (cmpnt.DebugLevel == Entities.DebugMode.Simulate) + { + inSimulMode.AppendFormat("{0}{1}", anyComponentIsInSimulMode ? ", " : "", cmpnt.Name); + anyComponentIsInSimulMode = true; + } + if (cmpnt is IDevice) { AddDevice(cmpnt as IDevice); @@ -276,6 +285,11 @@ namespace TBF.BenchControl } } } + + if (anyComponentIsInSimulMode) + return inSimulMode.ToString(); + else + return null; } /// diff --git a/TestBenchFramework/MainWnd.cs b/TestBenchFramework/MainWnd.cs index cd15d3da9..ee2da2e02 100644 --- a/TestBenchFramework/MainWnd.cs +++ b/TestBenchFramework/MainWnd.cs @@ -140,7 +140,12 @@ namespace TBF { try { - BenchControl.StateMachine.InitializeDevices(); + string message = BenchControl.StateMachine.InitializeDevices(); + if (message != null) + { + MessageBox.Show("The following components are in simulation mode: \r\n" + message, + "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information); + } //emergencyStopModelessDlg = new TBF.Forms.EmergencyStopForm(); //emergencyStopModelessDlg.Show(); diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index 31db6309d..15049efa0 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("1.5.97.1")] -[assembly: AssemblyFileVersion("1.5.97.1")] +[assembly: AssemblyVersion("1.5.98.1")] +[assembly: AssemblyFileVersion("1.5.98.1")]