diff --git a/TBF/BenchControl/Elde/CoverTest/CoverTest.cs b/TBF/BenchControl/Elde/CoverTest/CoverTest.cs
index 516645d51..295e1a678 100644
--- a/TBF/BenchControl/Elde/CoverTest/CoverTest.cs
+++ b/TBF/BenchControl/Elde/CoverTest/CoverTest.cs
@@ -69,7 +69,7 @@ namespace TBF.BenchControl.Elde.CoverTest
}
- CoverTestForm modelessDlg;
+ CoverTestForm coverTestForm;
bool completed = false;
@@ -77,8 +77,8 @@ namespace TBF.BenchControl.Elde.CoverTest
///
void OpenFormDlg(CoverTest myRef)
{
- myRef.modelessDlg = new CoverTestForm(message, bypassLevel, bypassLog);
- modelessDlg.Show();
+ myRef.coverTestForm = new CoverTestForm(message, bypassLevel, bypassLog);
+ coverTestForm.Show();
}
@@ -106,7 +106,7 @@ namespace TBF.BenchControl.Elde.CoverTest
completed = true;
}
- if (completed || modelessDlg.Completed)
+ if (completed || coverTestForm.Completed)
{
completed = true;
CloseModelessDlg();
@@ -127,10 +127,10 @@ namespace TBF.BenchControl.Elde.CoverTest
void CloseModelessDlg()
{
- if (modelessDlg is GenericDevices.IHasCompleted)
+ if (coverTestForm != null)
{
- UiBridge.Bridge.OnCloseQandAForm(this, null);
- modelessDlg = null;
+ coverTestForm.OnCloseThisForm(this, null);
+ coverTestForm = null;
}
}
}
diff --git a/TBF/BenchControl/Elde/CoverTest/CoverTestForm.cs b/TBF/BenchControl/Elde/CoverTest/CoverTestForm.cs
index 13a3959f5..28aa287ca 100644
--- a/TBF/BenchControl/Elde/CoverTest/CoverTestForm.cs
+++ b/TBF/BenchControl/Elde/CoverTest/CoverTestForm.cs
@@ -9,7 +9,7 @@ using TBF.Resources;
namespace TBF.BenchControl.Elde.CoverTest
{
- public partial class CoverTestForm : Form, GenericDevices.IHasCompleted
+ public partial class CoverTestForm : Form
{
ILog bypassLog;
string message;
@@ -74,12 +74,31 @@ namespace TBF.BenchControl.Elde.CoverTest
#region Forced close handling
+ ///
+ /// Used by CoverTest, AskYesNoOp and MessageBoxOp.
+ ///
+ public void OnCloseThisForm(object sender, EventArgs args)
+ {
+ if (CloseThisFormHandler == null) return;
+ try
+ {
+ CloseThisFormHandler(sender, null);
+ }
+ catch (Exception e)
+ {
+ }
+ }
+
+ public event EventHandler CloseThisFormHandler;
+
public void StartForceCloseHandler()
{
- UiBridge.Bridge.CloseQandAFormHandler += delegate(object sender, EventArgs args)
+ CloseThisFormHandler += delegate(object sender, EventArgs args)
{
- if (InvokeRequired) { Invoke(new EventHandler(OnForceClose), sender, args); }
- else OnForceClose(sender, args);
+ if (InvokeRequired)
+ Invoke(new EventHandler(OnForceClose), sender, args);
+ else
+ OnForceClose(sender, args);
};
}
diff --git a/TBF/BenchControl/Operations/AskYesNoForm.cs b/TBF/BenchControl/Operations/AskYesNoForm.cs
index cb46a1bd7..f3fa7d06c 100644
--- a/TBF/BenchControl/Operations/AskYesNoForm.cs
+++ b/TBF/BenchControl/Operations/AskYesNoForm.cs
@@ -4,13 +4,16 @@
using System;
using System.Drawing;
using System.Windows.Forms;
+using log4net;
using TBF.Resources;
namespace TBF.BenchControl.Operations
{
public partial class AskYesNoForm : Form
{
- /// One of the following two variables set to 'true' when the form closes
+ static readonly ILog log = LogManager.GetLogger(typeof(MessageBoxForm));
+
+ /// One of the following two variables set to 'true' when the form closes
public bool CompletedYes;
public bool CompletedNo;
@@ -33,6 +36,10 @@ namespace TBF.BenchControl.Operations
yesButton.Left += shift;
noButton.Left += shift;
}
+
+ CompletedYes = false;
+ CompletedNo = false;
+ StartForceCloseHandler();
}
void Localize()
@@ -53,5 +60,44 @@ namespace TBF.BenchControl.Operations
CompletedNo = true;
Close();
}
- }
+
+ #region Forced close handling
+
+ ///
+ /// Used by CoverTest, AskYesNoOp and MessageBoxOp.
+ ///
+ public void OnCloseThisForm(object sender, EventArgs args)
+ {
+ if (CloseThisFormHandler == null) return;
+ try
+ {
+ CloseThisFormHandler(sender, null);
+ }
+ catch (Exception e)
+ {
+ log.Error("CloseThisFormHandler(...) failed", e);
+ }
+ }
+
+ public event EventHandler CloseThisFormHandler;
+
+ public void StartForceCloseHandler()
+ {
+ CloseThisFormHandler += delegate(object sender, EventArgs args)
+ {
+ if (InvokeRequired)
+ Invoke(new EventHandler(OnForceClose), sender, args);
+ else
+ OnForceClose(sender, args);
+ };
+ }
+
+ private void OnForceClose(object sender, EventArgs args)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+
+ #endregion
+ }
}
diff --git a/TBF/BenchControl/Operations/AskYesNoOp.cs b/TBF/BenchControl/Operations/AskYesNoOp.cs
index 589825bc4..db6b3844e 100644
--- a/TBF/BenchControl/Operations/AskYesNoOp.cs
+++ b/TBF/BenchControl/Operations/AskYesNoOp.cs
@@ -10,7 +10,7 @@ namespace TBF.BenchControl.Operations
{
public class AskYesNoOp : IOperation
{
- AskYesNoForm modelessDlg;
+ AskYesNoForm askYesNoForm;
string question;
@@ -29,8 +29,8 @@ namespace TBF.BenchControl.Operations
///
void OpenFormDlg(AskYesNoOp myRef)
{
- myRef.modelessDlg = new AskYesNoForm(question);
- modelessDlg.Show();
+ myRef.askYesNoForm = new AskYesNoForm(question);
+ askYesNoForm.Show();
}
/// Start this operation
@@ -43,15 +43,19 @@ namespace TBF.BenchControl.Operations
/// Event.ResultsPrinted
public Event Run()
{
- if (modelessDlg.CompletedYes) return Event.Yes;
- if (modelessDlg.CompletedNo) return Event.No;
+ if (askYesNoForm.CompletedYes) return Event.Yes;
+ if (askYesNoForm.CompletedNo) return Event.No;
return Event.None;
}
/// Stop this operation
public void Stop()
{
- modelessDlg = null;
- }
+ if (askYesNoForm != null)
+ {
+ askYesNoForm.OnCloseThisForm(this, null);
+ askYesNoForm = null;
+ }
+ }
}
}
diff --git a/TBF/BenchControl/Operations/MessageBoxForm.cs b/TBF/BenchControl/Operations/MessageBoxForm.cs
index 58b5f7d2b..eef155c64 100644
--- a/TBF/BenchControl/Operations/MessageBoxForm.cs
+++ b/TBF/BenchControl/Operations/MessageBoxForm.cs
@@ -4,12 +4,15 @@
using System;
using System.Drawing;
using System.Windows.Forms;
+using log4net;
using TBF.Resources;
namespace TBF.BenchControl.Operations
{
- public partial class MessageBoxForm : Form, GenericDevices.IHasCompleted
+ public partial class MessageBoxForm : Form
{
+ static readonly ILog log = LogManager.GetLogger(typeof(MessageBoxForm));
+
/// Set to 'true' when the form closes
public bool Completed { get { return completed; } }
bool completed;
@@ -56,12 +59,32 @@ namespace TBF.BenchControl.Operations
#region Forced close handling
+ ///
+ /// Used by CoverTest, AskYesNoOp and MessageBoxOp.
+ ///
+ public void OnCloseThisForm(object sender, EventArgs args)
+ {
+ if (CloseThisFormHandler == null) return;
+ try
+ {
+ CloseThisFormHandler(sender, null);
+ }
+ catch (Exception e)
+ {
+ log.Error("CloseThisFormHandler(...) failed", e);
+ }
+ }
+
+ public event EventHandler CloseThisFormHandler;
+
public void StartForceCloseHandler()
{
- UiBridge.Bridge.CloseQandAFormHandler += delegate(object sender, EventArgs args)
+ CloseThisFormHandler += delegate(object sender, EventArgs args)
{
- if (InvokeRequired) { Invoke(new EventHandler(OnForceClose), sender, args); }
- else OnForceClose(sender, args);
+ if (InvokeRequired)
+ Invoke(new EventHandler(OnForceClose), sender, args);
+ else
+ OnForceClose(sender, args);
};
}
diff --git a/TBF/BenchControl/Operations/MessageBoxOp.cs b/TBF/BenchControl/Operations/MessageBoxOp.cs
index 3a112d526..c64454aad 100644
--- a/TBF/BenchControl/Operations/MessageBoxOp.cs
+++ b/TBF/BenchControl/Operations/MessageBoxOp.cs
@@ -11,7 +11,7 @@ namespace TBF.BenchControl.Operations
{
public class MessageBoxOp : IOperation
{
- MessageBoxForm modelessDlg;
+ MessageBoxForm messageBoxForm;
string message;
Color backColor;
@@ -38,8 +38,8 @@ namespace TBF.BenchControl.Operations
///
void OpenFormDlg(MessageBoxOp myRef)
{
- myRef.modelessDlg = new MessageBoxForm(message, backColor);
- modelessDlg.Show();
+ myRef.messageBoxForm = new MessageBoxForm(message, backColor);
+ messageBoxForm.Show();
}
/// Start this operation
@@ -53,10 +53,10 @@ namespace TBF.BenchControl.Operations
/// Event.ResultsPrinted
public Event Run()
{
- if (completed || modelessDlg.Completed)
+ if (completed || messageBoxForm.Completed)
{
completed = true;
- modelessDlg = null;
+ messageBoxForm = null;
return Event.OK;
}
@@ -66,10 +66,10 @@ namespace TBF.BenchControl.Operations
/// Stop this operation
public void Stop()
{
- if (modelessDlg is GenericDevices.IHasCompleted)
+ if (messageBoxForm != null)
{
- UiBridge.Bridge.OnCloseQandAForm(this, null);
- modelessDlg = null;
+ messageBoxForm.OnCloseThisForm(this, null);
+ messageBoxForm = null;
}
}
}
diff --git a/TBF/BenchControl/TbfComponents.cs b/TBF/BenchControl/TbfComponents.cs
index 0318732cc..af0c6d88d 100644
--- a/TBF/BenchControl/TbfComponents.cs
+++ b/TBF/BenchControl/TbfComponents.cs
@@ -44,7 +44,7 @@ namespace TBF.BenchControl
Factories.Add(new Elde.FlowMeterTwins.FlowMeterFactory());
Factories.Add(new Elde.FlowMeterTriplet.FlowMeterFactory());
Factories.Add(new TestMethods.Adjustment.Factory());
- Factories.Add(new TestMethods.ChangeOfFlowDirection.Factory());
+ Factories.Add(new TestMethods.ChangeFlowDirection.Factory());
Factories.Add(new TestMethods.CombinedWithDetection.TestMethodFactory());
Factories.Add(new TestMethods.Endurance.Factory());
Factories.Add(new TestMethods.FixedStart.Single.Factory());
diff --git a/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionSeq.cs b/TBF/BenchControl/TestMethods/ChangeFlowDirection/ChangeFlowDirectionSeq.cs
similarity index 86%
rename from TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionSeq.cs
rename to TBF/BenchControl/TestMethods/ChangeFlowDirection/ChangeFlowDirectionSeq.cs
index e410f0637..1194fd6ca 100644
--- a/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionSeq.cs
+++ b/TBF/BenchControl/TestMethods/ChangeFlowDirection/ChangeFlowDirectionSeq.cs
@@ -7,21 +7,11 @@ using log4net;
using Config.Entities;
using TBF.UiBridge;
-namespace TBF.BenchControl.TestMethods.ChangeOfFlowDirection
+namespace TBF.BenchControl.TestMethods.ChangeFlowDirection
{
- public class ChangeOfFlowDirectionSeq : Sequences.SequenceBase
+ public class ChangeFlowDirectionSeq : Sequences.SequenceBase
{
- private static readonly ILog log = LogManager.GetLogger(typeof(ChangeOfFlowDirectionSeq));
-
- System.Windows.Forms.Form modelessDlg;
- ///
- delegate void ErrorsFormDlgt(ChangeOfFlowDirectionSeq myRef, IList waterMeters);
- ///
- void OpenWMErrorsForm(ChangeOfFlowDirectionSeq myRef, IList waterMeters)
- {
- myRef.modelessDlg = new ChangeOfFlowDirectionForm(waterMeters);
- modelessDlg.Show();
- }
+ private static readonly ILog log = LogManager.GetLogger(typeof(ChangeFlowDirectionSeq));
///
/// Adjustment method sequence
@@ -77,7 +67,7 @@ namespace TBF.BenchControl.TestMethods.ChangeOfFlowDirection
Bridge.OnActivity(this, test.Method);
State.Create(string.Format("{0}({1}) : Turn the direction of watermeters", test.Method, test.Name))
.AddOperation(checkUiOp)
- .AddOperation(new Operations.MessageBoxOp(TBF.Resources.Strings.Press_OK_when_done))
+ .AddOperation(new Operations.MessageBoxOp("Otočte iPerly prosím."))
.EnterState();
do
{
diff --git a/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/Factory.cs b/TBF/BenchControl/TestMethods/ChangeFlowDirection/Factory.cs
similarity index 93%
rename from TBF/BenchControl/TestMethods/ChangeOfFlowDirection/Factory.cs
rename to TBF/BenchControl/TestMethods/ChangeFlowDirection/Factory.cs
index 35387bc8d..b8aad55b7 100644
--- a/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/Factory.cs
+++ b/TBF/BenchControl/TestMethods/ChangeFlowDirection/Factory.cs
@@ -5,7 +5,7 @@ using System.Collections.Generic;
using TBF.BenchControl.Generic;
using TBF.BenchControl.Configs.NameOnly;
-namespace TBF.BenchControl.TestMethods.ChangeOfFlowDirection
+namespace TBF.BenchControl.TestMethods.ChangeFlowDirection
{
public class Factory : IComponentFactory
{
diff --git a/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/TestMethod.cs b/TBF/BenchControl/TestMethods/ChangeFlowDirection/TestMethod.cs
similarity index 77%
rename from TBF/BenchControl/TestMethods/ChangeOfFlowDirection/TestMethod.cs
rename to TBF/BenchControl/TestMethods/ChangeFlowDirection/TestMethod.cs
index f84788d18..54ea84d6c 100644
--- a/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/TestMethod.cs
+++ b/TBF/BenchControl/TestMethods/ChangeFlowDirection/TestMethod.cs
@@ -7,12 +7,12 @@ using log4net;
using Config.Entities;
using TBF.BenchControl;
-namespace TBF.BenchControl.TestMethods.ChangeOfFlowDirection
+namespace TBF.BenchControl.TestMethods.ChangeFlowDirection
{
public class TestMethod : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
- public override string ToString() { return string.Format("TestMethods.ChangeOfFlowDirection({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("TestMethods.ChangeFlowDirection({0})", Cfg.ToString(1)); }
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return true; }
@@ -29,7 +29,7 @@ namespace TBF.BenchControl.TestMethods.ChangeOfFlowDirection
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new ChangeOfFlowDirectionSeq()).Execute(test, repetNr, isLastRepetition, DebugLevel);
+ return (new ChangeFlowDirectionSeq()).Execute(test, repetNr, isLastRepetition, DebugLevel);
}
}
}
diff --git a/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.cs b/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.cs
deleted file mode 100644
index 80050ffba..000000000
--- a/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.cs
+++ /dev/null
@@ -1,217 +0,0 @@
-///
-/// Copyright (c) 2018 Sensus Slovensko a.s.
-///
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Windows.Forms;
-using log4net;
-using Config.Entities;
-using TBF.Resources;
-
-namespace TBF.BenchControl.TestMethods.ChangeOfFlowDirection
-{
- public partial class ChangeOfFlowDirectionForm : Form, GenericDevices.IHasCompleted
- {
- private static readonly ILog log = LogManager.GetLogger(typeof(ChangeOfFlowDirectionForm));
-
- ///
- /// Updated in constructor
- ///
- readonly int waterMetersCount; /// Number of text boxes for serial numbers
- readonly bool[] disabled;
- Rectangle[] rects;
-
- ///
- /// Updated in OnAdjustmentInProgress()
- ///
- double[] error; /// Created in constructor
- double errLimLo;
- double errLimHi;
-
- ///
- /// Set to 'true' when the form closes
- ///
- public bool Completed { get { return completed; } }
- bool completed;
-
-
- ///
- /// Constructor
- ///
- /// Number of text boxes for serial numbers
- public ChangeOfFlowDirectionForm(IList waterMeters)
- : this()
- {
- waterMetersCount = waterMeters.Count;
-
- rects = new Rectangle[waterMetersCount];
- for (int i = 0; i < waterMetersCount; i++) rects[i] = new Rectangle(385, 30 + 90 * i, 324, 57);
-
- disabled = new bool[waterMetersCount];
- for (int i = 0; i < waterMetersCount; i++) disabled[i] = waterMeters[i].Disabled;
-
- error = new double[waterMetersCount];
- }
-
- /// Parameterless constructor for 3 watermeters
- public ChangeOfFlowDirectionForm()
- {
- InitializeComponent();
- ControlBox = false;
-
- completed = false;
-
- /// Attach to 'AdjustmentInProgress' handler
- UiBridge.Bridge.AdjustmentInProgressHandler += delegate(object sender, UiBridge.AdjustmentInProgressEventArgs args)
- {
- if (InvokeRequired)
- {
- Invoke(new EventHandler(OnAdjustmentInProgress), sender, args);
- }
- else OnAdjustmentInProgress(sender, args);
- };
- }
-
- void Localize()
- {
- Text = Strings.Water_Meter_States;
- groupBox1.Text = Strings.Water_Meter + " 1";
- groupBox2.Text = Strings.Water_Meter + " 2";
- groupBox3.Text = Strings.Water_Meter + " 3";
- groupBox4.Text = Strings.Water_Meter + " 4";
- groupBox5.Text = Strings.Water_Meter + " 5";
- groupBox6.Text = Strings.Water_Meter + " 6";
- wmErrorLabel1.Text = Strings.Error_pct;
- wmErrorLabel2.Text = Strings.Error_pct;
- wmErrorLabel3.Text = Strings.Error_pct;
- wmErrorLabel4.Text = Strings.Error_pct;
- wmErrorLabel5.Text = Strings.Error_pct;
- wmErrorLabel6.Text = Strings.Error_pct;
- okButton.Text = Strings.OkBtnText;
- }
-
- private void WMErrorsForm_Load(object sender, EventArgs e)
- {
- Localize();
-
- Height = 50 + 90 * waterMetersCount;
-
- if (waterMetersCount < 1 || disabled[0]) groupBox1.Visible = false;
- if (waterMetersCount < 2 || disabled[1]) groupBox2.Visible = false;
- if (waterMetersCount < 3 || disabled[2]) groupBox3.Visible = false;
- if (waterMetersCount < 4 || disabled[3]) groupBox4.Visible = false;
- if (waterMetersCount < 5 || disabled[4]) groupBox5.Visible = false;
- if (waterMetersCount < 6 || disabled[5]) groupBox6.Visible = false;
-
- wmErrorTextBox1.Text = "---";
- wmErrorTextBox2.Text = "---";
- wmErrorTextBox3.Text = "---";
- wmErrorTextBox4.Text = "---";
- wmErrorTextBox5.Text = "---";
- wmErrorTextBox6.Text = "---";
- }
-
- private void okButton_Click(object sender, EventArgs e)
- {
- completed = true;
- Close();
- }
-
- void OnAdjustmentInProgress(object sender, UiBridge.AdjustmentInProgressEventArgs args)
- {
- string testName = args.TestName;
-
- Results.Entities.TestRslt tr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetTestRslt(testName, 0);
- errLimLo = tr.ErrLimLo() + tr.Uncertainty();
- errLimHi = tr.ErrLimHi() - tr.Uncertainty();
-
- int count = Math.Min(waterMetersCount, TBF.BenchControl.Sequences.ProcessData.BatchRslts.WMPositionsCount);
- for (int i = 0; i < count; i++)
- {
- Results.Entities.MeterTestRslt mtr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
- if (mtr != null) error[i] = mtr.Error;
- }
-
- Redraw();
- }
-
- void Redraw()
- {
- if (waterMetersCount > 0 && !disabled[0]) wmErrorTextBox1.Text = error[0].ToString("F1");
- if (waterMetersCount > 1 && !disabled[1]) wmErrorTextBox2.Text = error[1].ToString("F1");
- if (waterMetersCount > 2 && !disabled[2]) wmErrorTextBox3.Text = error[2].ToString("F1");
- if (waterMetersCount > 3 && !disabled[3]) wmErrorTextBox4.Text = error[3].ToString("F1");
- if (waterMetersCount > 4 && !disabled[4]) wmErrorTextBox5.Text = error[4].ToString("F1");
- if (waterMetersCount > 5 && !disabled[5]) wmErrorTextBox6.Text = error[5].ToString("F1");
-
- for (int i = 0; i < waterMetersCount; i++) Invalidate(rects[i]);
- }
-
- private void WMErrorsForm_Paint(object sender, PaintEventArgs e)
- {
- System.Drawing.Graphics graphics = this.CreateGraphics();
-
- for (int i = 0; i < waterMetersCount; i++)
- {
- if (!disabled[i])
- {
- PaintOne(graphics, rects[i], error[i], errLimLo, errLimHi);
- }
- }
- }
-
- void PaintOne(System.Drawing.Graphics g, Rectangle r, double value, double limLo, double limHi)
- {
- Rectangle rect1 = new Rectangle(r.Left, r.Top, r.Width / 3, r.Height);
- Rectangle rect2 = new Rectangle(r.Left + r.Width / 3, r.Top, r.Width / 3, r.Height);
- Rectangle rect3 = new Rectangle(r.Left + 2 * (r.Width / 3), r.Top, r.Width / 3, r.Height);
- Rectangle rectCent = new Rectangle(r.Left + r.Width / 2 - 1, r.Top, 3, r.Height);
-
- Brush redBrush = new SolidBrush(Color.FromName("Salmon"));
- Brush greenBrush = new SolidBrush(Color.FromName("LightGreen"));
- Brush centBrush = new SolidBrush(Color.FromName("Green"));
-
- g.FillRectangle(redBrush, rect1);
- g.FillRectangle(greenBrush, rect2);
- g.FillRectangle(redBrush, rect3);
- g.FillRectangle(centBrush, rectCent);
-
- int x0 = r.Left + r.Width / 2;
- int dx = r.Height / 3;
- int x = (int)((double)r.Width * (2.0 * value - limLo - limHi) / (limHi - limLo) / 6.0f + 0.5f);
-
- if (x0 - dx + x >= r.Left && x0 + dx + x < r.Left + r.Width)
- {
- Point[] triangle = new Point[3]
- {
- new Point(x0 - dx + x, r.Top),
- new Point(x0 + dx + x, r.Top),
- new Point(x0 + x, r.Top + 2 * r.Height / 3),
- };
-
- Brush blackBrush = new SolidBrush(Color.Black);
- g.FillPolygon(blackBrush, triangle);
- }
- }
-
- #region Forced close handling
-
- public void StartForceCloseHandler()
- {
- UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args)
- {
- if (InvokeRequired) { Invoke(new EventHandler(OnForceClose), sender, args); }
- else OnForceClose(sender, args);
- };
- }
-
- void OnForceClose(object sender, EventArgs args)
- {
- DialogResult = DialogResult.Cancel;
- Close();
- }
-
- #endregion
- }
-}
diff --git a/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.designer.cs b/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.designer.cs
deleted file mode 100644
index e8c248e4e..000000000
--- a/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.designer.cs
+++ /dev/null
@@ -1,312 +0,0 @@
-///
-/// Copyright (c) 2018 Sensus Slovensko a.s.
-///
-namespace TBF.BenchControl.TestMethods.ChangeOfFlowDirection
-{
- partial class ChangeOfFlowDirectionForm
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.wmErrorTextBox2 = new System.Windows.Forms.TextBox();
- this.wmErrorLabel2 = new System.Windows.Forms.Label();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.wmErrorTextBox1 = new System.Windows.Forms.TextBox();
- this.wmErrorLabel1 = new System.Windows.Forms.Label();
- this.okButton = new System.Windows.Forms.Button();
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.wmErrorTextBox3 = new System.Windows.Forms.TextBox();
- this.wmErrorLabel3 = new System.Windows.Forms.Label();
- this.groupBox4 = new System.Windows.Forms.GroupBox();
- this.wmErrorTextBox4 = new System.Windows.Forms.TextBox();
- this.wmErrorLabel4 = new System.Windows.Forms.Label();
- this.groupBox5 = new System.Windows.Forms.GroupBox();
- this.wmErrorTextBox5 = new System.Windows.Forms.TextBox();
- this.wmErrorLabel5 = new System.Windows.Forms.Label();
- this.groupBox6 = new System.Windows.Forms.GroupBox();
- this.wmErrorTextBox6 = new System.Windows.Forms.TextBox();
- this.wmErrorLabel6 = new System.Windows.Forms.Label();
- this.groupBox2.SuspendLayout();
- this.groupBox1.SuspendLayout();
- this.groupBox3.SuspendLayout();
- this.groupBox4.SuspendLayout();
- this.groupBox5.SuspendLayout();
- this.groupBox6.SuspendLayout();
- this.SuspendLayout();
- //
- // groupBox2
- //
- this.groupBox2.Controls.Add(this.wmErrorTextBox2);
- this.groupBox2.Controls.Add(this.wmErrorLabel2);
- this.groupBox2.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.groupBox2.ForeColor = System.Drawing.Color.Black;
- this.groupBox2.Location = new System.Drawing.Point(25, 102);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(333, 81);
- this.groupBox2.TabIndex = 2;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "Water Meter 2";
- //
- // wmErrorTextBox2
- //
- this.wmErrorTextBox2.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.wmErrorTextBox2.Location = new System.Drawing.Point(183, 21);
- this.wmErrorTextBox2.Name = "wmErrorTextBox2";
- this.wmErrorTextBox2.Size = new System.Drawing.Size(137, 52);
- this.wmErrorTextBox2.TabIndex = 1;
- //
- // wmErrorLabel2
- //
- this.wmErrorLabel2.AutoSize = true;
- this.wmErrorLabel2.Location = new System.Drawing.Point(18, 34);
- this.wmErrorLabel2.Name = "wmErrorLabel2";
- this.wmErrorLabel2.Size = new System.Drawing.Size(103, 23);
- this.wmErrorLabel2.TabIndex = 0;
- this.wmErrorLabel2.Text = "Error [%]";
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.wmErrorTextBox1);
- this.groupBox1.Controls.Add(this.wmErrorLabel1);
- this.groupBox1.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.groupBox1.ForeColor = System.Drawing.Color.Black;
- this.groupBox1.Location = new System.Drawing.Point(25, 12);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(333, 81);
- this.groupBox1.TabIndex = 1;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "Water Meter 1";
- //
- // wmErrorTextBox1
- //
- this.wmErrorTextBox1.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.wmErrorTextBox1.Location = new System.Drawing.Point(183, 21);
- this.wmErrorTextBox1.Name = "wmErrorTextBox1";
- this.wmErrorTextBox1.Size = new System.Drawing.Size(137, 52);
- this.wmErrorTextBox1.TabIndex = 1;
- //
- // wmErrorLabel1
- //
- this.wmErrorLabel1.AutoSize = true;
- this.wmErrorLabel1.Location = new System.Drawing.Point(18, 34);
- this.wmErrorLabel1.Name = "wmErrorLabel1";
- this.wmErrorLabel1.Size = new System.Drawing.Size(103, 23);
- this.wmErrorLabel1.TabIndex = 0;
- this.wmErrorLabel1.Text = "Error [%]";
- //
- // okButton
- //
- this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.okButton.ForeColor = System.Drawing.Color.Black;
- this.okButton.Location = new System.Drawing.Point(739, 26);
- this.okButton.Name = "okButton";
- this.okButton.Size = new System.Drawing.Size(98, 63);
- this.okButton.TabIndex = 7;
- this.okButton.Text = "OK";
- this.okButton.UseVisualStyleBackColor = true;
- this.okButton.Click += new System.EventHandler(this.okButton_Click);
- //
- // groupBox3
- //
- this.groupBox3.Controls.Add(this.wmErrorTextBox3);
- this.groupBox3.Controls.Add(this.wmErrorLabel3);
- this.groupBox3.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.groupBox3.ForeColor = System.Drawing.Color.Black;
- this.groupBox3.Location = new System.Drawing.Point(25, 192);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(333, 81);
- this.groupBox3.TabIndex = 3;
- this.groupBox3.TabStop = false;
- this.groupBox3.Text = "Water Meter 3";
- //
- // wmErrorTextBox3
- //
- this.wmErrorTextBox3.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.wmErrorTextBox3.Location = new System.Drawing.Point(183, 21);
- this.wmErrorTextBox3.Name = "wmErrorTextBox3";
- this.wmErrorTextBox3.Size = new System.Drawing.Size(137, 52);
- this.wmErrorTextBox3.TabIndex = 1;
- //
- // wmErrorLabel3
- //
- this.wmErrorLabel3.AutoSize = true;
- this.wmErrorLabel3.Location = new System.Drawing.Point(18, 34);
- this.wmErrorLabel3.Name = "wmErrorLabel3";
- this.wmErrorLabel3.Size = new System.Drawing.Size(103, 23);
- this.wmErrorLabel3.TabIndex = 0;
- this.wmErrorLabel3.Text = "Error [%]";
- //
- // groupBox4
- //
- this.groupBox4.Controls.Add(this.wmErrorTextBox4);
- this.groupBox4.Controls.Add(this.wmErrorLabel4);
- this.groupBox4.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.groupBox4.ForeColor = System.Drawing.Color.Black;
- this.groupBox4.Location = new System.Drawing.Point(25, 282);
- this.groupBox4.Name = "groupBox4";
- this.groupBox4.Size = new System.Drawing.Size(333, 81);
- this.groupBox4.TabIndex = 4;
- this.groupBox4.TabStop = false;
- this.groupBox4.Text = "Water Meter 4";
- //
- // wmErrorTextBox4
- //
- this.wmErrorTextBox4.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.wmErrorTextBox4.Location = new System.Drawing.Point(183, 21);
- this.wmErrorTextBox4.Name = "wmErrorTextBox4";
- this.wmErrorTextBox4.Size = new System.Drawing.Size(137, 52);
- this.wmErrorTextBox4.TabIndex = 1;
- //
- // wmErrorLabel4
- //
- this.wmErrorLabel4.AutoSize = true;
- this.wmErrorLabel4.Location = new System.Drawing.Point(18, 34);
- this.wmErrorLabel4.Name = "wmErrorLabel4";
- this.wmErrorLabel4.Size = new System.Drawing.Size(103, 23);
- this.wmErrorLabel4.TabIndex = 0;
- this.wmErrorLabel4.Text = "Error [%]";
- //
- // groupBox5
- //
- this.groupBox5.Controls.Add(this.wmErrorTextBox5);
- this.groupBox5.Controls.Add(this.wmErrorLabel5);
- this.groupBox5.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.groupBox5.ForeColor = System.Drawing.Color.Black;
- this.groupBox5.Location = new System.Drawing.Point(25, 372);
- this.groupBox5.Name = "groupBox5";
- this.groupBox5.Size = new System.Drawing.Size(333, 81);
- this.groupBox5.TabIndex = 5;
- this.groupBox5.TabStop = false;
- this.groupBox5.Text = "Water Meter 5";
- //
- // wmErrorTextBox5
- //
- this.wmErrorTextBox5.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.wmErrorTextBox5.Location = new System.Drawing.Point(183, 21);
- this.wmErrorTextBox5.Name = "wmErrorTextBox5";
- this.wmErrorTextBox5.Size = new System.Drawing.Size(137, 52);
- this.wmErrorTextBox5.TabIndex = 1;
- //
- // wmErrorLabel5
- //
- this.wmErrorLabel5.AutoSize = true;
- this.wmErrorLabel5.Location = new System.Drawing.Point(18, 34);
- this.wmErrorLabel5.Name = "wmErrorLabel5";
- this.wmErrorLabel5.Size = new System.Drawing.Size(103, 23);
- this.wmErrorLabel5.TabIndex = 0;
- this.wmErrorLabel5.Text = "Error [%]";
- //
- // groupBox6
- //
- this.groupBox6.Controls.Add(this.wmErrorTextBox6);
- this.groupBox6.Controls.Add(this.wmErrorLabel6);
- this.groupBox6.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.groupBox6.ForeColor = System.Drawing.Color.Black;
- this.groupBox6.Location = new System.Drawing.Point(25, 462);
- this.groupBox6.Name = "groupBox6";
- this.groupBox6.Size = new System.Drawing.Size(333, 81);
- this.groupBox6.TabIndex = 6;
- this.groupBox6.TabStop = false;
- this.groupBox6.Text = "Water Meter 6";
- //
- // wmErrorTextBox6
- //
- this.wmErrorTextBox6.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.wmErrorTextBox6.Location = new System.Drawing.Point(183, 21);
- this.wmErrorTextBox6.Name = "wmErrorTextBox6";
- this.wmErrorTextBox6.Size = new System.Drawing.Size(137, 52);
- this.wmErrorTextBox6.TabIndex = 1;
- //
- // wmErrorLabel6
- //
- this.wmErrorLabel6.AutoSize = true;
- this.wmErrorLabel6.Location = new System.Drawing.Point(18, 34);
- this.wmErrorLabel6.Name = "wmErrorLabel6";
- this.wmErrorLabel6.Size = new System.Drawing.Size(103, 23);
- this.wmErrorLabel6.TabIndex = 0;
- this.wmErrorLabel6.Text = "Error [%]";
- //
- // WMErrorsForm
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.DarkGoldenrod;
- this.ClientSize = new System.Drawing.Size(868, 565);
- this.Controls.Add(this.groupBox6);
- this.Controls.Add(this.groupBox5);
- this.Controls.Add(this.groupBox4);
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.okButton);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
- this.Name = "WMErrorsForm";
- this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
- this.Text = "Water Meter States";
- this.TopMost = true;
- this.Load += new System.EventHandler(this.WMErrorsForm_Load);
- this.Paint += new System.Windows.Forms.PaintEventHandler(this.WMErrorsForm_Paint);
- this.groupBox2.ResumeLayout(false);
- this.groupBox2.PerformLayout();
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.groupBox3.ResumeLayout(false);
- this.groupBox3.PerformLayout();
- this.groupBox4.ResumeLayout(false);
- this.groupBox4.PerformLayout();
- this.groupBox5.ResumeLayout(false);
- this.groupBox5.PerformLayout();
- this.groupBox6.ResumeLayout(false);
- this.groupBox6.PerformLayout();
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.GroupBox groupBox2;
- private System.Windows.Forms.TextBox wmErrorTextBox2;
- private System.Windows.Forms.Label wmErrorLabel2;
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.TextBox wmErrorTextBox1;
- private System.Windows.Forms.Label wmErrorLabel1;
- private System.Windows.Forms.Button okButton;
- private System.Windows.Forms.GroupBox groupBox3;
- private System.Windows.Forms.TextBox wmErrorTextBox3;
- private System.Windows.Forms.Label wmErrorLabel3;
- private System.Windows.Forms.GroupBox groupBox4;
- private System.Windows.Forms.TextBox wmErrorTextBox4;
- private System.Windows.Forms.Label wmErrorLabel4;
- private System.Windows.Forms.GroupBox groupBox5;
- private System.Windows.Forms.TextBox wmErrorTextBox5;
- private System.Windows.Forms.Label wmErrorLabel5;
- private System.Windows.Forms.GroupBox groupBox6;
- private System.Windows.Forms.TextBox wmErrorTextBox6;
- private System.Windows.Forms.Label wmErrorLabel6;
-
- }
-}
\ No newline at end of file
diff --git a/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.resx b/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.resx
deleted file mode 100644
index 1af7de150..000000000
--- a/TBF/BenchControl/TestMethods/ChangeOfFlowDirection/ChangeOfFlowDirectionForm.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj
index 3fa098334..f37eeeb71 100644
--- a/TBF/TBF.csproj
+++ b/TBF/TBF.csproj
@@ -931,15 +931,9 @@
WMErrorsForm24.cs
-
-
-
-
- Form
-
-
- ChangeOfFlowDirectionForm.cs
-
+
+
+
@@ -2481,9 +2475,6 @@
WMErrorsForm24.cs
-
- ChangeOfFlowDirectionForm.cs
-
CycleDlg.cs
diff --git a/TBF/UiBridge/Bridge.cs b/TBF/UiBridge/Bridge.cs
index 30206263a..336717c41 100644
--- a/TBF/UiBridge/Bridge.cs
+++ b/TBF/UiBridge/Bridge.cs
@@ -221,19 +221,6 @@ namespace TBF.UiBridge
public static event EventHandler CloseModelessFormHandler;
- ///
- /// Used by CoverTest, AskYesNoOp and MessageBoxOp.
- ///
- public static void OnCloseQandAForm(object sender, EventArgs args)
- {
- if (CloseQandAFormHandler == null) return;
- try { CloseQandAFormHandler(sender, null); }
- catch (Exception e) { log.Error("CloseQandAFormHandler(...) failed", e); }
- }
- public static event EventHandler CloseQandAFormHandler;
-
-
-
///
/// Called from the state machine when a procedure is selected and UI needs to be updated.
///