Correct handling of up/down selection moves in TransitionStepsCtrl and VirtualBenchSteps

Exception not used during updates (when duration is invalid)
Minor resource change
This commit is contained in:
Milan Hanajik 2015-02-07 21:42:32 +01:00
parent 558cfb8c6e
commit 1f590a71f5
7 changed files with 54 additions and 35 deletions

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1026
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -1348,7 +1348,7 @@ namespace TBF.Resources {
}
/// <summary>
/// Looks up a localized string similar to Please select a cycle, a_test or empty.
/// Looks up a localized string similar to Please select a cycle, a test or empty.
/// </summary>
internal static string Please_select_a_cycle_a_test_or_empty {
get {
@ -2220,6 +2220,9 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap testFailedImage {
get {
object obj = ResourceManager.GetObject("testFailedImage", resourceCulture);
@ -2236,6 +2239,9 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap testNotDoneImage {
get {
object obj = ResourceManager.GetObject("testNotDoneImage", resourceCulture);
@ -2243,6 +2249,9 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap testPassedImage {
get {
object obj = ResourceManager.GetObject("testPassedImage", resourceCulture);

View File

@ -662,7 +662,7 @@
<value> </value>
</data>
<data name="Please_select_a_cycle_a_test_or_empty" xml:space="preserve">
<value>Please select a cycle, a_test or empty</value>
<value>Please select a cycle, a test or empty</value>
</data>
<data name="Approval_info" xml:space="preserve">
<value>Approval info.</value>

View File

@ -1250,6 +1250,7 @@
<EmbeddedResource Include="Resources\Strings.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Screens\ProcessTabPageCtrl.resx">
<DependentUpon>ProcessTabPageCtrl.cs</DependentUpon>

View File

@ -149,6 +149,8 @@ namespace TBF
nwTab.Controls.Add(newCtrl);
this.tabControl.TabPages.Add(nwTab);
newCtrl.Initialize(sequence, this, this.tabControl.TabPages[this.tabControl.TabPages.Count - 1]);
newCtrl.SelectedIndexChanged += new System.EventHandler(this.SelectedIndexChanged);
}
void AddVirtualBenchSeqTab(VirtualBenchSequence sequence)
@ -159,7 +161,8 @@ namespace TBF
nwTab.Controls.Add(newCtrl);
this.tabControl.TabPages.Add(nwTab);
newCtrl.Initialize(sequence, this, this.tabControl.TabPages[this.tabControl.TabPages.Count - 1]);
}
newCtrl.SelectedIndexChanged += new System.EventHandler(this.SelectedIndexChanged);
}
void RefreshAllTabs()
{

View File

@ -66,10 +66,7 @@ namespace TBF.UiControls
protected void RedrawAll()
{
Items.Clear();
foreach (var myItem in MyItems)
{
DrawOne(myItem);
}
foreach (var myItem in MyItems) DrawOne(myItem);
}
public virtual void DrawOne(object myItem)
@ -152,10 +149,8 @@ namespace TBF.UiControls
public void MoveUpSelected()
{
if (SelectedItems.Count != 1)
{
return;
}
if (SelectedItems.Count != 1) return;
int ix = base.SelectedIndices[0];
if (ix <= FixedRowsCount || ix >= MyItems.Count) return;
@ -177,10 +172,8 @@ namespace TBF.UiControls
public void MoveDownSelected()
{
if (base.SelectedItems.Count != 1)
{
return;
}
if (base.SelectedItems.Count != 1) return;
int ix = base.SelectedIndices[0];
if (ix < FixedRowsCount || ix >= MyItems.Count - 1) return;

View File

@ -91,20 +91,32 @@ namespace TBF.UiControls
editors[1] = new TextBox();
parent.Controls.Add(editors[1]);
/// FM controlled pumps
for (int i = fixedCount; i < fixedCount + fmPumpCount; i++)
{
ComboBox cb = new ComboBox();
cb.Items.Add("---");
cb.Items.Add(Strings.dflt);
cb.Items.Add("0");
cb.Items.Add("25");
cb.Items.Add("50");
cb.Items.Add("75");
cb.Items.Add("100");
editors[i] = cb;
cb.Items.Add("0");
cb.Items.Add("30");
cb.Items.Add("40");
cb.Items.Add("50");
cb.Items.Add("60");
cb.Items.Add("70");
cb.Items.Add("75");
cb.Items.Add("80");
cb.Items.Add("85");
cb.Items.Add("90");
cb.Items.Add("92");
cb.Items.Add("94");
cb.Items.Add("96");
cb.Items.Add("98");
cb.Items.Add("100");
editors[i] = cb;
parent.Controls.Add(editors[i]);
}
/// Regulation valves
for (int i = fixedCount + fmPumpCount; i < fixedCount + fmPumpCount + regvCount; i++)
{
ComboBox cb = new ComboBox();
@ -114,10 +126,11 @@ namespace TBF.UiControls
cb.Items.Add("50");
cb.Items.Add("75");
cb.Items.Add("100");
editors[i] = cb;
editors[i] = cb;
parent.Controls.Add(editors[i]);
}
/// Valves
for (int i = fixedCount + fmPumpCount + regvCount; i < fixedCount + fmPumpCount + regvCount + vCount; i++)
{
ComboBox cb = new ComboBox();
@ -252,12 +265,12 @@ namespace TBF.UiControls
Entities.TransitionStep step = (Entities.TransitionStep)myItem;
/// Duration
try
int duration;
if (int.TryParse(lvi.Text, out duration) && duration > 0)
{
step.Duration = int.Parse(lvi.Text);
if (step.Duration < 2) throw (new System.Exception());
step.Duration = duration;
}
catch
else
{
lvi.Text = step.Duration.ToString();
}

View File

@ -189,16 +189,16 @@ namespace TBF.UiControls
{
Entities.VirtualBenchStep step = (Entities.VirtualBenchStep)myItem;
/// Duration
try
/// Duration
int duration;
if (int.TryParse(lvi.Text, out duration) && duration > 0)
{
step.Duration = int.Parse(lvi.Text);
if (step.Duration < 2) throw (new System.Exception());
step.Duration = duration;
}
else
{
lvi.Text = step.Duration.ToString();
}
catch
{
lvi.Text = step.Duration.ToString();
}
// TODO: Replace the following:
//step.PumpWithFMPcts = fmPumpsPcts;