Emergency stop form reactivated
This commit is contained in:
parent
805e66d537
commit
7261d44728
@ -70,8 +70,10 @@ namespace TBF.BenchControl.Elde
|
||||
public float ReferenceVolume { get { return controlCom.ReferenceVolume; } }
|
||||
public float VyslExt(int wmNr0, int what) { return controlCom.VyslExt(wmNr0, what); }
|
||||
|
||||
/// <summary> Extracted from the StatusP </summary>
|
||||
public bool EmgcyStopActive { get { return (controlCom.StatusP & StatusP.EmgcyStopActive) != 0; } }
|
||||
/// <summary> Extracted from the StatusP in RunDeviceBefore </summary>
|
||||
public bool EmergencyStop { get { return emergencyStop; } }
|
||||
bool emergencyStop;
|
||||
bool previousEmergencyStop;
|
||||
|
||||
/// <summary> State of valves sent out - buffered by the last SendCommand() </summary>
|
||||
public ulong Route { get { return route; } }
|
||||
@ -134,6 +136,8 @@ namespace TBF.BenchControl.Elde
|
||||
if (cfg == null) throw new ArgumentNullException("cfg");
|
||||
this.controlBoardCfg = cfg;
|
||||
FMFreq = new float[2] { 0, 0 };
|
||||
emergencyStop = false;
|
||||
previousEmergencyStop = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -179,7 +183,19 @@ namespace TBF.BenchControl.Elde
|
||||
{
|
||||
controlCom.RunDeviceBefore();
|
||||
|
||||
if (EmgcyStopActive)
|
||||
previousEmergencyStop = emergencyStop;
|
||||
emergencyStop = (controlCom.StatusP & StatusP.EmgcyStopActive) != 0;
|
||||
|
||||
if (emergencyStop && !previousEmergencyStop)
|
||||
{
|
||||
Program.MainWnd.Invoke(new ShowEmergencyStopFormDlgt(ShowEmergencyStopForm));
|
||||
}
|
||||
else if (!emergencyStop && previousEmergencyStop)
|
||||
{
|
||||
UiBridge.Bridge.OnEmergencyStopChanged(this,UiBridge.EmergencyStopEventArgs.State.CloseForm);
|
||||
}
|
||||
|
||||
if (emergencyStop)
|
||||
{
|
||||
/// SendCommand() arguments to clear the emergency stop state
|
||||
sendCommandFlag = true;
|
||||
@ -218,6 +234,15 @@ namespace TBF.BenchControl.Elde
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
delegate void ShowEmergencyStopFormDlgt();
|
||||
///
|
||||
void ShowEmergencyStopForm()
|
||||
{
|
||||
(new TBF.Forms.EmergencyStopForm()).Show();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sends a command to the control board.
|
||||
/// </summary>
|
||||
|
||||
@ -7,22 +7,22 @@ namespace TBF.Forms
|
||||
{
|
||||
public partial class EmergencyStopForm : Form
|
||||
{
|
||||
public static bool ClosingForm = false;
|
||||
bool closingForm = false;
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor (does the localization)
|
||||
/// </summary>
|
||||
public EmergencyStopForm()
|
||||
{
|
||||
Visible = false;
|
||||
Visible = true;
|
||||
InitializeComponent();
|
||||
emergencyStopMsgLabel.Text = Strings.Emergency_STOP;
|
||||
emergencyStopMsgLabel.Enabled = false;
|
||||
emergencyStopMsgLabel.Visible = false;
|
||||
emergencyStopMsgLabel.Enabled = true;
|
||||
emergencyStopMsgLabel.Visible = true;
|
||||
|
||||
UiBridge.Bridge.EmergencyStopChangedHandler += delegate(object sender, UiBridge.EmergencyStopEventArgs args)
|
||||
{
|
||||
if (ClosingForm) return;
|
||||
if (closingForm) return;
|
||||
|
||||
if (InvokeRequired)
|
||||
{
|
||||
@ -34,23 +34,23 @@ namespace TBF.Forms
|
||||
|
||||
void OnEmergencyStopStateChanged(Object sender, UiBridge.EmergencyStopEventArgs args)
|
||||
{
|
||||
if (args.EmergencyStopState == UiBridge.EmergencyStopEventArgs.State.Active)
|
||||
if (args.EmergencyStopState == UiBridge.EmergencyStopEventArgs.State.CloseForm)
|
||||
{
|
||||
Visible = true;
|
||||
emergencyStopMsgLabel.Enabled = true;
|
||||
emergencyStopMsgLabel.Visible = true;
|
||||
}
|
||||
else if (args.EmergencyStopState == UiBridge.EmergencyStopEventArgs.State.Inactive)
|
||||
{
|
||||
Visible = false;
|
||||
emergencyStopMsgLabel.Enabled = false;
|
||||
emergencyStopMsgLabel.Visible = false;
|
||||
}
|
||||
else if (args.EmergencyStopState == UiBridge.EmergencyStopEventArgs.State.CloseForm)
|
||||
{
|
||||
ClosingForm = true;
|
||||
closingForm = true;
|
||||
Close();
|
||||
}
|
||||
//else if (args.EmergencyStopState == UiBridge.EmergencyStopEventArgs.State.Active)
|
||||
//{
|
||||
// Visible = true;
|
||||
// emergencyStopMsgLabel.Enabled = true;
|
||||
// emergencyStopMsgLabel.Visible = true;
|
||||
//}
|
||||
//else if (args.EmergencyStopState == UiBridge.EmergencyStopEventArgs.State.Inactive)
|
||||
//{
|
||||
// Visible = false;
|
||||
// emergencyStopMsgLabel.Enabled = false;
|
||||
// emergencyStopMsgLabel.Visible = false;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +34,6 @@
|
||||
// emergencyStopMsgLabel
|
||||
//
|
||||
this.emergencyStopMsgLabel.AutoSize = true;
|
||||
this.emergencyStopMsgLabel.Enabled = false;
|
||||
this.emergencyStopMsgLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.emergencyStopMsgLabel.ForeColor = System.Drawing.Color.Yellow;
|
||||
this.emergencyStopMsgLabel.Location = new System.Drawing.Point(67, 86);
|
||||
@ -42,7 +41,6 @@
|
||||
this.emergencyStopMsgLabel.Size = new System.Drawing.Size(287, 37);
|
||||
this.emergencyStopMsgLabel.TabIndex = 1;
|
||||
this.emergencyStopMsgLabel.Text = "Emergency STOP";
|
||||
this.emergencyStopMsgLabel.Visible = false;
|
||||
//
|
||||
// EmergencyStopForm
|
||||
//
|
||||
@ -52,13 +50,12 @@
|
||||
this.BackColor = System.Drawing.Color.Red;
|
||||
this.ClientSize = new System.Drawing.Size(412, 212);
|
||||
this.Controls.Add(this.emergencyStopMsgLabel);
|
||||
this.Enabled = false;
|
||||
this.ForeColor = System.Drawing.Color.Yellow;
|
||||
this.ForeColor = System.Drawing.Color.Transparent;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "EmergencyStopForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Emergency STOP";
|
||||
this.TopMost = true;
|
||||
this.ResumeLayout(false);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user