CycleEndForm in DataEntry.Standard24 can be disabled.

This commit is contained in:
Milan Hanajik 2015-05-21 12:44:48 +02:00
parent 0d1b1423c4
commit 4cdf471c68
6 changed files with 68 additions and 23 deletions

View File

@ -150,7 +150,10 @@ namespace TBF.BenchControl.DataEntry.Standard24
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
break;
case CurrentOp.ShowFormAtCycleEnd:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
if (entryFormCfg.ShowCycleEndForm)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
}
break;
case CurrentOp.EnterTestStartStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
@ -172,22 +175,25 @@ namespace TBF.BenchControl.DataEntry.Standard24
if (!resultSaved) /// This is to save the result only once
{
if (modelessDlg is CycleBeginningForm)
if (currentOp == CurrentOp.ShowFormAtCycleBeginning)
{
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
purchaseOrder = dlg.PurchaseOrder;
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count); i++)
if (dlg != null)
{
if (waterMeters[i] != null)
purchaseOrder = dlg.PurchaseOrder;
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count); i++)
{
serialNr[i] = waterMeters[i].SerialNr = dlg.SNText[i];
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
if (waterMeters[i] != null)
{
serialNr[i] = waterMeters[i].SerialNr = dlg.SNText[i];
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
}
}
}
}
else if (modelessDlg is CycleEndForm)
else if (currentOp == CurrentOp.ShowFormAtCycleEnd)
{
CycleEndForm dlg = (modelessDlg as CycleEndForm);
@ -195,7 +201,8 @@ namespace TBF.BenchControl.DataEntry.Standard24
{
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;
}
}
}
@ -210,16 +217,16 @@ namespace TBF.BenchControl.DataEntry.Standard24
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
{
/// Fixed start test - end
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
{
/// Fixed start test - end
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmEndState[i] = dlg.WMEndState[i];
}
}
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmEndState[i] = dlg.WMEndState[i];
}
}
resultSaved = true;
modelessDlg = null;
}

View File

@ -17,12 +17,14 @@ namespace TBF.BenchControl.DataEntry.Standard24
///
/// Serialized parameters
///
public bool ShowCycleEndForm;
/// Private parameterless constructor invoked by all other (public) constructors
EntryFormCfg()
{
Name = "DataEntry-Standard-24";
ParentName = string.Empty;
ShowCycleEndForm = false;
}
public EntryFormCfg(IComponentFactory factory)
@ -33,7 +35,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
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.Standard24
{
@ -32,9 +33,15 @@ namespace TBF.BenchControl.DataEntry.Standard24
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.Standard24
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.Standard24
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.Standard24
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(131, 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.Standard24
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(27, 60);
this.nameLabel.Location = new System.Drawing.Point(32, 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.Standard24
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(134, 33);
this.classNameLabel.Location = new System.Drawing.Point(128, 32);
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(131, 90);
this.showCycleEndFormCheckBox.Name = "showCycleEndFormCheckBox";
this.showCycleEndFormCheckBox.Size = new System.Drawing.Size(125, 17);
this.showCycleEndFormCheckBox.TabIndex = 13;
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.Standard24
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.CheckBox showCycleEndFormCheckBox;
}
}

View File

@ -2112,6 +2112,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Show cycle end form.
/// </summary>
internal static string Show_cycle_end_form {
get {
return ResourceManager.GetString("Show_cycle_end_form", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Single.
/// </summary>

View File

@ -1045,4 +1045,7 @@
<data name="Nr_meters_in_a_group" xml:space="preserve">
<value>Nr. meters in a group:</value>
</data>
<data name="Show_cycle_end_form" xml:space="preserve">
<value>Show cycle end form</value>
</data>
</root>