tbf/TestBenchFramework/TestWizard/HeatMetersSelection.cs
2016-08-04 16:47:21 +02:00

93 lines
1.8 KiB
C#

using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.Resources;
namespace TBF.TestWizard
{
public partial class HeatMetersSelection : Form
{
Test test;
public HeatMetersSelection()
{
InitializeComponent();
}
public HeatMetersSelection(bool first, bool last, Test test)
: this()
{
this.test = test;
Text = Strings.Heat_meter_options;
backButton.Text = Strings.BackBtnText;
nextButton.Text = Strings.NextBtnText;
cancelButton.Text = Strings.CancelBtnText;
if (first) backButton.Visible = false;
if (last) nextButton.Text = Strings.FinishBtnText;
}
private void HeatMetersSelection_Load(object sender, EventArgs e)
{
if (test == null) return;
RefreshWizardPage();
}
void RefreshWizardPage()
{
/// someTextBox.Text = test.SomeParam.ToString();
nextButton.Enabled = IsFormValid();
}
void UpdateTest()
{
/// TODO: complete
//test.Qfrom = Utils.ParseUFloat(pressureLoTextBox.Text);
//test.Qto = Utils.ParseUFloat(pressureHiTextBox.Text);
//test.TstTime = int.Parse(durationTextBox.Text);
}
bool IsFormValid()
{
/// int dummy;
/// return int.TryParse(someTextBox.Text, out dummy);
return true;
}
private void backButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Retry;
Close();
}
private void nextButton_Click(object sender, EventArgs e)
{
if (test != null && IsFormValid())
{
UpdateTest();
DialogResult = DialogResult.OK;
Close();
}
else
{
DialogResult = DialogResult.None;
}
}
private void cancelButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
private void anyTextBox_TextChanged(object sender, EventArgs e)
{
nextButton.Enabled = IsFormValid();
}
}
}