Adjustment modified to use the new Results.
This commit is contained in:
@@ -339,7 +339,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
|
||||
|
||||
/// Update modeless dialog error information
|
||||
Bridge.OnAdjustmentInProgress(this, new AdjustmentInProgressEventArgs(tstRslt));
|
||||
Bridge.OnAdjustmentInProgress(this, new AdjustmentInProgressEventArgs(testName));
|
||||
|
||||
/// Test 'Quit'
|
||||
if ((modelessDlg is GenericDevices.IHasCompleted) && !(modelessDlg as GenericDevices.IHasCompleted).Completed)
|
||||
|
||||
@@ -15,20 +15,27 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(WMErrorsForm));
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
public readonly int waterMetersCount;
|
||||
|
||||
///
|
||||
/// Updated in constructor
|
||||
///
|
||||
readonly int waterMetersCount; /// Number of text boxes for serial numbers
|
||||
readonly bool[] disabled;
|
||||
Rectangle[] rects;
|
||||
|
||||
TestResult tr;
|
||||
///
|
||||
/// 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; } }
|
||||
///
|
||||
/// Set to 'true' when the form closes
|
||||
///
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
|
||||
Rectangle[] rects;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
@@ -43,6 +50,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
|
||||
disabled = new bool[waterMetersCount];
|
||||
for (int i = 0; i < waterMetersCount; i++) disabled[i] = waterMeters[i].Disabled;
|
||||
|
||||
error = new double[waterMetersCount];
|
||||
}
|
||||
|
||||
/// <summary> Parameterless constructor for 3 watermeters </summary>
|
||||
@@ -51,7 +60,6 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
InitializeComponent();
|
||||
|
||||
completed = false;
|
||||
tr = null;
|
||||
|
||||
/// Attach to 'AdjustmentInProgress' handler
|
||||
UiBridge.Bridge.AdjustmentInProgressHandler += delegate(object sender, UiBridge.AdjustmentInProgressEventArgs args)
|
||||
@@ -111,42 +119,48 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
|
||||
void OnAdjustmentInProgress(object sender, UiBridge.AdjustmentInProgressEventArgs args)
|
||||
{
|
||||
tr = args.TestResult;
|
||||
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 (tr != null)
|
||||
{
|
||||
if (waterMetersCount >= 1 && !disabled[0]) wmErrorTextBox1.Text = tr.Meters[0].VolumeErrorPct.ToString("F1");
|
||||
if (waterMetersCount >= 2 && !disabled[1]) wmErrorTextBox2.Text = tr.Meters[1].VolumeErrorPct.ToString("F1");
|
||||
if (waterMetersCount >= 3 && !disabled[2]) wmErrorTextBox3.Text = tr.Meters[2].VolumeErrorPct.ToString("F1");
|
||||
if (waterMetersCount >= 4 && !disabled[3]) wmErrorTextBox4.Text = tr.Meters[3].VolumeErrorPct.ToString("F1");
|
||||
if (waterMetersCount >= 5 && !disabled[4]) wmErrorTextBox5.Text = tr.Meters[4].VolumeErrorPct.ToString("F1");
|
||||
if (waterMetersCount >= 6 && !disabled[5]) wmErrorTextBox6.Text = tr.Meters[5].VolumeErrorPct.ToString("F1");
|
||||
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]);
|
||||
}
|
||||
for (int i = 0; i < waterMetersCount; i++) Invalidate(rects[i]);
|
||||
}
|
||||
|
||||
private void WMErrorsForm_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
if (tr != null)
|
||||
{
|
||||
System.Drawing.Graphics graphics = this.CreateGraphics();
|
||||
System.Drawing.Graphics graphics = this.CreateGraphics();
|
||||
|
||||
for (int i = 0; i < waterMetersCount; i++)
|
||||
for (int i = 0; i < waterMetersCount; i++)
|
||||
{
|
||||
if (!disabled[i])
|
||||
{
|
||||
if (!disabled[i])
|
||||
{
|
||||
PaintOne(graphics, rects[i], tr.Meters[i].VolumeErrorPct, tr.ErrLimLo + tr.Uncertainty, tr.ErrLimHi - tr.Uncertainty);
|
||||
}
|
||||
PaintOne(graphics, rects[i], error[i], errLimLo, errLimHi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PaintOne(System.Drawing.Graphics g, Rectangle r, float value, float limLo, float limHi)
|
||||
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);
|
||||
@@ -164,7 +178,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
|
||||
int x0 = r.Left + r.Width / 2;
|
||||
int dx = r.Height / 3;
|
||||
int x = (int)((float)r.Width * (2.0 * value - limLo - limHi) / (limHi - limLo) / 6.0f + 0.5f);
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -15,25 +15,31 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(WMErrorsForm12));
|
||||
|
||||
const int MaxWMsCount = 12; /// Implementation limit of this form
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
readonly int waterMetersCount;
|
||||
const int MaxWMsCount = 12; /// Implementation limit of this form
|
||||
|
||||
///
|
||||
/// Updated in constructor
|
||||
///
|
||||
readonly int waterMetersCount; /// Number of text boxes for serial numbers
|
||||
readonly bool[] disabled;
|
||||
|
||||
TestResult tr;
|
||||
|
||||
int textBoxesCount;
|
||||
|
||||
Label[] labels;
|
||||
TextBox[] errors;
|
||||
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;
|
||||
|
||||
|
||||
/// <summary> Parameterless constructor for 3 watermeters </summary>
|
||||
public WMErrorsForm12()
|
||||
@@ -64,7 +70,6 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
}
|
||||
|
||||
completed = false;
|
||||
tr = null;
|
||||
|
||||
/// Attach to 'AdjustmentInProgress' handler
|
||||
UiBridge.Bridge.AdjustmentInProgressHandler += delegate(object sender, UiBridge.AdjustmentInProgressEventArgs args)
|
||||
@@ -90,6 +95,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
|
||||
disabled = new bool[waterMetersCount];
|
||||
for (int i = 0; i < waterMetersCount; i++) disabled[i] = waterMeters[i].Disabled;
|
||||
|
||||
error = new double[waterMetersCount];
|
||||
}
|
||||
|
||||
|
||||
@@ -153,39 +160,45 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
|
||||
void OnAdjustmentInProgress(object sender, UiBridge.AdjustmentInProgressEventArgs args)
|
||||
{
|
||||
tr = args.TestResult;
|
||||
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 (tr != null)
|
||||
for (int i = 0; i < textBoxesCount; i++)
|
||||
{
|
||||
for (int i = 0; i < textBoxesCount; i++)
|
||||
{
|
||||
errors[i].Text = tr.Meters[i].VolumeErrorPct.ToString("F1");
|
||||
Invalidate(rects[i]);
|
||||
}
|
||||
errors[i].Text = error[i].ToString("F1");
|
||||
Invalidate(rects[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void WMErrorsForm_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
if (tr != null)
|
||||
{
|
||||
System.Drawing.Graphics graphics = this.CreateGraphics();
|
||||
System.Drawing.Graphics graphics = this.CreateGraphics();
|
||||
|
||||
for (int i = 0; i < waterMetersCount; i++)
|
||||
for (int i = 0; i < waterMetersCount; i++)
|
||||
{
|
||||
if (!disabled[i])
|
||||
{
|
||||
if (!disabled[i])
|
||||
{
|
||||
PaintOne(graphics, rects[i], tr.Meters[i].VolumeErrorPct, tr.ErrLimLo + tr.Uncertainty, tr.ErrLimHi - tr.Uncertainty);
|
||||
}
|
||||
PaintOne(graphics, rects[i], error[i], errLimLo, errLimHi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PaintOne(System.Drawing.Graphics g, Rectangle r, float value, float limLo, float limHi)
|
||||
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);
|
||||
@@ -203,7 +216,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
|
||||
int x0 = r.Left + r.Width / 2;
|
||||
int dx = r.Height / 3;
|
||||
int x = (int)((float)r.Width * (2.0 * value - limLo - limHi) / (limHi - limLo) / 6.0f + 0.5f);
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -15,25 +15,31 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(WMErrorsForm24));
|
||||
|
||||
const int MaxWMsCount = 24; /// Implementation limit of this form
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
readonly int waterMetersCount;
|
||||
const int MaxWMsCount = 24; /// Implementation limit of this form
|
||||
|
||||
///
|
||||
/// Updated in constructor
|
||||
///
|
||||
readonly int waterMetersCount; /// Number of text boxes for serial numbers
|
||||
readonly bool[] disabled;
|
||||
|
||||
TestResult tr;
|
||||
|
||||
int textBoxesCount;
|
||||
|
||||
Label[] labels;
|
||||
TextBox[] errors;
|
||||
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;
|
||||
|
||||
|
||||
/// <summary> Parameterless constructor for 3 watermeters </summary>
|
||||
public WMErrorsForm24()
|
||||
@@ -68,7 +74,6 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
}
|
||||
|
||||
completed = false;
|
||||
tr = null;
|
||||
|
||||
/// Attach to 'AdjustmentInProgress' handler
|
||||
UiBridge.Bridge.AdjustmentInProgressHandler += delegate(object sender, UiBridge.AdjustmentInProgressEventArgs args)
|
||||
@@ -94,6 +99,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
|
||||
disabled = new bool[waterMetersCount];
|
||||
for (int i = 0; i < waterMetersCount; i++) disabled[i] = waterMeters[i].Disabled;
|
||||
|
||||
error = new double[waterMetersCount];
|
||||
}
|
||||
|
||||
|
||||
@@ -157,39 +164,45 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
|
||||
void OnAdjustmentInProgress(object sender, UiBridge.AdjustmentInProgressEventArgs args)
|
||||
{
|
||||
tr = args.TestResult;
|
||||
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 (tr != null)
|
||||
for (int i = 0; i < textBoxesCount; i++)
|
||||
{
|
||||
for (int i = 0; i < textBoxesCount; i++)
|
||||
{
|
||||
errors[i].Text = tr.Meters[i].VolumeErrorPct.ToString("F1");
|
||||
Invalidate(rects[i]);
|
||||
}
|
||||
errors[i].Text = error[i].ToString("F1");
|
||||
Invalidate(rects[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void WMErrorsForm_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
if (tr != null)
|
||||
{
|
||||
System.Drawing.Graphics graphics = this.CreateGraphics();
|
||||
System.Drawing.Graphics graphics = this.CreateGraphics();
|
||||
|
||||
for (int i = 0; i < waterMetersCount; i++)
|
||||
for (int i = 0; i < waterMetersCount; i++)
|
||||
{
|
||||
if (!disabled[i])
|
||||
{
|
||||
if (!disabled[i])
|
||||
{
|
||||
PaintOne(graphics, rects[i], tr.Meters[i].VolumeErrorPct, tr.ErrLimLo + tr.Uncertainty, tr.ErrLimHi - tr.Uncertainty);
|
||||
}
|
||||
PaintOne(graphics, rects[i], error[i], errLimLo, errLimHi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PaintOne(System.Drawing.Graphics g, Rectangle r, float value, float limLo, float limHi)
|
||||
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);
|
||||
@@ -207,7 +220,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
|
||||
int x0 = r.Left + r.Width / 2;
|
||||
int dx = r.Height / 3;
|
||||
int x = (int)((float)r.Width * (2.0 * value - limLo - limHi) / (limHi - limLo) / 6.0f + 0.5f);
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user