(1) TBF program shutdown modifications, (2) Obligatory tank draining before TBF exit, (3) Shutdown PC after TBF exit option, ver. 2.18.1156

This commit is contained in:
Milan Hanajik 2019-03-04 13:14:13 +01:00
parent b10ab44fa9
commit 771af696ae
15 changed files with 773 additions and 400 deletions

View File

@ -14,6 +14,7 @@ using TBF.BenchControl.Operations;
using TBF.BenchControl.GenericDevices;
using TBF.Boxes;
using TBF.Resources;
using System.Threading;
namespace TBF.BenchControl.Sequences
{
@ -228,7 +229,7 @@ namespace TBF.BenchControl.Sequences
/// </summary>
/// <param name="dummyArg"></param>
/// <returns></returns>
public IList<Event> Execute(Test dummyArg)
public void Execute()
{
IList<Event> e;
Selection selection;
@ -347,7 +348,7 @@ namespace TBF.BenchControl.Sequences
//--------------------------------------------------------------------------------------------
Bridge.OnActivity(this, Strings.Resetting_scales);
//--------------------------------------------------------------------------------------------
Bridge.Bench2UI(ButtonsEtc.StopBtnEn);
Bridge.Bench2UI(ButtonsEtc.StopBtnEn); /// Resetting scales : Enable STOP button
DoubleBox tara1 = new DoubleBox(0);
DoubleBox tara2 = new DoubleBox(0);
@ -387,7 +388,17 @@ namespace TBF.BenchControl.Sequences
do
{
selection = MakeSelection(MKSelContext.ProcedureNotSelected);
do
{
selection = MakeSelection(MKSelContext.ProcedureNotSelected);
if (selection == Selection.Shutdown)
{
Shutdown();
return;
}
}
while (selection == Selection.Shutdown);
switch (selection)
{
case Selection.Q1: selectedTestName = "Q1"; break;
@ -446,7 +457,7 @@ namespace TBF.BenchControl.Sequences
///
StateMachine.ControlBoard.ManualUIAllowed = !StateMachine.Procedure.ManualCtrlDisabled;
Bridge.Bench2UI(ButtonsEtc.StopBtnEn); /// Enable STOP button
Bridge.Bench2UI(ButtonsEtc.StopBtnEn); /// A new cycle started : Enable STOP button
int newBatchNr = Program.LocalSettings.BatchNr;
log.FatalFormat("New measurement session started: batch = {0}, procedure = {1}", newBatchNr, StateMachine.Procedure.Name);
@ -1272,9 +1283,17 @@ namespace TBF.BenchControl.Sequences
//--------------------------------
State.Create("MainSeq : ERROR state")
.AddOperation(checkUiOp)
.AddOperation(StateMachine.BenchErrorOp)
.EnterState();
while (true) StateMachine.WaitRunDevsRunOps();
do
{
e = StateMachine.WaitRunDevsRunOps();
}
while (!e.Contains(Event.UiCmdShutdown));
Shutdown(true);
return;
}
@ -1315,7 +1334,7 @@ namespace TBF.BenchControl.Sequences
/// <returns>
/// Selection.PurgeBegin, PurgeEnd, Break, Cycle, Test, Q1, Q2, Q3 or SaveResults
/// </returns>
private Selection MakeSelection(MKSelContext context)
Selection MakeSelection(MKSelContext context)
{
log.WarnFormat("MakeSelection({0})", context);
@ -1384,7 +1403,8 @@ namespace TBF.BenchControl.Sequences
if (draining3 && StateMachine.Tank3.IsEmpty()) break;
/// Quit the selection loop and leave MakeSelection()
if (e.Contains(Event.UiCmdBreak) && context == MKSelContext.InsideProcedure) return Selection.Break;
if (e.Contains(Event.UiCmdShutdown) && (context == MKSelContext.ProcedureNotSelected)) return Selection.Shutdown;
if (e.Contains(Event.UiCmdBreak) && (context == MKSelContext.InsideProcedure)) return Selection.Break;
if (e.Contains(Event.UiCmdPurgeBegin)) return Selection.PurgeBegin;
if (e.Contains(Event.UiCmdPurgeEnd)) return Selection.PurgeEnd;
if (e.Contains(Event.UiCmdStartCycle)) return Selection.Cycle;
@ -1404,9 +1424,16 @@ namespace TBF.BenchControl.Sequences
Bridge.OnActivity(this, Strings.Error);
///------------------------------------
State.Create("MainSeq : ERROR state")
.AddOperation(checkUiOp)
.AddOperation(StateMachine.BenchErrorOp)
.EnterState();
while (true) StateMachine.WaitRunDevsRunOps(); /// Endless loop
do
{
e = StateMachine.WaitRunDevsRunOps();
}
while (!e.Contains(Event.UiCmdShutdown));
return Selection.Shutdown;
}
else
{
@ -1471,6 +1498,90 @@ namespace TBF.BenchControl.Sequences
}
}
void Shutdown(bool skipTankDraining = false)
{
log.WarnFormat(string.Format("Shutdown(skipTankDraining={0})", skipTankDraining));
StateMachine.MachineState = MachineState.ShuttingDown; /// TBF shut down cannot be aborted from now on
Bridge.Bench2UI(0); /// All buttons off
if (!skipTankDraining)
{
/// Drain time
int maxDrainTime = 0;
if ((StateMachine.Tank1 != null) && (StateMachine.Tank1.EmptyTimeSec > maxDrainTime)) maxDrainTime = StateMachine.Tank1.EmptyTimeSec;
if ((StateMachine.Tank2 != null) && (StateMachine.Tank2.EmptyTimeSec > maxDrainTime)) maxDrainTime = StateMachine.Tank2.EmptyTimeSec;
if ((StateMachine.Tank3 != null) && (StateMachine.Tank3.EmptyTimeSec > maxDrainTime)) maxDrainTime = StateMachine.Tank3.EmptyTimeSec;
/// Drain valves
IList<IValve> drainValves = new List<IValve>();
if (StateMachine.DrainValve1 != null) drainValves.Add(StateMachine.DrainValve1);
if (StateMachine.DrainValve2 != null) drainValves.Add(StateMachine.DrainValve2);
if (StateMachine.DrainValve3 != null) drainValves.Add(StateMachine.DrainValve3);
/// Open all drain valves
if (drainValves.Count > 0)
{
Bridge.OnActivity(this, Strings.Emptying_tank); /// Activity message
State.Create("Open all drain valves")
.AddOperation(StateMachine.ControlBoard.SetValvesOp(drainValves, null))
.EnterState();
while (StateMachine.WaitRunDevsRunOps().Contains(Event.ValvesBusy)) { }
}
/// Tank emptying valves states
bool draining1 = (StateMachine.DrainValve1 != null);
bool draining2 = (StateMachine.DrainValve2 != null);
bool draining3 = (StateMachine.DrainValve3 != null);
int drainingStartTime = StateMachine.Time;
/// Quit the following loop when time expires or all tanks are empty
while ((StateMachine.Time < drainingStartTime + maxDrainTime) && (draining1 || draining2 || draining3))
{
int remTime = drainingStartTime + maxDrainTime - StateMachine.Time;
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Emptying_tank, remTime / 60, "min", remTime % 60, Strings.sec));
DoubleBox mass1 = new DoubleBox();
DoubleBox mass2 = new DoubleBox();
DoubleBox mass3 = new DoubleBox();
///
State.Create("MainSeq : Reading mass")
.AddOperation(checkUiOp)
.AddOperation((StateMachine.Tank1 is IScale) ? (StateMachine.Tank1 as IScale).ReadMassOp(ref mass1) : null)
.AddOperation((StateMachine.Tank2 is IScale) ? (StateMachine.Tank2 as IScale).ReadMassOp(ref mass2) : null)
.AddOperation((StateMachine.Tank3 is IScale) ? (StateMachine.Tank3 as IScale).ReadMassOp(ref mass3) : null)
.EnterState();
while (StateMachine.WaitRunDevsRunOps().Contains(Event.Busy)) { }
if (draining1 && StateMachine.Tank1.IsEmpty()) draining1 = false;
if (draining2 && StateMachine.Tank2.IsEmpty()) draining2 = false;
if (draining3 && StateMachine.Tank3.IsEmpty()) draining3 = false;
}
/// Close all drain valves
if (drainValves.Count > 0)
{
State.Create("Close all drain valves")
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, drainValves))
.EnterState();
while (StateMachine.WaitRunDevsRunOps().Contains(Event.ValvesBusy)) { }
}
}
///
/// Shut down the state machine
///
Bridge.OnActivity(this, Strings.Shutting_down_devices); /// Activity message
State.Create("No operations").EnterState(); /// Stop all operations
StateMachine.WaitRunDevsRunOps(true);
BenchControl.StateMachine.StopDevices(); /// Stop all devices - phase 1
Thread.Sleep(100);
BenchControl.StateMachine.StopDevices2(); /// Stop all devices - phase 2
}
/// <summary>
/// Create a new empty batch results from the procedure

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Text;
@ -16,9 +16,17 @@ using TBF.Resources;
namespace TBF.BenchControl
{
public class QuitStateMachineException : Exception
{
}
public enum MachineState
{
Undefined = 0,
Disabled,
StartingUp, /// Start-up: Initialize() of all devices + start of the worker thread
FailedToStart, /// Most likely Initialize() of any device thrown an exception
Running, /// RunDeviceBefore() and RunDeviceAfter() of all devices, Start()/Run()/Stop() of operations
ShuttingDown, /// Shutdown: StopDevice() and StopDevice2() of all devices
Off, /// Off after the shutdown
}
/// <summary>
/// This class controls real test bench behavior.
@ -67,11 +75,8 @@ namespace TBF.BenchControl
static DateTime startDateTime; /// DateTime of time instance when the state machine worker thread starts
static int currentTimeSec; /// Time from the start of the state machine in seconds
static bool quitStateMachine; /// flag to stop the worker thread
/// true when the state machine is running
static bool stateMachineRunning;
public static bool Running { get { return stateMachineRunning; } }
public static MachineState MachineState; /// see enum MachineState for explanation
/// Worker thread and database session
static Thread workerThread;
@ -136,9 +141,7 @@ namespace TBF.BenchControl
{
devices = new List<IDevice>();
states = new List<State>();
currentTimeSec = 0;
quitStateMachine = false;
}
/// <summary>
@ -504,13 +507,18 @@ namespace TBF.BenchControl
/// </summary>
public static void Start()
{
if (stateMachineRunning) return;
if (MachineState != MachineState.StartingUp)
{
/// Unexpected MachineState (not MachineState.StartingUp) --> prevent worker thread from starting
///
MachineState = MachineState.FailedToStart;
return;
}
workerThread = new Thread(Worker);
workerThread.CurrentCulture = Thread.CurrentThread.CurrentCulture;
workerThread.CurrentUICulture = Thread.CurrentThread.CurrentUICulture;
workerThread.Start();
stateMachineRunning = true;
}
/// <summary>
@ -712,15 +720,6 @@ namespace TBF.BenchControl
}
/// <summary>
/// Stops the state machine (and the worker thread)
/// </summary>
public static void Stop()
{
if (stateMachineRunning) quitStateMachine = true;
}
/*
* This is and example sequence of RunDeviceBefore() / RunOperations() / RunDeviceAfter() calls
* as they are executed during normal run from the progran start to the end.
@ -757,32 +756,32 @@ namespace TBF.BenchControl
/// </summary>
static void Worker()
{
MachineState = MachineState.Running;
startDateTime = DateTime.Now;
CycleStartTimeStamp = startDateTime; /// To prevent it is undefined
CycleStartTimeStamp = startDateTime; /// Do not leave CycleStartTimeStamp uninitialized
wlog.InfoFormat(" currentTime = {0}s startDateTime = {1}", currentTimeSec.ToString(), startDateTime.ToString());
/// Run all devices for the first time
foreach (var device in devices) device.RunDeviceBefore();
try
{
SequenceBase.ReferenceFlowmetersCount = SequenceBase.FlowMeters.Count;
SequenceBase.CalibratedLtrPerRefPulse = new float[SequenceBase.ReferenceFlowmetersCount];
foreach (var flowmtr in SequenceBase.FlowMeters)
SequenceBase.ReferenceFlowmetersCount = SequenceBase.FlowMeters.Count;
SequenceBase.CalibratedLtrPerRefPulse = new float[SequenceBase.ReferenceFlowmetersCount];
foreach (var flowmtr in SequenceBase.FlowMeters)
{
int ix = flowmtr.Idx1;
if (ix > 0 && ix <= SequenceBase.ReferenceFlowmetersCount)
{
int ix = flowmtr.Idx1;
if (ix > 0 && ix <= SequenceBase.ReferenceFlowmetersCount)
{
SequenceBase.CalibratedLtrPerRefPulse[ix - 1] = flowmtr.NominalFlow / 7200.0f;
}
SequenceBase.CalibratedLtrPerRefPulse[ix - 1] = flowmtr.NominalFlow / 7200.0f;
}
(new Sequences.MainSeq()).Execute(null);
}
catch (QuitStateMachineException)
{
}
///
/// Run the main sequence
///
(new Sequences.MainSeq()).Execute();
StateMachine.MachineState = MachineState.Off; /// Update StateMachine.MachineState
TBF.UiBridge.Bridge.Bench2UI(TBF.UiBridge.ButtonsEtc.Shutdown); /// Let UI know the state machine is shut down now
}
@ -790,34 +789,35 @@ namespace TBF.BenchControl
/// Do stuff that is repeated in the state execution loops most often
/// </summary>
/// <returns>List of Event-s returned from the state operations, null == quit</returns>
public static IList<Event> WaitRunDevsRunOps()
public static IList<Event> WaitRunDevsRunOps(bool lastTime = false)
{
Thread.Sleep(100); /// Insert 1/10 sec.delay between RunOperations() and RunDeviceAfter()
foreach (var device in devices) device.RunDeviceAfter();
foreach (var device in devices)
{
device.RunDeviceAfter();
}
if (WaitNextTick())
WaitNextTick();
if (lastTime)
{
///
/// Executed when the state machine is stopped
/// Executed when the state machine is being stopped
///
wlog.Fatal("quitStateMachine == true ... The last StopOperaions() start now");
State.StopOperations();
stateMachineRunning = false;
wlog.Fatal("StopOperaions() completed ... stateMachineRunning = false)");
throw new QuitStateMachineException();
return null;
}
foreach (var device in devices) device.RunDeviceBefore();
Thread.Sleep(100); /// Insert 1/10 sec.delay between RunDeviceBefore() and RunOperations()
foreach (var device in devices)
{
device.RunDeviceBefore();
}
IList<Event> events = State.RunOperations();
return events;
///
/// This is followed by a state change in the sequence
///
Thread.Sleep(100); /// Insert 1/10 sec.delay between RunDeviceBefore() and RunOperations()
return State.RunOperations(); /// Returns events from all running operations
/// This is followed by a state change in the sequence
}
@ -825,20 +825,15 @@ namespace TBF.BenchControl
/// Wait time period - synchronize
/// </summary>
/// <returns>true when interrupted by 'quitStateMachine', otherwise false</returns>
public static bool WaitNextTick()
public static void WaitNextTick()
{
currentTimeSec += Period;
DateTime nextTickDateTime = startDateTime + TimeSpan.FromSeconds(currentTimeSec);
TimeSpan timeFromStart = TimeSpan.FromSeconds(currentTimeSec);
DateTime nextLoopDateTime = startDateTime + timeFromStart;
while (DateTime.Now < nextLoopDateTime)
while (DateTime.Now < nextTickDateTime)
{
Thread.Sleep(100);
if (quitStateMachine) return true;
}
return false;
}
}
}

100
TBF/Forms/ClosingTbfForm.Designer.cs generated Normal file
View File

@ -0,0 +1,100 @@
namespace TBF.Forms
{
partial class ClosingTbfForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.messageLabel = new System.Windows.Forms.Label();
this.shutDownPCCheckBox = new System.Windows.Forms.CheckBox();
this.yesButton = new System.Windows.Forms.Button();
this.noButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// messageLabel
//
this.messageLabel.AutoSize = true;
this.messageLabel.Location = new System.Drawing.Point(39, 33);
this.messageLabel.Name = "messageLabel";
this.messageLabel.Size = new System.Drawing.Size(220, 13);
this.messageLabel.TabIndex = 0;
this.messageLabel.Text = "Do you want to exit Test Bench Framework ?";
//
// shutDownPCCheckBox
//
this.shutDownPCCheckBox.AutoSize = true;
this.shutDownPCCheckBox.Location = new System.Drawing.Point(42, 66);
this.shutDownPCCheckBox.Name = "shutDownPCCheckBox";
this.shutDownPCCheckBox.Size = new System.Drawing.Size(294, 17);
this.shutDownPCCheckBox.TabIndex = 1;
this.shutDownPCCheckBox.Text = "Shut down computer after exiting Test Bench Framework";
this.shutDownPCCheckBox.UseVisualStyleBackColor = true;
//
// yesButton
//
this.yesButton.DialogResult = System.Windows.Forms.DialogResult.Yes;
this.yesButton.Location = new System.Drawing.Point(104, 109);
this.yesButton.Name = "yesButton";
this.yesButton.Size = new System.Drawing.Size(88, 32);
this.yesButton.TabIndex = 2;
this.yesButton.Text = "Yes";
this.yesButton.UseVisualStyleBackColor = true;
this.yesButton.Click += new System.EventHandler(this.yesButton_Click);
//
// noButton
//
this.noButton.DialogResult = System.Windows.Forms.DialogResult.No;
this.noButton.Location = new System.Drawing.Point(212, 109);
this.noButton.Name = "noButton";
this.noButton.Size = new System.Drawing.Size(88, 32);
this.noButton.TabIndex = 3;
this.noButton.Text = "No";
this.noButton.UseVisualStyleBackColor = true;
//
// ClosingTbfForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(404, 153);
this.Controls.Add(this.noButton);
this.Controls.Add(this.yesButton);
this.Controls.Add(this.shutDownPCCheckBox);
this.Controls.Add(this.messageLabel);
this.Name = "ClosingTbfForm";
this.Text = "Closing the program";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label messageLabel;
private System.Windows.Forms.CheckBox shutDownPCCheckBox;
private System.Windows.Forms.Button yesButton;
private System.Windows.Forms.Button noButton;
}
}

View File

@ -0,0 +1,28 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using TBF.Resources;
namespace TBF.Forms
{
public partial class ClosingTbfForm : Form
{
public bool ShutDownPC;
public ClosingTbfForm()
{
InitializeComponent();
ShutDownPC = false;
Text = Strings.Closing_the_program;
messageLabel.Text = Strings.Do_you_want_to_exit_TBF;
shutDownPCCheckBox.Text = Strings.Shut_down_computer_after_exiting_TBF;
}
private void yesButton_Click(object sender, EventArgs e)
{
ShutDownPC = shutDownPCCheckBox.Checked;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-201 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -25,14 +25,19 @@ namespace TBF
public UiControls.BenchControlPanel BenchControlPanel;
public ProcedureInfo SelectedProcedure;
public Procedure CurrentProcedure;
public bool CycleRunning;
public bool IsShutdownDisabled;
public bool IsShutdownPCAfterClosingTbf;
/// <summary>
/// This dialog is shown when emergency stop is activated
/// </summary>
TBF.Forms.EmergencyStopForm emergencyStopModelessDlg;
bool benchInitializationFailed;
/// <summary>
/// This dialog is shown when TBF program is shutting down
/// </summary>
TBF.Forms.ModelessActivityForm closingTbfMessageForm;
TestProgressControls testProgressControls;
/// <summary>
@ -119,11 +124,12 @@ namespace TBF
iPerlHeadsToolStripMenuItem.Visible = false;
#endif
CycleRunning = true;
IsShutdownDisabled = true;
IsShutdownPCAfterClosingTbf = false;
benchInitializationFailed = false;
BenchControl.StateMachine.MachineState = Config.Data.CurrentBench.IsRealBench ? BenchControl.MachineState.StartingUp : BenchControl.MachineState.Disabled;
///
if (Config.Data.CurrentBench.IsRealBench)
if (BenchControl.StateMachine.MachineState == BenchControl.MachineState.StartingUp)
{
try
{
@ -146,7 +152,7 @@ namespace TBF
}
catch (Exception exc)
{
benchInitializationFailed = true;
BenchControl.StateMachine.MachineState = BenchControl.MachineState.FailedToStart;
string errMsg;
if (string.IsNullOrEmpty(BenchControl.TbfComponents.CurrentlyLoadedComponentName))
@ -197,9 +203,8 @@ namespace TBF
Left = (ls.MainWndLeft != 0) ? ls.MainWndLeft : 75;
Top = (ls.MainWndTop != 0) ? ls.MainWndTop : 5;
}
if (Config.Data.CurrentBench.IsRealBench && !benchInitializationFailed)
if (TBF.BenchControl.StateMachine.MachineState == TBF.BenchControl.MachineState.StartingUp)
{
var form = new TBF.Forms.ModelessActivityForm()
{
@ -264,7 +269,7 @@ namespace TBF
}
catch (Exception exc)
{
benchInitializationFailed = true;
TBF.BenchControl.StateMachine.MachineState = TBF.BenchControl.MachineState.FailedToStart;
form.CloseForm(null, new EventArgs());
formThread.Join();
@ -320,21 +325,18 @@ namespace TBF
UpdateUser();
mainTabControl.SelectTab((int)MainTabPageId.Hydraulics);
if (Config.Data.CurrentBench.IsRealBench)
if (TBF.BenchControl.StateMachine.MachineState == TBF.BenchControl.MachineState.StartingUp)
{
if (!benchInitializationFailed)
{
BenchControl.StateMachine.Start();
log.Info("Test bench started");
}
else
{
BenchControlPanel.OnButtonsEtc(null, new ButtonsEtcEventArgs(TBF.UiBridge.ButtonsEtc.None));
MessageBox.Show(Strings.Bench_is_not_running,
Strings.Warning,
System.Windows.Forms.MessageBoxButtons.OK,
System.Windows.Forms.MessageBoxIcon.Exclamation);
}
BenchControl.StateMachine.Start();
log.Info("Test bench started");
}
else if (TBF.BenchControl.StateMachine.MachineState == TBF.BenchControl.MachineState.FailedToStart)
{
BenchControlPanel.OnButtonsEtc(null, new ButtonsEtcEventArgs(ButtonsEtc.None));
MessageBox.Show(Strings.Bench_is_not_running,
Strings.Warning,
System.Windows.Forms.MessageBoxButtons.OK,
System.Windows.Forms.MessageBoxIcon.Exclamation);
}
}
@ -402,23 +404,48 @@ namespace TBF
mainProgressBar.Value = 0;
}
/// <summary>
/// This handler is onvoked when state of buttons changes
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
void OnButtonsEtc(object sender, UiBridge.ButtonsEtcEventArgs args)
{
if ((args.Flags & ButtonsEtc.Shutdown) != 0)
{
///
/// TBF program is shutting down and the state machine was proparly stopped
///
UI2Settings();
if (closingTbfMessageForm != null) closingTbfMessageForm.CloseForm(this, null);
if (IsShutdownPCAfterClosingTbf)
{
var psi = new System.Diagnostics.ProcessStartInfo("shutdown", "/s /t 0");
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
System.Diagnostics.Process.Start(psi);
}
Close();
return;
}
if (((args.Flags & ButtonsEtc.ShowBenchEmpty) != 0) ||
((args.Flags & ButtonsEtc.ShowBenchFilled) != 0))
{
return;
}
CycleRunning = ((args.Flags & UiBridge.ButtonsEtc.ProcedureCmbBoxEn) == 0);
procedureComboBox.Enabled = ((args.Flags & ButtonsEtc.ProcedureCmbBoxEn) != 0);
iPerlHeadsToolStripMenuItem.Enabled = ((args.Flags & ButtonsEtc.ProcedureCmbBoxEn) != 0);
procedureComboBox.Enabled = !CycleRunning;
iPerlHeadsToolStripMenuItem.Enabled = !CycleRunning;
if (!CycleRunning && ProceduresUpdated)
if (procedureComboBox.Enabled && ProceduresUpdated)
{
ReloadProcedureComboBoxItems();
}
IsShutdownDisabled = ((args.Flags & ButtonsEtc.ProcedureCmbBoxEn) == 0);
}
public void UpdateUser()
@ -607,37 +634,63 @@ namespace TBF
}
}
private void MainWnd_FormClosing(object sender, FormClosingEventArgs e)
/// <summary>
/// Save UI settings to Program.LocalSettings and save them to a file.
/// UI settings are:
/// MainWnd size and location and splitter distances.
/// </summary>
void UI2Settings()
{
Program.LocalSettings.RightPaneHorizSplitterDistance = rightHorizSplitContainer.SplitterDistance;
Program.LocalSettings.TopPaneVerticalSplitterDistance = topVerticalSplitContainer.SplitterDistance;
LocalSettings ls = Program.LocalSettings;
Program.LocalSettings.ManiWndMaximized = (WindowState == FormWindowState.Maximized);
if (WindowState == FormWindowState.Normal)
if (ls != null)
{
Program.LocalSettings.MainWndLeft = Location.X;
Program.LocalSettings.MainWndTop = Location.Y;
Program.LocalSettings.MainWndWidth = Size.Width;
Program.LocalSettings.MainWndHeight = Size.Height;
}
else
{
/// Maximized or minimized (when restarted, minimized window is restored as normal)
Program.LocalSettings.MainWndLeft = RestoreBounds.Left;
Program.LocalSettings.MainWndTop = RestoreBounds.Top;
Program.LocalSettings.MainWndWidth = RestoreBounds.Width;
Program.LocalSettings.MainWndHeight = RestoreBounds.Height;
}
Program.LocalSettings.Save();
ls.RightPaneHorizSplitterDistance = rightHorizSplitContainer.SplitterDistance;
ls.TopPaneVerticalSplitterDistance = topVerticalSplitContainer.SplitterDistance;
if (DialogResult == DialogResult.None)
{
exitToolStripMenuItem_Click(sender, e);
ls.ManiWndMaximized = (WindowState == FormWindowState.Maximized);
if (WindowState == FormWindowState.Normal)
{
ls.MainWndLeft = Location.X;
ls.MainWndTop = Location.Y;
ls.MainWndWidth = Size.Width;
ls.MainWndHeight = Size.Height;
}
else
{
/// Maximized or minimized (when restarted, minimized window is restored as normal)
ls.MainWndLeft = RestoreBounds.Left;
ls.MainWndTop = RestoreBounds.Top;
ls.MainWndWidth = RestoreBounds.Width;
ls.MainWndHeight = RestoreBounds.Height;
}
ls.Save();
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
bool TryShutdownTBF()
{
if (TBF.BenchControl.StateMachine.MachineState == TBF.BenchControl.MachineState.Undefined ||
TBF.BenchControl.StateMachine.MachineState == TBF.BenchControl.MachineState.Disabled ||
TBF.BenchControl.StateMachine.MachineState == TBF.BenchControl.MachineState.FailedToStart ||
TBF.BenchControl.StateMachine.MachineState == TBF.BenchControl.MachineState.Off)
{
///
/// StateMachine is not running --> Shutdown immediately without displaying a message box
///
if (closingTbfMessageForm != null) closingTbfMessageForm.CloseForm(this, null);
return true;
}
if (TBF.BenchControl.StateMachine.MachineState == TBF.BenchControl.MachineState.ShuttingDown)
{
///
/// Already shutting down --> Prevent a new shutdown without displaying a message box
///
return false;
}
/// Save emergency stop form state
bool oriEmgStopState = false;
if (emergencyStopModelessDlg != null)
{
@ -645,155 +698,76 @@ namespace TBF
emergencyStopModelessDlg.Visible = false;
}
if (BenchControl.StateMachine.Running && (messageLabel.ForeColor != Color.Red) && CycleRunning)
if ((messageLabel.ForeColor != Color.Red) && IsShutdownDisabled)
{
///
/// It is not possible to shutdown (most likely a cycle is not completed) --> Display a message and prevent shutdown now
///
MessageBox.Show(Strings.Finish_the_session_please, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
if (e is FormClosingEventArgs)
{
(e as FormClosingEventArgs).Cancel = true;
}
return;
if (emergencyStopModelessDlg != null) emergencyStopModelessDlg.Visible = oriEmgStopState;
return false;
}
if (DialogResult.Yes == MessageBox.Show(Strings.Do_you_want_to_exit_TBF,
Strings.Closing_the_program,
MessageBoxButtons.YesNo,
MessageBoxIcon.Question))
Forms.ClosingTbfForm closingForm = new Forms.ClosingTbfForm();
DialogResult dr = closingForm.ShowDialog();
if (dr == DialogResult.Yes)
{
if (BenchControl.StateMachine.Running)
///
/// User confirmed TBF program shutdown --> 1. Show modeless form, 2. Stop MainSeq and StateMachine, 3. Prevent TBF exit now
///
IsShutdownPCAfterClosingTbf = closingForm.ShutDownPC;
/// Show 'Closing_Test_Bench_Framework' modeless window in separate thread
closingTbfMessageForm = new TBF.Forms.ModelessActivityForm()
{
/// Show 'Closing_Test_Bench_Framework' modeless window in separate thread
var form = new TBF.Forms.ModelessActivityForm()
{
Message = Strings.Closing_Test_Bench_Framework,
FontFamily = "Arial",
FontSize = 24,
FontStyle = FontStyle.Regular,
BackgroundColor = Color.PeachPuff,
StartActivityHandler = true,
};
Thread formThread = new Thread(() => form.ShowDialog());
formThread.Start();
Message = Strings.Closing_Test_Bench_Framework,
FontFamily = "Arial",
FontSize = 24,
FontStyle = FontStyle.Regular,
BackgroundColor = Color.PeachPuff,
StartActivityHandler = true,
};
Thread formThread = new Thread(() => closingTbfMessageForm.ShowDialog());
formThread.Start();
/// Stop the system
BenchControl.StateMachine.Stop();
while (BenchControl.StateMachine.Running) { } /// wait until the last StopOperaions() completes
BenchControl.StateMachine.StopDevices();
BenchControl.StateMachine.StopDevices2();
UiBridge.Bridge.OnEmergencyStopChanged(this, UiBridge.EmergencyStopEventArgs.State.CloseForm);
/// Stop MainSeq and StateMachine
Bridge.Ui2Bench(UI2BenchCmd.Shutdown);
/// Close 'Closing_Test_Bench_Framework' modeless window
form.CloseForm(null, new EventArgs());
formThread.Join();
}
/// Close the main window
DialogResult = DialogResult.OK;
Close();
return;
/// Prevent TBF program exit now
return false;
}
else if (e is FormClosingEventArgs)
else
{
(e as FormClosingEventArgs).Cancel = true;
/// User aborted the shutdown --> Restore emergency stop form state and prevent shutdown now
if (emergencyStopModelessDlg != null) emergencyStopModelessDlg.Visible = oriEmgStopState;
return false;
}
if (emergencyStopModelessDlg != null) emergencyStopModelessDlg.Visible = oriEmgStopState;
}
private void MainWnd_FormClosing(object sender, FormClosingEventArgs e)
{
if (TryShutdownTBF())
{
UI2Settings(); /// Save settings and exit TBF
}
else
{
e.Cancel = true; /// Prevent TBF exit
}
}
//private void printToolStripMenuItem_Click(object sender, EventArgs e)
//{
//TBF.Forms.PrintOrderForm dlg = new TBF.Forms.PrintOrderForm();
//if (dlg.ShowDialog() == DialogResult.OK)
//{
// string purchaseOrder = dlg.PurchaseOrder;
// string tester = dlg.Tester;
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
if (TryShutdownTBF())
{
/// Save settings and exit TBF
UI2Settings();
Close();
}
}
// NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
// IList<TestResult> testResults = session.QueryOver<TestResult>()
// .Where(x => (x.PurchaseOrder == purchaseOrder))
// .List();
// if (testResults.Count == 0)
// {
// MessageBox.Show(Strings.No_results_to_print, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
// return;
// }
// if (dlg.OnlyGoodResults)
// {
// /// Proceed from the end of the list so that items can be removed by index
// for (int i = testResults.Count - 1; i >= 0; i--)
// {
// // TODO: Complete
// }
// }
// if (dlg.OnlyLastResult)
// {
// /// Remove test results if there exist a later test results for the same sn
// /// Proceed from the end of the list so that items can be removed by index
// for (int i = testResults.Count - 1; i >= 0; i--)
// {
// string name = testResults[i].Name;
// int batchNr = testResults[i].BatchNr;
// foreach (var tr in testResults)
// {
// if (tr.Name == name && tr.BatchNr > batchNr)
// {
// bool allWMsAreTheSame = true;
// int cnt = Math.Min(testResults[i].Meters.Count, tr.Meters.Count);
// for (int j = 0; j < cnt; j++)
// {
// if (testResults[i].Meters[j].SerialNr != tr.Meters[j].SerialNr)
// {
// allWMsAreTheSame = false;
// break;
// }
// }
// if (allWMsAreTheSame)
// {
// /// Remove as there exists a more recent measurement with the same meters
// testResults.RemoveAt(i);
// break;
// }
// }
// }
// }
// }
// IList<Procedure> procedure = session.QueryOver<Procedure>()
// .Where(x => (x.ProcedureState == ProcedureState.Active))
// .And(x => (x.Name == testResults[0].ProcedureName))
// .List();
// if (procedure.Count != 1)
// {
// MessageBox.Show(Strings.No_results_to_print, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
// return;
// }
// if ((testResults != null) && (testResults.Count != 0) && (testResults[0].MetersKind == MetersKind.Single))
// {
// PrintOrderDocument doc = new PrintOrderDocument(procedure[0], testResults, tester);
// doc.DefaultPageSettings.Landscape = true;
// doc.Print();
// }
// else if((testResults != null) && (testResults.Count != 0) && (testResults[0].MetersKind == MetersKind.Combined))
// {
// /// Do nothing right now
// }
// else
// {
// MessageBox.Show(Strings.No_results_to_print, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
// return;
// }
//}
//}
private void upgradeTSMenuItem_Click(object sender, EventArgs e)
{

View File

@ -121,115 +121,115 @@
<data name="benchTSMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>57, 20</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Testovací stolice Framework</value>
</data>
<data name="aboutTSMenuItem.Text" xml:space="preserve">
<value>O</value>
</data>
<data name="activityGroupBox.Text" xml:space="preserve">
<value>Proces</value>
</data>
<data name="activityStatusLabel.Text" xml:space="preserve">
<value>Prosím, spusťte proceduru</value>
</data>
<data name="benchComponentsTSMenuItem.Text" xml:space="preserve">
<value>Komponenty</value>
</data>
<data name="benchMetrologyTSMenuItem.Text" xml:space="preserve">
<value>Metrologie</value>
</data>
<data name="benchPathsTSMenuItem.Text" xml:space="preserve">
<value>Cesty</value>
</data>
<data name="benchTransitionsToolStripMenuItem.Text" xml:space="preserve">
<value>Přechody</value>
</data>
<data name="benchTSMenuItem.Text" xml:space="preserve">
<value>Stolice</value>
</data>
<data name="databaseSettingsTSMenuItem.Text" xml:space="preserve">
<value>Databáze</value>
</data>
<data name="editTSMenuItem.Text" xml:space="preserve">
<value>Nastavení</value>
</data>
<data name="exitToolStripMenuItem.Text" xml:space="preserve">
<value>Výstup</value>
</data>
<data name="helpTSMenuItem.Text" xml:space="preserve">
<value>Pomoc</value>
</data>
<data name="homeTabPage.Text" xml:space="preserve">
<value>Hydraulika</value>
</data>
<data name="homeTSMenuItem.Text" xml:space="preserve">
<value>Domů</value>
</data>
<data name="insertTabPage.Text" xml:space="preserve">
<value>Vložit</value>
</data>
<data name="localSettingsTSMenuItem.Text" xml:space="preserve">
<value>Jazyk</value>
</data>
<data name="logsTabPage.Text" xml:space="preserve">
<value>Záznamy</value>
</data>
<data name="logsTSMenuItem.Text" xml:space="preserve">
<value>Záznamy</value>
</data>
<data name="mainMenuStrip.Text" xml:space="preserve">
<value>Záhlaví hlavního menu</value>
</data>
<data name="measurementTabPage.Text" xml:space="preserve">
<value>Měření</value>
</data>
<data name="measurementTSMenuItem.Text" xml:space="preserve">
<value>Měření</value>
</data>
<data name="passwortToolStripMenuItem.Text" xml:space="preserve">
<value>Heslo</value>
</data>
<data name="picturesTabPage.Text" xml:space="preserve">
<value>Obrázky</value>
</data>
<data name="picturesTSMItem.Text" xml:space="preserve">
<value>Obrázky</value>
</data>
<data name="printToolStripMenuItem.Text" xml:space="preserve">
<value>Vytisknout</value>
</data>
<data name="procedureGroupBox.Text" xml:space="preserve">
<value>Postup</value>
</data>
<data name="proceduresToolStripMenuItem.Text" xml:space="preserve">
<value>Postupy</value>
</data>
<data name="processTabPage.Text" xml:space="preserve">
<value>Proces</value>
</data>
<data name="processToolStripMenuItem.Text" xml:space="preserve">
<value>Proces</value>
</data>
<data name="progressGroupBox.Text" xml:space="preserve">
<value>Probíhá</value>
</data>
<data name="resultsTabPage.Text" xml:space="preserve">
<value>Výsledky</value>
</data>
<data name="resultsToolStripMenuItem.Text" xml:space="preserve">
<value>Výsledky</value>
</data>
<data name="resultsTSMenuItem.Text" xml:space="preserve">
<value>Výsledky</value>
</data>
<data name="statusStrip1.Text" xml:space="preserve">
<value>Stavový pruh 1</value>
</data>
<data name="userInfoStatusLabel.Text" xml:space="preserve">
<value>Uživatel : admin</value>
</data>
<data name="usersTSMenuItem.Text" xml:space="preserve">
<value>Uživatelé</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Testovací stolice Framework</value>
</data>
<data name="aboutTSMenuItem.Text" xml:space="preserve">
<value>O</value>
</data>
<data name="activityGroupBox.Text" xml:space="preserve">
<value>Proces</value>
</data>
<data name="activityStatusLabel.Text" xml:space="preserve">
<value>Prosím, spusťte proceduru</value>
</data>
<data name="benchComponentsTSMenuItem.Text" xml:space="preserve">
<value>Komponenty</value>
</data>
<data name="benchMetrologyTSMenuItem.Text" xml:space="preserve">
<value>Metrologie</value>
</data>
<data name="benchPathsTSMenuItem.Text" xml:space="preserve">
<value>Cesty</value>
</data>
<data name="benchTransitionsToolStripMenuItem.Text" xml:space="preserve">
<value>Přechody</value>
</data>
<data name="benchTSMenuItem.Text" xml:space="preserve">
<value>Stolice</value>
</data>
<data name="databaseSettingsTSMenuItem.Text" xml:space="preserve">
<value>Databáze</value>
</data>
<data name="editTSMenuItem.Text" xml:space="preserve">
<value>Nastavení</value>
</data>
<data name="exitToolStripMenuItem.Text" xml:space="preserve">
<value>Ukončit</value>
</data>
<data name="helpTSMenuItem.Text" xml:space="preserve">
<value>Pomoc</value>
</data>
<data name="homeTabPage.Text" xml:space="preserve">
<value>Hydraulika</value>
</data>
<data name="homeTSMenuItem.Text" xml:space="preserve">
<value>Domů</value>
</data>
<data name="insertTabPage.Text" xml:space="preserve">
<value>Vložit</value>
</data>
<data name="localSettingsTSMenuItem.Text" xml:space="preserve">
<value>Jazyk</value>
</data>
<data name="logsTabPage.Text" xml:space="preserve">
<value>Záznamy</value>
</data>
<data name="logsTSMenuItem.Text" xml:space="preserve">
<value>Záznamy</value>
</data>
<data name="mainMenuStrip.Text" xml:space="preserve">
<value>Záhlaví hlavního menu</value>
</data>
<data name="measurementTabPage.Text" xml:space="preserve">
<value>Měření</value>
</data>
<data name="measurementTSMenuItem.Text" xml:space="preserve">
<value>Měření</value>
</data>
<data name="passwortToolStripMenuItem.Text" xml:space="preserve">
<value>Heslo</value>
</data>
<data name="picturesTabPage.Text" xml:space="preserve">
<value>Obrázky</value>
</data>
<data name="picturesTSMItem.Text" xml:space="preserve">
<value>Obrázky</value>
</data>
<data name="printToolStripMenuItem.Text" xml:space="preserve">
<value>Vytisknout</value>
</data>
<data name="procedureGroupBox.Text" xml:space="preserve">
<value>Postup</value>
</data>
<data name="proceduresToolStripMenuItem.Text" xml:space="preserve">
<value>Postupy</value>
</data>
<data name="processTabPage.Text" xml:space="preserve">
<value>Proces</value>
</data>
<data name="processToolStripMenuItem.Text" xml:space="preserve">
<value>Proces</value>
</data>
<data name="progressGroupBox.Text" xml:space="preserve">
<value>Probíhá</value>
</data>
<data name="resultsTabPage.Text" xml:space="preserve">
<value>Výsledky</value>
</data>
<data name="resultsToolStripMenuItem.Text" xml:space="preserve">
<value>Výsledky</value>
</data>
<data name="resultsTSMenuItem.Text" xml:space="preserve">
<value>Výsledky</value>
</data>
<data name="statusStrip1.Text" xml:space="preserve">
<value>Stavový pruh 1</value>
</data>
<data name="userInfoStatusLabel.Text" xml:space="preserve">
<value>Uživatel : admin</value>
</data>
<data name="usersTSMenuItem.Text" xml:space="preserve">
<value>Uživatelé</value>
</data>
</root>

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Sensus")]
[assembly: AssemblyProduct("TestBenchFramework")]
[assembly: AssemblyCopyright("Copyright © 2013 - 2018 Sensus Slovensko, a.s.")]
[assembly: AssemblyCopyright("Copyright © 2013 - 2019 Sensus Slovensko, a.s.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.18.1154.0")]
[assembly: AssemblyFileVersion("2.18.1154.0")]
[assembly: AssemblyVersion("2.18.1156.0")]
[assembly: AssemblyFileVersion("2.18.1156.0")]

View File

@ -1195,7 +1195,7 @@ namespace TBF.Resources {
}
/// <summary>
/// Looks up a localized string similar to Do you want to exit the Test Bench Framework?.
/// Looks up a localized string similar to Do you want to exit Test Bench Framework ?.
/// </summary>
internal static string Do_you_want_to_exit_TBF {
get {
@ -4263,6 +4263,24 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Shut down computer after exiting Test Bench Framework.
/// </summary>
internal static string Shut_down_computer_after_exiting_TBF {
get {
return ResourceManager.GetString("Shut_down_computer_after_exiting_TBF", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Shutting down devices.
/// </summary>
internal static string Shutting_down_devices {
get {
return ResourceManager.GetString("Shutting_down_devices", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Side.
/// </summary>

View File

@ -406,7 +406,7 @@
<value>Vyhodnocení</value>
</data>
<data name="ExitBtnText" xml:space="preserve">
<value>Výstup</value>
<value>Ukončit</value>
</data>
<data name="Failed" xml:space="preserve">
<value>NOK</value>
@ -1380,4 +1380,10 @@
<data name="Mute_alarm" xml:space="preserve">
<value>Ztlumit sirénu</value>
</data>
<data name="Shutting_down_devices" xml:space="preserve">
<value>Vypínání zařízení</value>
</data>
<data name="Shut_down_computer_after_exiting_TBF" xml:space="preserve">
<value>Vypnout počítač po ukončení Test Bench Framework</value>
</data>
</root>

View File

@ -1467,4 +1467,7 @@
<data name="Mute_alarm" xml:space="preserve">
<value>Stummschaltung des Alarms</value>
</data>
<data name="Shutting_down_devices" xml:space="preserve">
<value>Geräte herunterfahren</value>
</data>
</root>

View File

@ -1605,4 +1605,7 @@
<data name="Result" xml:space="preserve">
<value>Wynik</value>
</data>
<data name="Shutting_down_devices" xml:space="preserve">
<value>Zamykanie urządzeń</value>
</data>
</root>

View File

@ -1280,7 +1280,7 @@
<value>Closing the program</value>
</data>
<data name="Do_you_want_to_exit_TBF" xml:space="preserve">
<value>Do you want to exit the Test Bench Framework?</value>
<value>Do you want to exit Test Bench Framework ?</value>
</data>
<data name="The_following_components_are_in_simulation_mode_" xml:space="preserve">
<value>The following components are in simulation mode:</value>
@ -1936,4 +1936,10 @@
<data name="Mute_alarm" xml:space="preserve">
<value>Mute the alarm</value>
</data>
<data name="Shutting_down_devices" xml:space="preserve">
<value>Shutting down devices</value>
</data>
<data name="Shut_down_computer_after_exiting_TBF" xml:space="preserve">
<value>Shut down computer after exiting Test Bench Framework</value>
</data>
</root>

View File

@ -1446,6 +1446,12 @@
<DependentUpon>WaterMeterCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\WaterMeters\WaterMeter\WaterMeterFactory.cs" />
<Compile Include="Forms\ClosingTbfForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\ClosingTbfForm.Designer.cs">
<DependentUpon>ClosingTbfForm.cs</DependentUpon>
</Compile>
<Compile Include="Forms\DatabaseSettingsDlg.cs">
<SubType>Form</SubType>
</Compile>
@ -2851,6 +2857,9 @@
<EmbeddedResource Include="Forms\AboutDlg.ru.resx">
<DependentUpon>AboutDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\ClosingTbfForm.resx">
<DependentUpon>ClosingTbfForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\DatabaseSettingsDlg.resx">
<DependentUpon>DatabaseSettingsDlg.cs</DependentUpon>
</EmbeddedResource>

View File

@ -35,32 +35,32 @@ namespace TBF.UiBridge
Next, /// Used for debugging
}
public enum ButtonsEtc
{
None = 0,
ProcedureCmbBoxEn = (1 << 0),
TestCmbBoxEn = (1 << 1),
StopBtnEn = (1 << 2),
StartTestBtnsEn = (1 << 3),
StartCycleBtnEn = (1 << 4),
PurgeBeginBtnEn = (1 << 5),
PurgeEndBtnEn = (1 << 6),
DrainTankBtn1En = (1 << 7),
DrainTankBtn1Hi = (1 << 8),
DrainTankBtn2En = (1 << 9),
DrainTankBtn2Hi = (1 << 10),
DrainTankBtn3En = (1 << 11),
DrainTankBtn3Hi = (1 << 12),
Break = (1 << 13),
ResetResultsBtnEn = (1 << 14),
AcceptResultsBtnEn = (1 << 15),
CalibrationBtnEn = (1 << 16),
SensitivityTestBtnEn = (1 << 17),
CustomBtnEn = (1 << 18),
public enum ButtonsEtc
{
None = 0,
ProcedureCmbBoxEn = (1 << 0),
TestCmbBoxEn = (1 << 1),
StopBtnEn = (1 << 2),
StartTestBtnsEn = (1 << 3),
StartCycleBtnEn = (1 << 4),
PurgeBeginBtnEn = (1 << 5),
PurgeEndBtnEn = (1 << 6),
DrainTankBtn1En = (1 << 7),
DrainTankBtn1Hi = (1 << 8),
DrainTankBtn2En = (1 << 9),
DrainTankBtn2Hi = (1 << 10),
DrainTankBtn3En = (1 << 11),
DrainTankBtn3Hi = (1 << 12),
Break = (1 << 13),
ResetResultsBtnEn = (1 << 14),
AcceptResultsBtnEn = (1 << 15),
CalibrationBtnEn = (1 << 16),
SensitivityTestBtnEn = (1 << 17),
CustomBtnEn = (1 << 18),
/// If one of the following flags is set, flags 0x1 through 0x2000 are ignored
///
ShowBenchEmpty = 0x1000000,
ShowBenchFilled = 0x2000000,
/// If one of the following flags is set, flags (1 << 0) through (1 << 18) are ignored
ShowBenchEmpty = (1 << 24),
ShowBenchFilled = (1 << 25),
Shutdown = (1 << 26),
}
}