DataEntry.Uni.CycleBgEnForm : autoSNButton --> multiPurposeButton, ver. 3.9.2137
This commit is contained in:
parent
b931ed62ff
commit
279c8eefb4
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("3.9.2136.0")]
|
||||
[assembly: AssemblyFileVersion("3.9.2136.0")]
|
||||
[assembly: AssemblyVersion("3.9.2137.0")]
|
||||
[assembly: AssemblyFileVersion("3.9.2137.0")]
|
||||
|
||||
@ -600,21 +600,9 @@
|
||||
<data name="P_in" xml:space="preserve">
|
||||
<value>P up</value>
|
||||
</data>
|
||||
<data name="P_in_end" xml:space="preserve">
|
||||
<value>P up end</value>
|
||||
</data>
|
||||
<data name="P_in_start" xml:space="preserve">
|
||||
<value>P up start</value>
|
||||
</data>
|
||||
<data name="P_out" xml:space="preserve">
|
||||
<value>P down</value>
|
||||
</data>
|
||||
<data name="P_out_end" xml:space="preserve">
|
||||
<value>P down end</value>
|
||||
</data>
|
||||
<data name="P_out_start" xml:space="preserve">
|
||||
<value>P down start</value>
|
||||
</data>
|
||||
<data name="Page" xml:space="preserve">
|
||||
<value>str.</value>
|
||||
</data>
|
||||
@ -1755,4 +1743,7 @@
|
||||
<data name="About" xml:space="preserve">
|
||||
<value>O</value>
|
||||
</data>
|
||||
<data name="Print" xml:space="preserve">
|
||||
<value>Tisknout</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -6,9 +6,9 @@ using Common;
|
||||
|
||||
namespace TBF.Rig.DataEntry
|
||||
{
|
||||
///
|
||||
/// Ac = Action
|
||||
///
|
||||
/// <summary>
|
||||
/// Action of a DataEntry field
|
||||
/// </summary>
|
||||
public enum Ac
|
||||
{
|
||||
[Description("Clear")] Clear, /// Clear when the form is open, save on OK
|
||||
@ -19,9 +19,9 @@ namespace TBF.Rig.DataEntry
|
||||
Count,
|
||||
}
|
||||
|
||||
///
|
||||
/// Ct = Content
|
||||
///
|
||||
/// <summary>
|
||||
/// Content of a DataEntry field
|
||||
/// </summary>
|
||||
public enum Ct
|
||||
{
|
||||
[Description("None")] None,
|
||||
@ -48,6 +48,16 @@ namespace TBF.Rig.DataEntry
|
||||
Count
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Function of the multi purpose button
|
||||
/// </summary>
|
||||
public enum MultiPurposeBtnFunction
|
||||
{
|
||||
None,
|
||||
AutoSN,
|
||||
PrintLabelsOnOff,
|
||||
}
|
||||
|
||||
///
|
||||
/// Identifies image instance
|
||||
///
|
||||
|
||||
@ -50,6 +50,9 @@ namespace TBF.Rig.DataEntry.Uni
|
||||
readonly ComboBox[,] comboBoxes; /// Combo boxes for values in columns
|
||||
readonly CheckBox[] checkBoxes; /// Check boxes for water meter enable/disable
|
||||
|
||||
readonly MultiPurposeBtnFunction multiPurposeButtonFn;
|
||||
bool multiPurposeButtonFlag;
|
||||
|
||||
readonly LocalSettings ls;
|
||||
|
||||
bool isHandlersEnabled; /// Initially false, set to true after ComboBoxes are filled with data
|
||||
@ -124,13 +127,29 @@ namespace TBF.Rig.DataEntry.Uni
|
||||
comboBoxes = new ComboBox[colItems.Count, wmsCount];
|
||||
checkBoxes = new CheckBox[wmsCount];
|
||||
|
||||
/// Make Auto s/n button visible if there is either Ct.SerialNr or Ct.SerialNrAux column
|
||||
///
|
||||
/// Determine the multi purpose button function
|
||||
///
|
||||
multiPurposeButton.Visible = false;
|
||||
multiPurposeButtonFn = MultiPurposeBtnFunction.None;
|
||||
int buttonsWidth = 350;
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
if ((colItems[k].Content == Ct.SerialNr || colItems[k].Content == Ct.SerialNrAux) && colItems[k].Action != Ac.LoadReadOnly)
|
||||
{
|
||||
autoSNButton.Visible = true;
|
||||
multiPurposeButton.Visible = true;
|
||||
multiPurposeButton.Text = "Auto s/n";
|
||||
multiPurposeButtonFn = MultiPurposeBtnFunction.AutoSN;
|
||||
buttonsWidth += 147;
|
||||
break;
|
||||
}
|
||||
|
||||
if (colItems[k].Content == Ct.PrintLabel)
|
||||
{
|
||||
multiPurposeButton.Visible = true;
|
||||
multiPurposeButton.Text = string.Format("{0} ({1}/{2})", Strings.Print, Strings.yes, Strings.no);
|
||||
multiPurposeButtonFn = MultiPurposeBtnFunction.PrintLabelsOnOff;
|
||||
multiPurposeButtonFlag = false;
|
||||
buttonsWidth += 147;
|
||||
break;
|
||||
}
|
||||
@ -518,7 +537,7 @@ namespace TBF.Rig.DataEntry.Uni
|
||||
case Ac.Set:
|
||||
for (int i = 0; i < wmsCount; i++)
|
||||
{
|
||||
comboBoxes[k, i].Text = Strings.yes;
|
||||
comboBoxes[k, i].Text = (WaterMeters[i] != null && !WaterMeters[i].Disabled) ? Strings.yes : Strings.no;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -648,63 +667,68 @@ namespace TBF.Rig.DataEntry.Uni
|
||||
InitializeBoxes();
|
||||
}
|
||||
|
||||
private void autoSNButton_Click(object sender, EventArgs e)
|
||||
private void multiPurposeButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
///
|
||||
/// Find the 1st enabled water meter
|
||||
///
|
||||
int firstIx;
|
||||
for (firstIx = 0; firstIx < wmsCount; firstIx++)
|
||||
{
|
||||
if (checkBoxes[firstIx].Checked) break;
|
||||
}
|
||||
if (firstIx == wmsCount)
|
||||
{
|
||||
return; /// There is not any enabled water meter
|
||||
}
|
||||
if (multiPurposeButtonFn == MultiPurposeBtnFunction.None) return;
|
||||
|
||||
char[] digits = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
|
||||
|
||||
///
|
||||
/// Find a column with serial numbers
|
||||
///
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
if (multiPurposeButtonFn == MultiPurposeBtnFunction.AutoSN)
|
||||
{
|
||||
if ((colItems[k].Content == Ct.SerialNr || colItems[k].Content == Ct.SerialNrAux) && colItems[k].Action != Ac.LoadReadOnly)
|
||||
///
|
||||
/// Find the 1st enabled water meter
|
||||
///
|
||||
int firstIx;
|
||||
for (firstIx = 0; firstIx < wmsCount; firstIx++)
|
||||
{
|
||||
///
|
||||
/// Column with serial numbers found => perform an auto s/n assignment
|
||||
///
|
||||
string firstSN = comboBoxes[k, firstIx].Text;
|
||||
if (checkBoxes[firstIx].Checked) break;
|
||||
}
|
||||
if (firstIx == wmsCount)
|
||||
{
|
||||
return; /// There is not any enabled water meter
|
||||
}
|
||||
|
||||
int firstSnNr;
|
||||
int startIx = firstSN.IndexOfAny(digits);
|
||||
if (startIx >= 0)
|
||||
char[] digits = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
|
||||
|
||||
///
|
||||
/// Find a column with serial numbers
|
||||
///
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
if ((colItems[k].Content == Ct.SerialNr || colItems[k].Content == Ct.SerialNrAux) && colItems[k].Action != Ac.LoadReadOnly)
|
||||
{
|
||||
int lastDigitPosPlus1 = startIx + 1;
|
||||
var listOfDigits = new List<char>(digits);
|
||||
while (lastDigitPosPlus1 < firstSN.Length && listOfDigits.Contains(firstSN[lastDigitPosPlus1]))
|
||||
{
|
||||
lastDigitPosPlus1++;
|
||||
}
|
||||
int digitsCount = lastDigitPosPlus1 - startIx;
|
||||
///
|
||||
/// Column with serial numbers found => perform an auto s/n assignment
|
||||
///
|
||||
string firstSN = comboBoxes[k, firstIx].Text;
|
||||
|
||||
if (int.TryParse(firstSN.Substring(startIx, digitsCount), out firstSnNr) && firstSnNr >= 0)
|
||||
int firstSnNr;
|
||||
int startIx = firstSN.IndexOfAny(digits);
|
||||
if (startIx >= 0)
|
||||
{
|
||||
for (int ix = firstIx + 1; ix < wmsCount; ix++)
|
||||
int lastDigitPosPlus1 = startIx + 1;
|
||||
var listOfDigits = new List<char>(digits);
|
||||
while (lastDigitPosPlus1 < firstSN.Length && listOfDigits.Contains(firstSN[lastDigitPosPlus1]))
|
||||
{
|
||||
if (checkBoxes[ix].Checked)
|
||||
lastDigitPosPlus1++;
|
||||
}
|
||||
int digitsCount = lastDigitPosPlus1 - startIx;
|
||||
|
||||
if (int.TryParse(firstSN.Substring(startIx, digitsCount), out firstSnNr) && firstSnNr >= 0)
|
||||
{
|
||||
for (int ix = firstIx + 1; ix < wmsCount; ix++)
|
||||
{
|
||||
firstSnNr++;
|
||||
string newSN = firstSnNr.ToString();
|
||||
int len = newSN.Length;
|
||||
if (len <= digitsCount)
|
||||
if (checkBoxes[ix].Checked)
|
||||
{
|
||||
comboBoxes[k, ix].Text = firstSN.Substring(0, startIx + digitsCount - len) + newSN + firstSN.Substring(startIx + digitsCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
comboBoxes[k, ix].Text = firstSN.Substring(0, startIx) + newSN + firstSN.Substring(startIx + digitsCount); ;
|
||||
firstSnNr++;
|
||||
string newSN = firstSnNr.ToString();
|
||||
int len = newSN.Length;
|
||||
if (len <= digitsCount)
|
||||
{
|
||||
comboBoxes[k, ix].Text = firstSN.Substring(0, startIx + digitsCount - len) + newSN + firstSN.Substring(startIx + digitsCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
comboBoxes[k, ix].Text = firstSN.Substring(0, startIx) + newSN + firstSN.Substring(startIx + digitsCount); ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -712,6 +736,27 @@ namespace TBF.Rig.DataEntry.Uni
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (multiPurposeButtonFn == MultiPurposeBtnFunction.PrintLabelsOnOff)
|
||||
{
|
||||
///
|
||||
/// Find a column with Ct.PrintLabel
|
||||
///
|
||||
for (int k = 0; k < colItems.Count; k++)
|
||||
{
|
||||
if (colItems[k].Content == Ct.PrintLabel)
|
||||
{
|
||||
for (int ix = 0; ix < wmsCount; ix++)
|
||||
{
|
||||
if (WaterMeters[ix] != null && !WaterMeters[ix].Disabled)
|
||||
{
|
||||
comboBoxes[k, ix].Text = multiPurposeButtonFlag ? Strings.yes : Strings.no;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
multiPurposeButtonFlag = !multiPurposeButtonFlag;
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBox_SelectedIndexChanged(object sndr, EventArgs e)
|
||||
|
||||
18
TBF/Rig/DataEntry/Uni/CycleBgEnForm.designer.cs
generated
18
TBF/Rig/DataEntry/Uni/CycleBgEnForm.designer.cs
generated
@ -34,7 +34,7 @@ namespace TBF.Rig.DataEntry.Uni
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleBgEnForm));
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.clearButton = new System.Windows.Forms.Button();
|
||||
this.autoSNButton = new System.Windows.Forms.Button();
|
||||
this.multiPurposeButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
@ -53,20 +53,20 @@ namespace TBF.Rig.DataEntry.Uni
|
||||
this.clearButton.UseVisualStyleBackColor = true;
|
||||
this.clearButton.Click += new System.EventHandler(this.clearButton_Click);
|
||||
//
|
||||
// autoSNButton
|
||||
// multiPurposeButton
|
||||
//
|
||||
resources.ApplyResources(this.autoSNButton, "autoSNButton");
|
||||
this.autoSNButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.autoSNButton.Name = "autoSNButton";
|
||||
this.autoSNButton.UseVisualStyleBackColor = true;
|
||||
this.autoSNButton.Click += new System.EventHandler(this.autoSNButton_Click);
|
||||
resources.ApplyResources(this.multiPurposeButton, "multiPurposeButton");
|
||||
this.multiPurposeButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.multiPurposeButton.Name = "multiPurposeButton";
|
||||
this.multiPurposeButton.UseVisualStyleBackColor = true;
|
||||
this.multiPurposeButton.Click += new System.EventHandler(this.multiPurposeButton_Click);
|
||||
//
|
||||
// CycleBgEnForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.Controls.Add(this.autoSNButton);
|
||||
this.Controls.Add(this.multiPurposeButton);
|
||||
this.Controls.Add(this.clearButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.ForeColor = System.Drawing.Color.Black;
|
||||
@ -81,6 +81,6 @@ namespace TBF.Rig.DataEntry.Uni
|
||||
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button clearButton;
|
||||
private System.Windows.Forms.Button autoSNButton;
|
||||
private System.Windows.Forms.Button multiPurposeButton;
|
||||
}
|
||||
}
|
||||
@ -183,40 +183,40 @@
|
||||
<data name=">>clearButton.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="autoSNButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<data name="multiPurposeButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="autoSNButton.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<data name="multiPurposeButton.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 14.25pt</value>
|
||||
</data>
|
||||
<data name="autoSNButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<data name="multiPurposeButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="autoSNButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<data name="multiPurposeButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>648, 26</value>
|
||||
</data>
|
||||
<data name="autoSNButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<data name="multiPurposeButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>112, 63</value>
|
||||
</data>
|
||||
<data name="autoSNButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<data name="multiPurposeButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>9</value>
|
||||
</data>
|
||||
<data name="autoSNButton.Text" xml:space="preserve">
|
||||
<value>Auto s/n</value>
|
||||
<data name="multiPurposeButton.Text" xml:space="preserve">
|
||||
<value>Multi purpose</value>
|
||||
</data>
|
||||
<data name="autoSNButton.Visible" type="System.Boolean, mscorlib">
|
||||
<data name="multiPurposeButton.Visible" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name=">>autoSNButton.Name" xml:space="preserve">
|
||||
<value>autoSNButton</value>
|
||||
<data name=">>multiPurposeButton.Name" xml:space="preserve">
|
||||
<value>multiPurposeButton</value>
|
||||
</data>
|
||||
<data name=">>autoSNButton.Type" xml:space="preserve">
|
||||
<data name=">>multiPurposeButton.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>autoSNButton.Parent" xml:space="preserve">
|
||||
<data name=">>multiPurposeButton.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>autoSNButton.ZOrder" xml:space="preserve">
|
||||
<data name=">>multiPurposeButton.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user