CycleEndForm in DataEntry.Standard can be disabled as well.

This commit is contained in:
Milan Hanajik 2015-05-21 12:51:23 +02:00
parent 4cdf471c68
commit a1668dc5dd
4 changed files with 40 additions and 7 deletions

View File

@ -150,7 +150,10 @@ namespace TBF.BenchControl.DataEntry.Standard
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
break;
case CurrentOp.ShowFormAtCycleEnd:
if (entryFormCfg.ShowCycleEndForm)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
}
break;
case CurrentOp.EnterTestStartStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
@ -172,10 +175,12 @@ namespace TBF.BenchControl.DataEntry.Standard
if (!resultSaved) /// This is to save the result only once
{
if (modelessDlg is CycleBeginningForm)
if (currentOp == CurrentOp.ShowFormAtCycleBeginning)
{
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
if (dlg != null)
{
purchaseOrder = dlg.PurchaseOrder;
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count); i++)
@ -187,7 +192,8 @@ namespace TBF.BenchControl.DataEntry.Standard
}
}
}
else if (modelessDlg is CycleEndForm)
}
else if (currentOp == CurrentOp.ShowFormAtCycleEnd)
{
CycleEndForm dlg = (modelessDlg as CycleEndForm);
@ -195,7 +201,8 @@ namespace TBF.BenchControl.DataEntry.Standard
{
if (waterMeters[i] != null)
{
wmCycleEndState[i] = waterMeters[i].EndState = dlg.EndStateText[i];
/// In case entryFormCfg.ShowCycleEndForm == false dlg would be null, values would be string.Empty
wmCycleEndState[i] = waterMeters[i].EndState = (dlg != null) ? dlg.EndStateText[i] : string.Empty;
}
}
}

View File

@ -17,12 +17,14 @@ namespace TBF.BenchControl.DataEntry.Standard
///
/// Serialized parameters
///
public bool ShowCycleEndForm;
/// Private parameterless constructor invoked by all other (public) constructors
EntryFormCfg()
{
Name = "DataEntry-Standard";
ParentName = string.Empty;
ShowCycleEndForm = false;
}
public EntryFormCfg(IComponentFactory factory)
@ -33,7 +35,7 @@ namespace TBF.BenchControl.DataEntry.Standard
public string ToString(int i)
{
return string.Format("Name={0}", Name);
return string.Format("Name={0}, ShowEndForm={1}", Name, ShowCycleEndForm);
}
}
}

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using log4net;
using TBF.BenchControl.Generic;
using TBF.Resources;
namespace TBF.BenchControl.DataEntry.Standard
{
@ -32,9 +33,15 @@ namespace TBF.BenchControl.DataEntry.Standard
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
{
Localize();
Redraw();
}
void Localize()
{
showCycleEndFormCheckBox.Text = Strings.Show_cycle_end_form;
}
public void Closing()
{
}
@ -44,11 +51,13 @@ namespace TBF.BenchControl.DataEntry.Standard
if (config == null) return; /// Control was not loaded, settings were not changed
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
showCycleEndFormCheckBox.Checked = config.ShowCycleEndForm;
}
public void Unlock()
{
nameTextBox.Enabled = true;
showCycleEndFormCheckBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
@ -64,6 +73,7 @@ namespace TBF.BenchControl.DataEntry.Standard
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
config.Name = nameTextBox.Text;
config.ShowCycleEndForm = showCycleEndFormCheckBox.Checked;
return flags;
}

View File

@ -34,12 +34,13 @@ namespace TBF.BenchControl.DataEntry.Standard
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.showCycleEndFormCheckBox = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(137, 57);
this.nameTextBox.Location = new System.Drawing.Point(123, 57);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 5;
@ -47,7 +48,7 @@ namespace TBF.BenchControl.DataEntry.Standard
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(27, 60);
this.nameLabel.Location = new System.Drawing.Point(35, 60);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 4;
@ -56,16 +57,28 @@ namespace TBF.BenchControl.DataEntry.Standard
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(134, 33);
this.classNameLabel.Location = new System.Drawing.Point(120, 33);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 3;
this.classNameLabel.Text = "ComonentName";
//
// showCycleEndFormCheckBox
//
this.showCycleEndFormCheckBox.AutoSize = true;
this.showCycleEndFormCheckBox.Enabled = false;
this.showCycleEndFormCheckBox.Location = new System.Drawing.Point(124, 90);
this.showCycleEndFormCheckBox.Name = "showCycleEndFormCheckBox";
this.showCycleEndFormCheckBox.Size = new System.Drawing.Size(125, 17);
this.showCycleEndFormCheckBox.TabIndex = 14;
this.showCycleEndFormCheckBox.Text = "Show cycle end form";
this.showCycleEndFormCheckBox.UseVisualStyleBackColor = true;
//
// EntryFormCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.showCycleEndFormCheckBox);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
@ -82,5 +95,6 @@ namespace TBF.BenchControl.DataEntry.Standard
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.CheckBox showCycleEndFormCheckBox;
}
}