Refactoring : TestBenchFramework --> TBF ver. 2.18.789
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Forms
|
||||
{
|
||||
public partial class PrintOrderForm : Form
|
||||
{
|
||||
public string PurchaseOrder;
|
||||
public string Tester;
|
||||
public bool OnlyGoodResults;
|
||||
public bool OnlyLastResult;
|
||||
|
||||
public PrintOrderForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void PrintOrderForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
|
||||
TBF.LocalSettings ls = Program.LocalSettings;
|
||||
Left = (ls.PrintOrderLeft != 0) ? ls.PrintOrderLeft : 200;
|
||||
Top = (ls.PrintOrderTop != 0) ? ls.PrintOrderTop : 100;
|
||||
|
||||
onlyGoodCheckBox.Checked = OnlyGoodResults = Program.LocalSettings.PrintOrderOnlyGoodResult;
|
||||
onlyLastCheckBox.Checked = OnlyLastResult = Program.LocalSettings.PrintOrderOnlyLastResult;
|
||||
|
||||
PrepareOrderCombo(purchaseOrderComboBox);
|
||||
PrepareTesterCombo(testerComboBox);
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Print_watermeter_results;
|
||||
purchaseOrderGroupBox.Text = Strings.Purchase_order;
|
||||
testerGroupBox.Text = Strings.Tester;
|
||||
onlyGoodCheckBox.Text = Strings.Print_only_good_results;
|
||||
onlyLastCheckBox.Text = Strings.Print_only_the_last_measurement;
|
||||
printButton.Text = Strings.PrintBtnText;
|
||||
cancelButton.Text = Strings.CancelBtnText;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load Purchase order combo box items from the LocalSettings PurchaseOrderHistory array
|
||||
/// </summary>
|
||||
/// <param name="orderComboBox">Puchase order ComboBox</param>
|
||||
void PrepareOrderCombo(ComboBox orderComboBox)
|
||||
{
|
||||
for (int i = 0; i < Program.LocalSettings.PurchaseOrderHistoryCount; i++)
|
||||
{
|
||||
orderComboBox.Items.Add(Program.LocalSettings.PurchaseOrderHistory[i]);
|
||||
}
|
||||
if (orderComboBox.Items.Count > 0)
|
||||
{
|
||||
orderComboBox.Text = orderComboBox.Items[0].ToString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load Purchase order combo box items from the LocalSettings PurchaseOrderHistory array
|
||||
/// </summary>
|
||||
/// <param name="orderComboBox">Puchase order ComboBox</param>
|
||||
void PrepareTesterCombo(ComboBox testerComboBox)
|
||||
{
|
||||
for (int i = 0; i < Program.LocalSettings.TesterHistoryCount; i++)
|
||||
{
|
||||
testerComboBox.Items.Add(Program.LocalSettings.TesterHistory[i]);
|
||||
}
|
||||
if (testerComboBox.Items.Count > 0)
|
||||
{
|
||||
testerComboBox.Text = testerComboBox.Items[0].ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void printButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
PurchaseOrder = purchaseOrderComboBox.Text;
|
||||
Tester = testerComboBox.Text;
|
||||
|
||||
Program.LocalSettings.PrintOrderOnlyGoodResult = OnlyGoodResults = onlyGoodCheckBox.Checked;
|
||||
Program.LocalSettings.PrintOrderOnlyLastResult = OnlyLastResult = onlyLastCheckBox.Checked;
|
||||
|
||||
Program.LocalSettings.PrintOrderLeft = Location.X;
|
||||
Program.LocalSettings.PrintOrderTop = Location.Y;
|
||||
bool b1 = Program.LocalSettings.UpdateHistory(testerComboBox.Text,
|
||||
ref Program.LocalSettings.TesterHistory);
|
||||
bool b2 = Program.LocalSettings.UpdateHistory(purchaseOrderComboBox.Text,
|
||||
ref Program.LocalSettings.PurchaseOrderHistory
|
||||
#if FUZHOU150 || FUZHOU300
|
||||
, 20
|
||||
#endif
|
||||
);
|
||||
if (!b1 && !b2)
|
||||
{
|
||||
Program.LocalSettings.Save();
|
||||
}
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void cancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
PurchaseOrder = string.Empty;
|
||||
Tester = string.Empty;
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user