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-08 00:09:02 +01:00
parent 558cfb8c6e
commit 1f590a71f5
7 changed files with 54 additions and 35 deletions
+11 -2
View File
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // 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 // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@@ -1348,7 +1348,7 @@ namespace TBF.Resources {
} }
/// <summary> /// <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> /// </summary>
internal static string Please_select_a_cycle_a_test_or_empty { internal static string Please_select_a_cycle_a_test_or_empty {
get { 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 { internal static System.Drawing.Bitmap testFailedImage {
get { get {
object obj = ResourceManager.GetObject("testFailedImage", resourceCulture); 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 { internal static System.Drawing.Bitmap testNotDoneImage {
get { get {
object obj = ResourceManager.GetObject("testNotDoneImage", resourceCulture); 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 { internal static System.Drawing.Bitmap testPassedImage {
get { get {
object obj = ResourceManager.GetObject("testPassedImage", resourceCulture); object obj = ResourceManager.GetObject("testPassedImage", resourceCulture);
+1 -1
View File
@@ -662,7 +662,7 @@
<value> </value> <value> </value>
</data> </data>
<data name="Please_select_a_cycle_a_test_or_empty" xml:space="preserve"> <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>
<data name="Approval_info" xml:space="preserve"> <data name="Approval_info" xml:space="preserve">
<value>Approval info.</value> <value>Approval info.</value>
+1
View File
@@ -1250,6 +1250,7 @@
<EmbeddedResource Include="Resources\Strings.resx"> <EmbeddedResource Include="Resources\Strings.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput> <LastGenOutput>Strings.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Screens\ProcessTabPageCtrl.resx"> <EmbeddedResource Include="Screens\ProcessTabPageCtrl.resx">
<DependentUpon>ProcessTabPageCtrl.cs</DependentUpon> <DependentUpon>ProcessTabPageCtrl.cs</DependentUpon>
+3
View File
@@ -149,6 +149,8 @@ namespace TBF
nwTab.Controls.Add(newCtrl); nwTab.Controls.Add(newCtrl);
this.tabControl.TabPages.Add(nwTab); this.tabControl.TabPages.Add(nwTab);
newCtrl.Initialize(sequence, this, this.tabControl.TabPages[this.tabControl.TabPages.Count - 1]); newCtrl.Initialize(sequence, this, this.tabControl.TabPages[this.tabControl.TabPages.Count - 1]);
newCtrl.SelectedIndexChanged += new System.EventHandler(this.SelectedIndexChanged);
} }
void AddVirtualBenchSeqTab(VirtualBenchSequence sequence) void AddVirtualBenchSeqTab(VirtualBenchSequence sequence)
@@ -159,6 +161,7 @@ namespace TBF
nwTab.Controls.Add(newCtrl); nwTab.Controls.Add(newCtrl);
this.tabControl.TabPages.Add(nwTab); this.tabControl.TabPages.Add(nwTab);
newCtrl.Initialize(sequence, this, this.tabControl.TabPages[this.tabControl.TabPages.Count - 1]); newCtrl.Initialize(sequence, this, this.tabControl.TabPages[this.tabControl.TabPages.Count - 1]);
newCtrl.SelectedIndexChanged += new System.EventHandler(this.SelectedIndexChanged);
} }
void RefreshAllTabs() void RefreshAllTabs()
@@ -66,10 +66,7 @@ namespace TBF.UiControls
protected void RedrawAll() protected void RedrawAll()
{ {
Items.Clear(); Items.Clear();
foreach (var myItem in MyItems) foreach (var myItem in MyItems) DrawOne(myItem);
{
DrawOne(myItem);
}
} }
public virtual void DrawOne(object myItem) public virtual void DrawOne(object myItem)
@@ -152,10 +149,8 @@ namespace TBF.UiControls
public void MoveUpSelected() public void MoveUpSelected()
{ {
if (SelectedItems.Count != 1) if (SelectedItems.Count != 1) return;
{
return;
}
int ix = base.SelectedIndices[0]; int ix = base.SelectedIndices[0];
if (ix <= FixedRowsCount || ix >= MyItems.Count) return; if (ix <= FixedRowsCount || ix >= MyItems.Count) return;
@@ -177,10 +172,8 @@ namespace TBF.UiControls
public void MoveDownSelected() public void MoveDownSelected()
{ {
if (base.SelectedItems.Count != 1) if (base.SelectedItems.Count != 1) return;
{
return;
}
int ix = base.SelectedIndices[0]; int ix = base.SelectedIndices[0];
if (ix < FixedRowsCount || ix >= MyItems.Count - 1) return; if (ix < FixedRowsCount || ix >= MyItems.Count - 1) return;
@@ -91,20 +91,32 @@ namespace TBF.UiControls
editors[1] = new TextBox(); editors[1] = new TextBox();
parent.Controls.Add(editors[1]); parent.Controls.Add(editors[1]);
/// FM controlled pumps
for (int i = fixedCount; i < fixedCount + fmPumpCount; i++) for (int i = fixedCount; i < fixedCount + fmPumpCount; i++)
{ {
ComboBox cb = new ComboBox(); ComboBox cb = new ComboBox();
cb.Items.Add("---"); cb.Items.Add("---");
cb.Items.Add(Strings.dflt); cb.Items.Add(Strings.dflt);
cb.Items.Add("0"); cb.Items.Add("0");
cb.Items.Add("25"); cb.Items.Add("30");
cb.Items.Add("40");
cb.Items.Add("50"); cb.Items.Add("50");
cb.Items.Add("60");
cb.Items.Add("70");
cb.Items.Add("75"); 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"); cb.Items.Add("100");
editors[i] = cb; editors[i] = cb;
parent.Controls.Add(editors[i]); parent.Controls.Add(editors[i]);
} }
/// Regulation valves
for (int i = fixedCount + fmPumpCount; i < fixedCount + fmPumpCount + regvCount; i++) for (int i = fixedCount + fmPumpCount; i < fixedCount + fmPumpCount + regvCount; i++)
{ {
ComboBox cb = new ComboBox(); ComboBox cb = new ComboBox();
@@ -118,6 +130,7 @@ namespace TBF.UiControls
parent.Controls.Add(editors[i]); parent.Controls.Add(editors[i]);
} }
/// Valves
for (int i = fixedCount + fmPumpCount + regvCount; i < fixedCount + fmPumpCount + regvCount + vCount; i++) for (int i = fixedCount + fmPumpCount + regvCount; i < fixedCount + fmPumpCount + regvCount + vCount; i++)
{ {
ComboBox cb = new ComboBox(); ComboBox cb = new ComboBox();
@@ -252,12 +265,12 @@ namespace TBF.UiControls
Entities.TransitionStep step = (Entities.TransitionStep)myItem; Entities.TransitionStep step = (Entities.TransitionStep)myItem;
/// Duration /// Duration
try int duration;
if (int.TryParse(lvi.Text, out duration) && duration > 0)
{ {
step.Duration = int.Parse(lvi.Text); step.Duration = duration;
if (step.Duration < 2) throw (new System.Exception());
} }
catch else
{ {
lvi.Text = step.Duration.ToString(); lvi.Text = step.Duration.ToString();
} }
@@ -190,12 +190,12 @@ namespace TBF.UiControls
Entities.VirtualBenchStep step = (Entities.VirtualBenchStep)myItem; Entities.VirtualBenchStep step = (Entities.VirtualBenchStep)myItem;
/// Duration /// Duration
try int duration;
if (int.TryParse(lvi.Text, out duration) && duration > 0)
{ {
step.Duration = int.Parse(lvi.Text); step.Duration = duration;
if (step.Duration < 2) throw (new System.Exception());
} }
catch else
{ {
lvi.Text = step.Duration.ToString(); lvi.Text = step.Duration.ToString();
} }