From bc0de96ad9032ce9ad3edcfef8bc6d62ae2c3fa7 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Thu, 13 Jul 2023 13:00:24 +0200 Subject: [PATCH] Compound profiles support in progress --- Common/Enums.cs | 3 + TBF/Rig/StateMachine.cs | 7 +- .../CombinedWithDetTestParams.cs | 2 +- .../TestMethodFactory.cs | 4 +- TBF/UI/Bench/TestProfiles/TestProfileDlg.cs | 1100 +++++++++++------ .../TestProfiles/TestProfileDlg.designer.cs | 113 +- TBF/UI/Bench/TestProfiles/TestProfileDlg.resx | 250 +++- .../TestWizard/TestProfileSelection.cs | 27 +- .../TestProfileSelection.designer.cs | 50 +- 9 files changed, 1094 insertions(+), 462 deletions(-) diff --git a/Common/Enums.cs b/Common/Enums.cs index 5b79b9a7b..bfa8828ef 100644 --- a/Common/Enums.cs +++ b/Common/Enums.cs @@ -199,6 +199,9 @@ namespace Common QnClassColdWater, QnClassHotWater, QpQi, + Q3RCompound, + QnClassCompound, + QpQiCompound, Manual, Count, } diff --git a/TBF/Rig/StateMachine.cs b/TBF/Rig/StateMachine.cs index b6c5c8c09..7b8bccdcc 100644 --- a/TBF/Rig/StateMachine.cs +++ b/TBF/Rig/StateMachine.cs @@ -55,6 +55,7 @@ namespace TBF.Rig /// Public components public static ControlBoard.IControlBoard ControlBoard; + public static TestMethods.CombinedWithDetection.TestMethod QriseQfallDetection; public static GenericDevices.IAmbient Ambient; public static IOperation BenchWaitingOp; public static IOperation BenchErrorOp; @@ -227,10 +228,14 @@ namespace TBF.Rig UInt128 valvesToInvert = 0; foreach (var cmpnt in components) { - if (cmpnt is TBF.Rig.ControlBoard.IControlBoard) ControlBoard = cmpnt as TBF.Rig.ControlBoard.IControlBoard; + if (cmpnt is ControlBoard.IControlBoard) ControlBoard = cmpnt as ControlBoard.IControlBoard; if (cmpnt is IBenchInfo) ProcessData.BenchInfo = cmpnt as IBenchInfo; if (cmpnt is IErrorFlags) ProcessData.ErrorFlagsComp = cmpnt as IErrorFlags; if (cmpnt is IStatisticsMonitoring) ProcessData.StatisticsMonitoringComp = cmpnt as IStatisticsMonitoring; + if (cmpnt is TestMethods.CombinedWithDetection.TestMethod && QriseQfallDetection == null) + { + QriseQfallDetection = cmpnt as TestMethods.CombinedWithDetection.TestMethod; + } if (cmpnt is SchematicDrawing.IDrawingItCmpntWithMeasuredVal) { diff --git a/TBF/Rig/TestMethods/CombinedWithDetection/CombinedWithDetTestParams.cs b/TBF/Rig/TestMethods/CombinedWithDetection/CombinedWithDetTestParams.cs index 2ef13d2af..e93129ff8 100644 --- a/TBF/Rig/TestMethods/CombinedWithDetection/CombinedWithDetTestParams.cs +++ b/TBF/Rig/TestMethods/CombinedWithDetection/CombinedWithDetTestParams.cs @@ -18,7 +18,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection public override XmlSerializer GetSerializer() { return Serializer; } public double TargetQ; /// Target=terminal flow durning detection when increasing or decreasing the flow - public double RelativeQfrom; /// Tested flow low range related to the detected flow + public double RelativeQfrom; /// Tested flow low range related to the detected flow public double RelativeQto; /// Tested flow high range related to the detected flow public float RateOfChange; /// Each step is calculated as (TargetQfrom - Qfrom) * RateOfChange, text form is displayed in % (*100) public float DetectionThreshold; /// Drop of frequency for the detection, text form is displayed in % (*100) diff --git a/TBF/Rig/TestMethods/CombinedWithDetection/TestMethodFactory.cs b/TBF/Rig/TestMethods/CombinedWithDetection/TestMethodFactory.cs index 91e83ea69..cd3e2b42d 100644 --- a/TBF/Rig/TestMethods/CombinedWithDetection/TestMethodFactory.cs +++ b/TBF/Rig/TestMethods/CombinedWithDetection/TestMethodFactory.cs @@ -8,14 +8,14 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection { public class TestMethodFactory : IComponentFactory { - public string ClassName { get { return this.GetType().Namespace.Substring(8) + ".Compound"; } } + public string ClassName { get { return GetType().Namespace.Substring(8) + ".Compound"; } } public override string ToString() { return ClassName; } public IComponent DummyComponent() { return new TestMethod(); } public IComponent GetComponent(IComponentCfg cfg, IList components) { return new TestMethod(cfg); } - public IComponentCfg DefaultConfig() { return new TestMethodCfg(this.GetType().Namespace.Substring(20), this); } + public IComponentCfg DefaultConfig() { return new TestMethodCfg(GetType().Namespace.Substring(20), this); } public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component) { diff --git a/TBF/UI/Bench/TestProfiles/TestProfileDlg.cs b/TBF/UI/Bench/TestProfiles/TestProfileDlg.cs index ef31efd13..7511179ce 100644 --- a/TBF/UI/Bench/TestProfiles/TestProfileDlg.cs +++ b/TBF/UI/Bench/TestProfiles/TestProfileDlg.cs @@ -19,46 +19,46 @@ using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead; namespace TBF.UI.Bench.TestProfiles { - public partial class TestProfileDlg : Form, IParentOfListViewEx - { - static readonly ILog log = LogManager.GetLogger(typeof(TestProfileDlg)); + public partial class TestProfileDlg : Form, IParentOfListViewEx + { + static readonly ILog log = LogManager.GetLogger(typeof(TestProfileDlg)); - /// Used when re-scaling the dialog: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi - public readonly int Dpi; + /// Used when re-scaling the dialog: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi + public readonly int Dpi; readonly bool openUnlocked; - /// - /// Profile to be updated by this dialog. - /// Set by the constructor or updated by the parent after creation and before loading. - /// - public Profile LoadedProfile; + /// + /// Profile to be updated by this dialog. + /// Set by the constructor or updated by the parent after creation and before loading. + /// + public Profile LoadedProfile; public int SelectedTestIx; /// -1 = none, 0 = 1st = top - IList usedNames; /// Already used names + IList usedNames; /// Already used names - /// Auxiliary public lists used also by user controls in tab pages - public IList TbfComponents; + /// Auxiliary public lists used also by user controls in tab pages + public IList TbfComponents; public IList TestMethods; - bool unlocked; + bool unlocked; - TestProfileDlg() - { + TestProfileDlg() + { InitializeComponent(); /// Detect display setting: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi. Dpi = (int)this.CreateGraphics().DpiX; openUnlocked = false; - } + } - public TestProfileDlg(Profile profile, IList usedNames, bool openUnlocked, Form parentForm) - : this() - { - if (profile == null) throw new ArgumentNullException("profile"); + public TestProfileDlg(Profile profile, IList usedNames, bool openUnlocked, Form parentForm) + : this() + { + if (profile == null) throw new ArgumentNullException("profile"); LoadedProfile = profile; - this.usedNames = usedNames; + this.usedNames = usedNames; this.openUnlocked = openUnlocked; TestMethods = new List(); @@ -93,6 +93,11 @@ namespace TBF.UI.Bench.TestProfiles metrologyListViewEx.SubItemRightClicked += new SubItemEventHandler(metrologyListViewEx_SubItemRightClicked); metrologyListViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(metrologyListViewEx_SubItemEndEditing); + /// ListViewEx-es configuration + compoundListViewEx.SubItemClicked += new SubItemEventHandler(compoundListViewEx_SubItemClicked); + compoundListViewEx.SubItemRightClicked += new SubItemEventHandler(compoundListViewEx_SubItemRightClicked); + compoundListViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(compoundListViewEx_SubItemEndEditing); + errorFlagsListViewEx.SubItemClicked += new SubItemEventHandler(errorFlagsListViewEx_SubItemClicked); errorFlagsListViewEx.SubItemRightClicked += new SubItemEventHandler(errorFlagsListViewEx_SubItemRightClicked); errorFlagsListViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(errorFlagsListViewEx_SubItemEndEditing); @@ -104,11 +109,11 @@ namespace TBF.UI.Bench.TestProfiles SelectedTestIx = -1; } - private void TestProfileDlg_Load(object sender, EventArgs e) + private void TestProfileDlg_Load(object sender, EventArgs e) { - Localize(); + Localize(); - if (LoadedProfile == null) return; /// return in case the dialog is open in the designer + if (LoadedProfile == null) return; /// return in case the dialog is open in the designer LoadUISettings(); @@ -126,18 +131,26 @@ namespace TBF.UI.Bench.TestProfiles profileTypeRadioButton3.Enabled = false; profileTypeRadioButton4.Enabled = false; profileTypeRadioButton5.Enabled = false; + profileTypeRadioButton6.Enabled = false; + profileTypeRadioButton7.Enabled = false; + profileTypeRadioButton8.Enabled = false; errorCalculationRadioButton1.Enabled = false; errorCalculationRadioButton2.Enabled = false; - /// LisViewEx columns and edit controls for 'Metrology1', 'Metrology2', 'Process' and 'Parameters' tabs + /// Now refresh the content of the general tab + RefreshGeneralTab(); + CompoundRBCheckedChanged(); + + /// LisViewEx columns and edit controls for 'Metrology', 'Compound', 'Error flags' and 'Error flags 2' tabs PrepareMetrologyTab(); + PrepareCompoundTab(); PrepareErrorFlags(); PrepareErrorFlags2(); /// Now refresh the content of the dialog - RefreshGeneralTab(); RefreshMetrologyTab(); + RefreshCompoundTab(); RefreshErrorFlagsTab(); RefreshErrorFlags2Tab(); @@ -149,15 +162,15 @@ namespace TBF.UI.Bench.TestProfiles } } - void Localize() - { + void Localize() + { Text = Strings.Profile; generalTabPage.Text = Strings.General; metrologyTabPage.Text = Strings.Metrology; errorFlagsTabPage.Text = "Error flags"; errorFlags2TabPage.Text = "Error flags details"; - + label1.Text = Strings.Procedure_name; label12.Text = Strings.Short_description; label13.Text = Strings.Created_by; @@ -166,88 +179,94 @@ namespace TBF.UI.Bench.TestProfiles label15.Text = Strings.Date; } - #region General + #region General - void RefreshGeneralTab() - { - procNameTextBox.Text = LoadedProfile.Name; - Text = string.Format("{0} {1} {2}", Strings.Profile, LoadedProfile.ItemNr + 1, LoadedProfile.Name); + void RefreshGeneralTab() + { + procNameTextBox.Text = LoadedProfile.Name; + Text = string.Format("{0} {1} {2}", Strings.Profile, LoadedProfile.ItemNr + 1, LoadedProfile.Name); - descriptionTextBox.Text = LoadedProfile.Description; - createdByTextBox.Text = LoadedProfile.CreationUser; - createdOnTextBox.Text = LoadedProfile.CreationTime.ToString(); - lastChangedByTextBox.Text = LoadedProfile.LastChgUser; + descriptionTextBox.Text = LoadedProfile.Description; + createdByTextBox.Text = LoadedProfile.CreationUser; + createdOnTextBox.Text = LoadedProfile.CreationTime.ToString(); + lastChangedByTextBox.Text = LoadedProfile.LastChgUser; if (LoadedProfile.LastChgTime > LoadedProfile.CreationTime) { lastChangedOnTextBox.Text = LoadedProfile.LastChgTime.ToString(); } - switch(LoadedProfile.ProfileType) + switch (LoadedProfile.ProfileType) { default: - case ProfileType.Q3R: profileTypeRadioButton1.Checked = true; break; - case ProfileType.QnClassColdWater: profileTypeRadioButton2.Checked = true; break; - case ProfileType.QnClassHotWater: profileTypeRadioButton3.Checked = true; break; - case ProfileType.QpQi: profileTypeRadioButton4.Checked = true; break; - case ProfileType.Manual: profileTypeRadioButton5.Checked = true; break; + case ProfileType.Q3R: profileTypeRadioButton1.Checked = true; break; + case ProfileType.QnClassColdWater: profileTypeRadioButton2.Checked = true; break; + case ProfileType.QnClassHotWater: profileTypeRadioButton3.Checked = true; break; + case ProfileType.QpQi: profileTypeRadioButton4.Checked = true; break; + case ProfileType.Q3RCompound: profileTypeRadioButton5.Checked = true; break; + case ProfileType.QnClassCompound: profileTypeRadioButton6.Checked = true; break; + case ProfileType.QpQiCompound: profileTypeRadioButton7.Checked = true; break; + case ProfileType.Manual: profileTypeRadioButton8.Checked = true; break; } - switch(LoadedProfile.ErrorLimitType) + switch (LoadedProfile.ErrorLimitType) { default: - case ErrorLimitType.Manual: errorCalculationRadioButton1.Checked = true; break; - case ErrorLimitType.QpClass: errorCalculationRadioButton2.Checked = true; break; + case ErrorLimitType.Manual: errorCalculationRadioButton1.Checked = true; break; + case ErrorLimitType.QpClass: errorCalculationRadioButton2.Checked = true; break; } - } + } - void UpdateFromGeneralTab() - { - LoadedProfile.Name = procNameTextBox.Text; + void UpdateFromGeneralTab() + { + LoadedProfile.Name = procNameTextBox.Text; Text = string.Format("{0} {1} {2}", Strings.Profile, LoadedProfile.ItemNr + 1, LoadedProfile.Name); - LoadedProfile.Description = descriptionTextBox.Text; + LoadedProfile.Description = descriptionTextBox.Text; - LoadedProfile.ProfileType = profileTypeRadioButton1.Checked ? ProfileType.Q3R : + LoadedProfile.ProfileType = profileTypeRadioButton1.Checked ? ProfileType.Q3R : (profileTypeRadioButton2.Checked ? ProfileType.QnClassColdWater : (profileTypeRadioButton3.Checked ? ProfileType.QnClassHotWater : - (profileTypeRadioButton4.Checked ? ProfileType.QpQi - : ProfileType.Manual))); + (profileTypeRadioButton4.Checked ? ProfileType.QpQi : + (profileTypeRadioButton5.Checked ? ProfileType.Q3RCompound : + (profileTypeRadioButton6.Checked ? ProfileType.QnClassCompound : + (profileTypeRadioButton7.Checked ? ProfileType.QpQiCompound + : ProfileType.Manual)))))); LoadedProfile.ErrorLimitType = errorCalculationRadioButton1.Checked ? ErrorLimitType.Manual : ErrorLimitType.QpClass; } - #endregion + #endregion #region Metrology Control[] metrologyEditors; - public enum MtrlgyClmn - { - Name, + public enum MtrlgyClmn + { + Name, Part, CoefQfrom, - CoefQto, - ErrLimLo, - ErrLimHi, + CoefQto, + ErrLimLo, + ErrLimHi, TempLimLo, TempLimHi, PressLimLo, - PressLimHi, + PressLimHi, Publish, Evaluate, Method, ColumnsCount - } + } - void PrepareMetrologyTab() - { + void PrepareMetrologyTab() + { ListViewEx lv = metrologyListViewEx; - lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 }); + lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 }); lv.Columns.Add(new ColumnHeader { Text = Strings.Part, Width = 40 }); lv.Columns.Add(new ColumnHeader { Text = string.Format("Coef. {0}", Strings.Q_from), Width = 80 }); - lv.Columns.Add(new ColumnHeader { Text = string.Format("Coef. {0}", Strings.Q_to), Width = 80 }); + lv.Columns.Add(new ColumnHeader { Text = string.Format("Coef. {0}", Strings.Q_to), Width = 80 }); lv.Columns.Add(new ColumnHeader { Text = Strings.Err_limit_neg_pct_chdr, Width = 80 }); lv.Columns.Add(new ColumnHeader { Text = Strings.Err_limit_pos_pct_chdr, Width = 80 }); lv.Columns.Add(new ColumnHeader { Text = string.Format("{0} [°C]", Strings.Temp_lim_lo_chdr), Width = 100 }); @@ -271,9 +290,9 @@ namespace TBF.UI.Bench.TestProfiles ComboBox methodCBox = new ComboBox(); foreach (var m in TestMethods) methodCBox.Items.Add(m.Name); - metrologyEditors = new Control[] - { - new TextBox(), /// Name + metrologyEditors = new Control[] + { + new TextBox(), /// Name new TextBox(), /// Part new TextBox(), /// CoefQfrom new TextBox(), /// CoefQto @@ -288,11 +307,11 @@ namespace TBF.UI.Bench.TestProfiles methodCBox, /// Test method }; - foreach (var ctrl in metrologyEditors) - { - metrologyTabPage.Controls.Add(ctrl); - } - } + foreach (var ctrl in metrologyEditors) + { + metrologyTabPage.Controls.Add(ctrl); + } + } void RefreshMetrologyTab() { @@ -359,7 +378,7 @@ namespace TBF.UI.Bench.TestProfiles } entity.CoefQfrom = Utils.ParseUDouble(lvi.SubItems[(int)MtrlgyClmn.CoefQfrom].Text); - entity.CoefQto = Utils.ParseUDouble(lvi.SubItems[(int)MtrlgyClmn.CoefQto].Text); + entity.CoefQto = Utils.ParseUDouble(lvi.SubItems[(int)MtrlgyClmn.CoefQto].Text); if (LoadedProfile.ProfileType != ProfileType.QpQi) { entity.ErrLimLo = Utils.ParseSDouble(lvi.SubItems[(int)MtrlgyClmn.ErrLimLo].Text); @@ -404,9 +423,9 @@ namespace TBF.UI.Bench.TestProfiles } if (unlocked && (e.SubItem < (int)MtrlgyClmn.ColumnsCount)) - { - metrologyListViewEx.StartEditing(metrologyEditors[e.SubItem], e.Item, e.SubItem); - } + { + metrologyListViewEx.StartEditing(metrologyEditors[e.SubItem], e.Item, e.SubItem); + } } void metrologyListViewEx_SubItemRightClicked(object sender, SubItemEventArgs e) @@ -460,7 +479,7 @@ namespace TBF.UI.Bench.TestProfiles } double dummy; - if ((e.SubItem == (int)MtrlgyClmn.CoefQfrom && !Utils.TryParseUDouble(e.DisplayText, out dummy)) || + if ((e.SubItem == (int)MtrlgyClmn.CoefQfrom && !Utils.TryParseUDouble(e.DisplayText, out dummy)) || (e.SubItem == (int)MtrlgyClmn.CoefQto && !Utils.TryParseUDouble(e.DisplayText, out dummy)) || (e.SubItem == (int)MtrlgyClmn.ErrLimLo && !Utils.TryParseSDouble(e.DisplayText, out dummy)) || (e.SubItem == (int)MtrlgyClmn.ErrLimHi && !Utils.TryParseSDouble(e.DisplayText, out dummy)) || @@ -489,11 +508,281 @@ namespace TBF.UI.Bench.TestProfiles #endregion + #region Compound + + Control[] compoundEditors; + + public enum CmpndClmn + { + Name, + Part, + CoefQfrom, + CoefQto, + ErrLimLo, + ErrLimHi, + TempLimLo, + TempLimHi, + PressLimLo, + PressLimHi, + Publish, + Evaluate, + Method, + ColumnsCount + } + + void PrepareCompoundTab() + { + ListViewEx lv = compoundListViewEx; + lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 }); + lv.Columns.Add(new ColumnHeader { Text = Strings.Part, Width = 40 }); + lv.Columns.Add(new ColumnHeader { Text = string.Format("Coef. {0}", Strings.Q_from), Width = 80 }); + lv.Columns.Add(new ColumnHeader { Text = string.Format("Coef. {0}", Strings.Q_to), Width = 80 }); + lv.Columns.Add(new ColumnHeader { Text = Strings.Err_limit_neg_pct_chdr, Width = 80 }); + lv.Columns.Add(new ColumnHeader { Text = Strings.Err_limit_pos_pct_chdr, Width = 80 }); + lv.Columns.Add(new ColumnHeader { Text = string.Format("{0} [°C]", Strings.Temp_lim_lo_chdr), Width = 100 }); + lv.Columns.Add(new ColumnHeader { Text = string.Format("{0} [°C]", Strings.Temp_lim_hi_chdr), Width = 100 }); + lv.Columns.Add(new ColumnHeader { Text = Strings.Press_lim_lo_chdr, Width = 80 }); + lv.Columns.Add(new ColumnHeader { Text = Strings.Press_lim_hi_chdr, Width = 80 }); + lv.Columns.Add(new ColumnHeader { Text = Strings.Publish, Width = 80 }); + lv.Columns.Add(new ColumnHeader { Text = Strings.Evaluate, Width = 80 }); + lv.Columns.Add(new ColumnHeader { Text = Strings.Method_chdr, Width = 200 }); + + ComboBox publishCBox = new ComboBox(); /// control for Publish + for (Publish pb = 0; pb < Publish.Count; pb++) + { + publishCBox.Items.Add(pb.ToDescription()); + } + + ComboBox yesNoCBox = new ComboBox(); /// control for Evaluate + yesNoCBox.Items.Add(Strings.yes); + yesNoCBox.Items.Add(Strings.no); + + ComboBox methodCBox = new ComboBox(); + foreach (var m in TestMethods) methodCBox.Items.Add(m.Name); + + compoundEditors = new Control[] + { + new TextBox(), /// Name + new TextBox(), /// Part + new TextBox(), /// CoefQfrom + new TextBox(), /// CoefQto + new TextBox(), /// Err.Lim. - + new TextBox(), /// Err.Lim. + + new TextBox(), /// Temp.Lim. - + new TextBox(), /// Temp.Lim. + + new TextBox(), /// Press.Lim. - + new TextBox(), /// Press.Lim. + + publishCBox, /// Publish + yesNoCBox, /// Evaluate + methodCBox, /// Test method + }; + + foreach (var ctrl in compoundEditors) + { + compoundTabPage.Controls.Add(ctrl); + } + } + + void RefreshCompoundTab() + { + compoundListViewEx.Items.Clear(); + foreach (var test in LoadedProfile.Tests) AddToCompoundTab(test); + + if (0 <= SelectedTestIx && SelectedTestIx < compoundListViewEx.Items.Count) + { + compoundListViewEx.Items[SelectedTestIx].Selected = true; + } + } + + void AddToCompoundTab(PTest pTest) + { + /// + /// Compound 1 item with subitems + /// + ListViewItem lvi = new ListViewItem(pTest.Name); + lvi.Tag = pTest; + lvi.SubItems.Add((pTest.Part == 0) ? "-" : pTest.Part.ToString()); + lvi.SubItems.Add(pTest.CoefQfrom.ToString()); + lvi.SubItems.Add(pTest.CoefQto.ToString()); + if (LoadedProfile.ProfileType != ProfileType.QpQi) + { + lvi.SubItems.Add(pTest.ErrLimLo.ToString()); + lvi.SubItems.Add(pTest.ErrLimHi.ToString()); + } + else + { + lvi.SubItems.Add(Strings.calculated); + lvi.SubItems.Add(Strings.calculated); + } + lvi.SubItems.Add(pTest.TempLimLo.ToString()); + lvi.SubItems.Add(pTest.TempLimHi.ToString()); + lvi.SubItems.Add(pTest.PressLimLo.ToString()); + lvi.SubItems.Add(pTest.PressLimHi.ToString()); + lvi.SubItems.Add(((Publish)pTest.Publish).ToDescription()); + lvi.SubItems.Add(pTest.Evaluate ? Strings.yes : Strings.no); + lvi.SubItems.Add((pTest.Method != null) ? pTest.Method : string.Empty); + + compoundListViewEx.Items.Add(lvi); + } + + void UpdateFromCompoundTab() + { + for (int i = 0; i < compoundListViewEx.Items.Count; i++) + { + try + { + ListViewItem lvi = compoundListViewEx.Items[i]; + PTest entity = (PTest)lvi.Tag; + + entity.Name = lvi.Text; + entity.ItemNr = i; + + int part = entity.Part; + if (lvi.SubItems[(int)CmpndClmn.Part].Text.Equals("-")) + { + entity.Part = 0; + } + else if (int.TryParse(lvi.SubItems[(int)CmpndClmn.Part].Text, out part)) + { + entity.Part = part; + } + + entity.CoefQfrom = Utils.ParseUDouble(lvi.SubItems[(int)CmpndClmn.CoefQfrom].Text); + entity.CoefQto = Utils.ParseUDouble(lvi.SubItems[(int)CmpndClmn.CoefQto].Text); + if (LoadedProfile.ProfileType != ProfileType.QpQi) + { + entity.ErrLimLo = Utils.ParseSDouble(lvi.SubItems[(int)CmpndClmn.ErrLimLo].Text); + entity.ErrLimHi = Utils.ParseSDouble(lvi.SubItems[(int)CmpndClmn.ErrLimHi].Text); + } + else + { + entity.ErrLimLo = +1.0; + entity.ErrLimHi = -1.0; + } + entity.TempLimLo = Utils.ParseUDouble(lvi.SubItems[(int)CmpndClmn.TempLimLo].Text); + entity.TempLimHi = Utils.ParseUDouble(lvi.SubItems[(int)CmpndClmn.TempLimHi].Text); + entity.PressLimLo = Utils.ParseUDouble(lvi.SubItems[(int)CmpndClmn.PressLimLo].Text); + entity.PressLimHi = Utils.ParseUDouble(lvi.SubItems[(int)CmpndClmn.PressLimHi].Text); + + entity.Evaluate = lvi.SubItems[(int)CmpndClmn.Evaluate].Text.Equals(Strings.yes); + + for (Publish pb = 0; pb < Publish.Count; pb++) + { + if (lvi.SubItems[(int)CmpndClmn.Publish].Text.Equals(pb.ToDescription())) + { + entity.Publish = (sbyte)pb; + break; + } + } + + entity.Method = lvi.SubItems[(int)CmpndClmn.Method].Text; + } + catch (Exception exc) + { + MessageBox.Show(string.Format("Unexpected problem: {0}", exc.Message)); + } + } + } + + private void compoundListViewEx_SubItemClicked(object sender, SubItemEventArgs e) + { + if (LoadedProfile.ProfileType == ProfileType.QpQi && + ((e.SubItem == (int)CmpndClmn.ErrLimLo) || (e.SubItem == (int)CmpndClmn.ErrLimHi))) + { + return; /// Prevent editing calculated error limits + } + + if (unlocked && (e.SubItem < (int)CmpndClmn.ColumnsCount)) + { + compoundListViewEx.StartEditing(compoundEditors[e.SubItem], e.Item, e.SubItem); + } + } + + void compoundListViewEx_SubItemRightClicked(object sender, SubItemEventArgs e) + { + if (!unlocked || e.SubItem >= (int)CmpndClmn.ColumnsCount) return; + + if (DialogResult.Yes == MessageBox.Show(Strings.Do_you_want_to_copy_this_value_to_all_cells_below_this_cell, + Strings.Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Question)) + { + int columnNr = e.SubItem; + string value = null; + System.Drawing.Color backColor = System.Drawing.Color.White; + foreach (ListViewItem item in compoundListViewEx.Items) + { + if (value != null && item.SubItems.Count > columnNr) + { + item.SubItems[columnNr].Text = value; + item.SubItems[columnNr].BackColor = backColor; + } + else if (item == e.Item) + { + value = item.SubItems[columnNr].Text; + backColor = item.SubItems[columnNr].BackColor; + } + } + } + } + + private void compoundListViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e) + { + if (e.SubItem == (int)CmpndClmn.Name) + { + if (!Utils.IsGoodFName(e.DisplayText)) + { + e.DisplayText = e.Item.SubItems[e.SubItem].Text; + e.Cancel = true; + return; /// NOK + } + } + + int idummy; + if (e.SubItem == (int)CmpndClmn.Part) + { + if (e.DisplayText.Equals("-")) return; /// OK + if (!int.TryParse(e.DisplayText, out idummy) || !Data.IsGoodPartNr(idummy)) + { + e.DisplayText = e.Item.SubItems[e.SubItem].Text; + e.Cancel = true; + return; /// NOK + } + } + + double dummy; + if ((e.SubItem == (int)CmpndClmn.CoefQfrom && !Utils.TryParseUDouble(e.DisplayText, out dummy)) || + (e.SubItem == (int)CmpndClmn.CoefQto && !Utils.TryParseUDouble(e.DisplayText, out dummy)) || + (e.SubItem == (int)CmpndClmn.ErrLimLo && !Utils.TryParseSDouble(e.DisplayText, out dummy)) || + (e.SubItem == (int)CmpndClmn.ErrLimHi && !Utils.TryParseSDouble(e.DisplayText, out dummy)) || + (e.SubItem == (int)CmpndClmn.TempLimLo && !Utils.TryParseUDouble(e.DisplayText, out dummy)) || + (e.SubItem == (int)CmpndClmn.TempLimHi && !Utils.TryParseUDouble(e.DisplayText, out dummy)) || + (e.SubItem == (int)CmpndClmn.PressLimLo && !Utils.TryParseUDouble(e.DisplayText, out dummy)) || + (e.SubItem == (int)CmpndClmn.PressLimHi && !Utils.TryParseUDouble(e.DisplayText, out dummy))) + { + /// Cannot parse => revert content of the cell + e.DisplayText = e.Item.SubItems[e.SubItem].Text; + e.Cancel = true; + return; + } + + /// Combo boxes + if ((e.SubItem == (int)CmpndClmn.Publish) || (e.SubItem == (int)CmpndClmn.Evaluate) || (e.SubItem == (int)CmpndClmn.Method)) + { + if (!(compoundEditors[e.SubItem] as ComboBox).Items.Contains(e.DisplayText)) + { + e.DisplayText = e.Item.SubItems[e.SubItem].Text; + e.Cancel = true; + return; + } + } + } + + #endregion + #region Error flags public enum ErrorFlagsClmn - { - Name, + { + Name, E1, E2, E3, @@ -511,18 +800,18 @@ namespace TBF.UI.Bench.TestProfiles E15, E16, E21, - ColumnsCount - } + ColumnsCount + } - Control[] errorFlagsEditors; + Control[] errorFlagsEditors; - void PrepareErrorFlags() - { + void PrepareErrorFlags() + { ListViewEx lv = errorFlagsListViewEx; errorFlagsEditors = new Control[(int)ErrorFlagsClmn.ColumnsCount]; int ix = 0; - lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 }); + lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 }); errorFlagsEditors[ix++] = new TextBox(); /// Name string[] ecka = new string[] { "E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8", "E9", "E10", "E11", "E12", "E13", "E14", "E15", "E16", "E21" }; @@ -536,9 +825,9 @@ namespace TBF.UI.Bench.TestProfiles for (ErrorFlagsMode efm = 0; efm < ErrorFlagsMode.Count; efm++) cb.Items.Add(efm.ToDescription()); errorFlagsEditors[ix++] = cb; } - + foreach (var ctrl in errorFlagsEditors) errorFlagsTabPage.Controls.Add(ctrl); - } + } void RefreshErrorFlagsTab() { @@ -573,17 +862,17 @@ namespace TBF.UI.Bench.TestProfiles lvi.SubItems.Add(SByte2String(pTest.E16)); lvi.SubItems.Add(SByte2String(pTest.E21)); - errorFlagsListViewEx.Items.Add(lvi); - } + errorFlagsListViewEx.Items.Add(lvi); + } - void UpdateFromErrorFlagsTab() - { - for (int i = 0; i < errorFlagsListViewEx.Items.Count; i++) - { - ListViewItem lvi = errorFlagsListViewEx.Items[i]; - PTest entity = (PTest)lvi.Tag; + void UpdateFromErrorFlagsTab() + { + for (int i = 0; i < errorFlagsListViewEx.Items.Count; i++) + { + ListViewItem lvi = errorFlagsListViewEx.Items[i]; + PTest entity = (PTest)lvi.Tag; - entity.Name = lvi.Text; + entity.Name = lvi.Text; entity.ItemNr = i; entity.E1 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E1].Text); @@ -603,8 +892,8 @@ namespace TBF.UI.Bench.TestProfiles entity.E15 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E15].Text); entity.E16 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E16].Text); entity.E21 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E21].Text); - } - } + } + } private void errorFlagsListViewEx_SubItemClicked(object sender, SubItemEventArgs e) { @@ -679,7 +968,7 @@ namespace TBF.UI.Bench.TestProfiles TestTime_min, TestTime_max, AmbTemp_min, - AmbTemp_max, + AmbTemp_max, Coef_E9, Coef_E10, Coef_E11, @@ -696,17 +985,17 @@ namespace TBF.UI.Bench.TestProfiles string[] paramNames = new string[] { Strings.Test_chdr, - "Delta Q [%]", - "Delta T [°C]", - "max. Abs(Tup - Tdn) [°C]", - string.Format("min. {0} [s]", Strings.Test_time), - string.Format("max. {0} [s]", Strings.Test_time), - string.Format("min. {0} [°C]", Strings.Air_temperature), - string.Format("max. {0} [°C]", Strings.Air_temperature), - "Coef.E9", - "Coef.E10", - "Coef.E11", - "Coef.E12", + "Delta Q [%]", + "Delta T [°C]", + "max. Abs(Tup - Tdn) [°C]", + string.Format("min. {0} [s]", Strings.Test_time), + string.Format("max. {0} [s]", Strings.Test_time), + string.Format("min. {0} [°C]", Strings.Air_temperature), + string.Format("max. {0} [°C]", Strings.Air_temperature), + "Coef.E9", + "Coef.E10", + "Coef.E11", + "Coef.E12", "Offset E9 [s]", "Offset E12 [s]", }; @@ -850,22 +1139,23 @@ namespace TBF.UI.Bench.TestProfiles #endregion - void RefreshMetrologyAndErrorFlagsTabs() - { + void RefreshMetrologyAndErrorFlagsTabs() + { RefreshMetrologyTab(); + RefreshCompoundTab(); RefreshErrorFlagsTab(); RefreshErrorFlags2Tab(); } - private void Unlocked(object sender, EventArgs e) - { - unlocked = true; + private void Unlocked(object sender, EventArgs e) + { + unlocked = true; //if (testParamsCtrls != null) foreach (var ctrl in testParamsCtrls) ctrl.Unlock(); //if (procedureParamsCtrls != null) foreach (var ctrl in procedureParamsCtrls) ctrl.Unlock(); - procNameTextBox.Enabled = true; - descriptionTextBox.Enabled = true; + procNameTextBox.Enabled = true; + descriptionTextBox.Enabled = true; profileTypeRadioButton1.Enabled = true; profileTypeRadioButton2.Enabled = true; @@ -874,62 +1164,67 @@ namespace TBF.UI.Bench.TestProfiles profileTypeRadioButton3.Enabled = true; profileTypeRadioButton4.Enabled = true; profileTypeRadioButton5.Enabled = true; + profileTypeRadioButton6.Enabled = true; + profileTypeRadioButton7.Enabled = true; + profileTypeRadioButton8.Enabled = true; errorCalculationRadioButton1.Enabled = true; errorCalculationRadioButton2.Enabled = true; ListViewEx listViewEx = null; - switch (selectedTab) - { - case TestProfileTabs.Metrology: listViewEx = metrologyListViewEx; break; - case TestProfileTabs.ErrorFlags: listViewEx = errorFlagsListViewEx; break; - case TestProfileTabs.ErrorFlags2: listViewEx = errorFlags2ListViewEx; break; + switch (selectedTab) + { + case TestProfileTabs.Metrology: listViewEx = metrologyListViewEx; break; + case TestProfileTabs.Compound: listViewEx = compoundListViewEx; break; + case TestProfileTabs.ErrorFlags: listViewEx = errorFlagsListViewEx; break; + case TestProfileTabs.ErrorFlags2: listViewEx = errorFlags2ListViewEx; break; } if ((listViewEx != null) && (listViewEx.SelectedItems.Count == 1)) - { - int ix = listViewEx.SelectedIndices[0]; - listViewEx.Focus(); - listViewEx.Items[ix].Selected = true; - listViewEx.Items[ix].EnsureVisible(); - } - } + { + int ix = listViewEx.SelectedIndices[0]; + listViewEx.Focus(); + listViewEx.Items[ix].Selected = true; + listViewEx.Items[ix].EnsureVisible(); + } + } - private void okButton_Click(object sender, EventArgs e) - { + private void okButton_Click(object sender, EventArgs e) + { switch (selectedTab) { - case TestProfileTabs.General: UpdateFromGeneralTab(); break; - case TestProfileTabs.Metrology: UpdateFromMetrologyTab(); break; - case TestProfileTabs.ErrorFlags: UpdateFromErrorFlagsTab(); break; - case TestProfileTabs.ErrorFlags2: UpdateFromErrorFlags2Tab(); break; + case TestProfileTabs.General: UpdateFromGeneralTab(); break; + case TestProfileTabs.Metrology: UpdateFromMetrologyTab(); break; + case TestProfileTabs.Compound: UpdateFromCompoundTab(); break; + case TestProfileTabs.ErrorFlags: UpdateFromErrorFlagsTab(); break; + case TestProfileTabs.ErrorFlags2: UpdateFromErrorFlags2Tab(); break; } //foreach (var ctrl in testParamsCtrls) if (!ctrl.UpdateAll()) MessageBox.Show(string.Format(Strings.Error_saving_parameters_of_0, ctrl.Name)); //foreach (var ctrl in procedureParamsCtrls) if (!ctrl.UpdateAll()) MessageBox.Show(string.Format(Strings.Error_saving_parameters_of_0, ctrl.Name)); - if (usedNames != null && usedNames.Contains(LoadedProfile.Name.ToLower())) - { - MessageBox.Show(string.Format("There is already a procedure named '{0}'.{1}Choose another name please.", LoadedProfile.Name, Environment.NewLine), - Strings.Warning, - MessageBoxButtons.OK, - MessageBoxIcon.Exclamation); - return; - } + if (usedNames != null && usedNames.Contains(LoadedProfile.Name.ToLower())) + { + MessageBox.Show(string.Format("There is already a procedure named '{0}'.{1}Choose another name please.", LoadedProfile.Name, Environment.NewLine), + Strings.Warning, + MessageBoxButtons.OK, + MessageBoxIcon.Exclamation); + return; + } SaveUISettings(); DialogResult = DialogResult.OK; - Close(); - return; - } + Close(); + return; + } - private void cancelButton_Click(object sender, EventArgs e) - { + private void cancelButton_Click(object sender, EventArgs e) + { SaveUISettings(); DialogResult = DialogResult.Cancel; - Close(); - return; - } + Close(); + return; + } private void SaveUISettings() { @@ -962,21 +1257,22 @@ namespace TBF.UI.Bench.TestProfiles { TBF.LocalSettings ls = Program.LocalSettings; WindowState = (ls.OneProcedureDlgMaximized ? FormWindowState.Maximized : FormWindowState.Normal); - Width = (ls.OneProcedureDlgWidth > 0) ? ls.OneProcedureDlgWidth : 800; + Width = (ls.OneProcedureDlgWidth > 0) ? ls.OneProcedureDlgWidth : 800; Height = (ls.OneProcedureDlgHeight > 0) ? ls.OneProcedureDlgHeight : 420; - Left = (ls.OneProcedureDlgLeft != 0) ? ls.OneProcedureDlgLeft : 150; - Top = (ls.OneProcedureDlgTop != 0) ? ls.OneProcedureDlgTop : 150; + Left = (ls.OneProcedureDlgLeft != 0) ? ls.OneProcedureDlgLeft : 150; + Top = (ls.OneProcedureDlgTop != 0) ? ls.OneProcedureDlgTop : 150; } #region Tab switching - enum TestProfileTabs - { - General, - Metrology, - ErrorFlags, + enum TestProfileTabs + { + General, + Metrology, + Compound, + ErrorFlags, ErrorFlags2, - } + } TestProfileTabs selectedTab = TestProfileTabs.General; @@ -990,7 +1286,10 @@ namespace TBF.UI.Bench.TestProfiles case TestProfileTabs.Metrology: UpdateFromMetrologyTab(); break; - case TestProfileTabs.ErrorFlags: + case TestProfileTabs.Compound: + UpdateFromCompoundTab(); + break; + case TestProfileTabs.ErrorFlags: UpdateFromErrorFlagsTab(); break; case TestProfileTabs.ErrorFlags2: @@ -1000,6 +1299,7 @@ namespace TBF.UI.Bench.TestProfiles selectedTab = (TestProfileTabs)tabControl.SelectedIndex; bool isMetrologyOrErrorFlags = selectedTab == TestProfileTabs.Metrology || + selectedTab == TestProfileTabs.Compound || selectedTab == TestProfileTabs.ErrorFlags || selectedTab == TestProfileTabs.ErrorFlags2; @@ -1011,10 +1311,10 @@ namespace TBF.UI.Bench.TestProfiles { sharedButtons.DisableButtons(SharedButtons.Buttons.Add); } - - //bool removeBtnEnabled = (selectedTab != TestProfileTabs.General); - sharedButtons.DisableButtons(SharedButtons.Buttons.Remove); + //bool removeBtnEnabled = (selectedTab != TestProfileTabs.General); + + sharedButtons.DisableButtons(SharedButtons.Buttons.Remove); ListViewEx lv = null; /// @@ -1029,18 +1329,23 @@ namespace TBF.UI.Bench.TestProfiles lv = metrologyListViewEx; /// ListVIewEx for test selection break; + case TestProfileTabs.Compound: + RefreshCompoundTab(); + lv = compoundListViewEx; /// ListVIewEx for compound test selection + break; + case TestProfileTabs.ErrorFlags: RefreshErrorFlagsTab(); - lv = errorFlagsListViewEx; /// ListVIewEx for test selection + lv = errorFlagsListViewEx; /// ListVIewEx for error flags break; case TestProfileTabs.ErrorFlags2: RefreshErrorFlags2Tab(); - lv = errorFlags2ListViewEx; /// ListVIewEx for test selection + lv = errorFlags2ListViewEx; /// ListVIewEx for error flags 2 break; default: - UpdateButtonStates(SharedButtons.SelectedItemPos.None); + UpdateButtonStates(SharedButtons.SelectedItemPos.None); break; } @@ -1065,6 +1370,7 @@ namespace TBF.UI.Bench.TestProfiles switch (selectedTab) { case TestProfileTabs.Metrology: listViewEx = metrologyListViewEx; break; + case TestProfileTabs.Compound: listViewEx = compoundListViewEx; break; case TestProfileTabs.ErrorFlags: listViewEx = errorFlagsListViewEx; break; case TestProfileTabs.ErrorFlags2: listViewEx = errorFlags2ListViewEx; break; default: return; @@ -1076,7 +1382,14 @@ namespace TBF.UI.Bench.TestProfiles string newName; for (int nameId = 1; true; nameId++) { - if (nameId >= 5 || (nameId >= 4 && LoadedProfile.ProfileType == ProfileType.QpQi) || LoadedProfile.ProfileType == ProfileType.Manual) + if ((nameId > 4 && LoadedProfile.ProfileType == ProfileType.Q3R) || + (nameId > 4 && LoadedProfile.ProfileType == ProfileType.QnClassColdWater) || + (nameId > 4 && LoadedProfile.ProfileType == ProfileType.QnClassHotWater) || + (nameId > 3 && LoadedProfile.ProfileType == ProfileType.QpQi) || + (nameId > 7 && LoadedProfile.ProfileType == ProfileType.Q3RCompound) || + (nameId > 7 && LoadedProfile.ProfileType == ProfileType.QnClassCompound) || + (nameId > 6 && LoadedProfile.ProfileType == ProfileType.QpQiCompound) || + LoadedProfile.ProfileType == ProfileType.Manual) { newName = Strings.New_test_name + nameId.ToString(); } @@ -1097,6 +1410,18 @@ namespace TBF.UI.Bench.TestProfiles case ProfileType.QpQi: newName = (nameId == 1) ? "qp" : (nameId == 2) ? "0,1qp" : "qi"; break; + + case ProfileType.Q3RCompound: + newName = (nameId == 1) ? "Q4_main" : (nameId == 2) ? "Q3_main" : (nameId == 3) ? "Q2_main" : (nameId == 4) ? "Qrise-10%" : (nameId == 5) ? "Qfall+10%" : (nameId == 6) ? "Q2_aux" : "Q1_aux"; + break; + + case ProfileType.QnClassCompound: + newName = (nameId == 1) ? "Qmax_main" : (nameId == 2) ? "Qn_main" : (nameId == 3) ? "Qt_main" : (nameId == 4) ? "Qrise-10%" : (nameId == 5) ? "Qfall+10%" : (nameId == 6) ? "Qt_aux" : "Qmin_aux"; + break; + + case ProfileType.QpQiCompound: + newName = (nameId == 1) ? "qp_main" : (nameId == 2) ? "0,1qp_main" : (nameId == 3) ? "Qrise-10%" : (nameId == 4) ? "Qfall+10%" : (nameId == 5) ? "0,1qp_aux" : "qi_aux"; + break; } } @@ -1116,35 +1441,27 @@ namespace TBF.UI.Bench.TestProfiles /// switch (LoadedProfile.ProfileType) { - case ProfileType.Q3R: + case ProfileType.Q3R: case ProfileType.QnClassColdWater: case ProfileType.QnClassHotWater: - switch (count) - { - case 0: - case 1: - ptest.CoefQfrom = 0.9; - ptest.CoefQto = 1.0; - break; - default: - ptest.CoefQfrom = 1.0; - ptest.CoefQto = 1.1; - break; - } + ptest.CoefQfrom = (count < 2) ? 0.9 : 1.0; + ptest.CoefQto = (count < 2) ? 1.0 : 1.1; break; case ProfileType.QpQi: - switch (count) - { - case 0: - ptest.CoefQfrom = 0.9; - ptest.CoefQto = 1.0; - break; - default: - ptest.CoefQfrom = 1.0; - ptest.CoefQto = 1.1; - break; - } + ptest.CoefQfrom = (count < 1) ? 0.9 : 1.0; + ptest.CoefQto = (count < 1) ? 1.0 : 1.1; + break; + + case ProfileType.Q3RCompound: + case ProfileType.QnClassCompound: + ptest.CoefQfrom = (count < 2) ? 0.9 : 1.0; + ptest.CoefQto = (count < 2) ? 1.0 : 1.1; + break; + + case ProfileType.QpQiCompound: + ptest.CoefQfrom = (count < 1) ? 0.9 : 1.0; + ptest.CoefQto = (count < 1) ? 1.0 : 1.1; break; } @@ -1153,39 +1470,57 @@ namespace TBF.UI.Bench.TestProfiles /// switch (LoadedProfile.ProfileType) { - case ProfileType.Q3R: + case ProfileType.Q3R: case ProfileType.QnClassColdWater: switch (count) { - case 3: - ptest.ErrLimLo = -5.0; - ptest.ErrLimHi = 5.0; - break; default: - ptest.ErrLimLo = -2.0; - ptest.ErrLimHi = 2.0; - break; + case 0: ptest.ErrLimLo = -2; ptest.ErrLimHi = 2; break; + case 1: ptest.ErrLimLo = -2; ptest.ErrLimHi = 2; break; + case 2: ptest.ErrLimLo = -2; ptest.ErrLimHi = 2; break; + case 3: ptest.ErrLimLo = -5; ptest.ErrLimHi = 5; break; } break; case ProfileType.QnClassHotWater: switch (count) { - case 3: - ptest.ErrLimLo = -5.0; - ptest.ErrLimHi = 5.0; - break; default: - ptest.ErrLimLo = -3.0; - ptest.ErrLimHi = 3.0; - break; + case 0: ptest.ErrLimLo = -3; ptest.ErrLimHi = 3; break; + case 1: ptest.ErrLimLo = -3; ptest.ErrLimHi = 3; break; + case 2: ptest.ErrLimLo = -3; ptest.ErrLimHi = 3; break; + case 3: ptest.ErrLimLo = -5; ptest.ErrLimHi = 5; break; + } + break; + + case ProfileType.Q3RCompound: + case ProfileType.QnClassCompound: + switch (count) + { + default: + case 0: ptest.ErrLimLo = -2; ptest.ErrLimHi = 2; break; + case 1: ptest.ErrLimLo = -2; ptest.ErrLimHi = 2; break; + case 2: ptest.ErrLimLo = -2; ptest.ErrLimHi = 2; break; + case 3: ptest.ErrLimLo = -5; ptest.ErrLimHi = 5; break; + case 4: ptest.ErrLimLo = -5; ptest.ErrLimHi = 5; break; + case 5: ptest.ErrLimLo = -5; ptest.ErrLimHi = 5; break; + case 6: ptest.ErrLimLo = -10; ptest.ErrLimHi = 10; break; } break; } + if (Rig.StateMachine.QriseQfallDetection != null && + (((LoadedProfile.ProfileType == ProfileType.Q3RCompound || LoadedProfile.ProfileType == ProfileType.QnClassCompound) && (count == 3 || count == 4)) || + (LoadedProfile.ProfileType == ProfileType.QpQiCompound && (count == 2 || count == 3)))) + { + ptest.Method = Rig.StateMachine.QriseQfallDetection.Name; + } + LoadedProfile.Tests.Add(ptest); AddToMetrologyTab(ptest); + AddToCompoundTab(ptest); AddToErrorFlagsTab(ptest); + AddToErrorFlags2Tab(ptest); if (listViewEx != null) { @@ -1202,180 +1537,196 @@ namespace TBF.UI.Bench.TestProfiles switch (selectedTab) { - case TestProfileTabs.Metrology: - UpdateFromMetrologyTab(); - listViewEx = metrologyListViewEx; - break; + case TestProfileTabs.Metrology: + UpdateFromMetrologyTab(); + listViewEx = metrologyListViewEx; + break; - case TestProfileTabs.ErrorFlags: - UpdateFromErrorFlagsTab(); - listViewEx = errorFlagsListViewEx; - break; + case TestProfileTabs.Compound: + UpdateFromCompoundTab(); + listViewEx = compoundListViewEx; + break; + + case TestProfileTabs.ErrorFlags: + UpdateFromErrorFlagsTab(); + listViewEx = errorFlagsListViewEx; + break; case TestProfileTabs.ErrorFlags2: UpdateFromErrorFlags2Tab(); listViewEx = errorFlags2ListViewEx; break; - default: return; + default: return; } - /// Check the selected index validity - if (listViewEx.SelectedItems.Count != 1) return; - - int removeItemNr = listViewEx.SelectedIndices[0]; - - /// Remove the selected test - PTest toBeDeleted = LoadedProfile.Tests[removeItemNr]; - LoadedProfile.Tests.Remove(toBeDeleted); - for (int i = removeItemNr; i < LoadedProfile.Tests.Count; i++) LoadedProfile.Tests[i].ItemNr--; - - RefreshMetrologyAndErrorFlagsTabs(); - - if (removeItemNr < listViewEx.Items.Count) - { - listViewEx.Focus(); - listViewEx.Items[removeItemNr].Selected = true; - listViewEx.Items[removeItemNr].EnsureVisible(); - } - else - { - UpdateButtonStates(SharedButtons.SelectedItemPos.None); - } - } - - private void upButton_Click(object sender, EventArgs e) - { - ListViewEx listViewEx; - - switch (selectedTab) - { - case TestProfileTabs.Metrology: - UpdateFromMetrologyTab(); - listViewEx = metrologyListViewEx; - break; - - case TestProfileTabs.ErrorFlags: - UpdateFromErrorFlagsTab(); - listViewEx = errorFlagsListViewEx; - break; - - case TestProfileTabs.ErrorFlags2: - UpdateFromErrorFlags2Tab(); - listViewEx = errorFlags2ListViewEx; - break; - - default: return; - } - - /// Check the selected index validity - if (listViewEx.SelectedItems.Count != 1) return; - - int ix = listViewEx.SelectedIndices[0]; - if (ix <= 0 || ix >= listViewEx.Items.Count) return; - - /// Swap two items (move the selected item up) - PTest test1 = LoadedProfile.Tests[ix - 1]; - PTest test2 = LoadedProfile.Tests[ix]; - test1.ItemNr++; - test2.ItemNr--; - LoadedProfile.Tests.RemoveAt(ix); - LoadedProfile.Tests.Insert(ix - 1, test2); - - if (SelectedTestIx >= 1) SelectedTestIx--; - - RefreshMetrologyAndErrorFlagsTabs(); - - listViewEx.Focus(); - listViewEx.Items[ix - 1].Selected = true; - listViewEx.Items[ix - 1].EnsureVisible(); - } - - private void downButton_Click(object sender, EventArgs e) - { - ListViewEx listViewEx; - - switch (selectedTab) - { - case TestProfileTabs.Metrology: - UpdateFromMetrologyTab(); - listViewEx = metrologyListViewEx; - break; - - case TestProfileTabs.ErrorFlags: - UpdateFromErrorFlagsTab(); - listViewEx = errorFlagsListViewEx; - break; - - case TestProfileTabs.ErrorFlags2: - UpdateFromErrorFlags2Tab(); - listViewEx = errorFlags2ListViewEx; - break; - - default: return; - } - /// Check the selected index validity if (listViewEx.SelectedItems.Count != 1) return; - int ix = listViewEx.SelectedIndices[0]; - if (ix < 0 || ix >= listViewEx.Items.Count - 1) return; + int removeItemNr = listViewEx.SelectedIndices[0]; - /// Swap two items (move the selected item down) - PTest test1 = LoadedProfile.Tests[ix]; - PTest test2 = LoadedProfile.Tests[ix + 1]; - test1.ItemNr++; - test2.ItemNr--; - LoadedProfile.Tests.RemoveAt(ix + 1); - LoadedProfile.Tests.Insert(ix, test2); + /// Remove the selected test + PTest toBeDeleted = LoadedProfile.Tests[removeItemNr]; + LoadedProfile.Tests.Remove(toBeDeleted); + for (int i = removeItemNr; i < LoadedProfile.Tests.Count; i++) LoadedProfile.Tests[i].ItemNr--; + + RefreshMetrologyAndErrorFlagsTabs(); + + if (removeItemNr < listViewEx.Items.Count) + { + listViewEx.Focus(); + listViewEx.Items[removeItemNr].Selected = true; + listViewEx.Items[removeItemNr].EnsureVisible(); + } + else + { + UpdateButtonStates(SharedButtons.SelectedItemPos.None); + } + } + + private void upButton_Click(object sender, EventArgs e) + { + ListViewEx listViewEx; + + switch (selectedTab) + { + case TestProfileTabs.Metrology: + UpdateFromMetrologyTab(); + listViewEx = metrologyListViewEx; + break; + + case TestProfileTabs.Compound: + UpdateFromCompoundTab(); + listViewEx = compoundListViewEx; + break; + + case TestProfileTabs.ErrorFlags: + UpdateFromErrorFlagsTab(); + listViewEx = errorFlagsListViewEx; + break; + + case TestProfileTabs.ErrorFlags2: + UpdateFromErrorFlags2Tab(); + listViewEx = errorFlags2ListViewEx; + break; + + default: return; + } + + /// Check the selected index validity + if (listViewEx.SelectedItems.Count != 1) return; + + int ix = listViewEx.SelectedIndices[0]; + if (ix <= 0 || ix >= listViewEx.Items.Count) return; + + /// Swap two items (move the selected item up) + PTest test1 = LoadedProfile.Tests[ix - 1]; + PTest test2 = LoadedProfile.Tests[ix]; + test1.ItemNr++; + test2.ItemNr--; + LoadedProfile.Tests.RemoveAt(ix); + LoadedProfile.Tests.Insert(ix - 1, test2); + + if (SelectedTestIx >= 1) SelectedTestIx--; + + RefreshMetrologyAndErrorFlagsTabs(); + + listViewEx.Focus(); + listViewEx.Items[ix - 1].Selected = true; + listViewEx.Items[ix - 1].EnsureVisible(); + } + + private void downButton_Click(object sender, EventArgs e) + { + ListViewEx listViewEx; + + switch (selectedTab) + { + case TestProfileTabs.Metrology: + UpdateFromMetrologyTab(); + listViewEx = metrologyListViewEx; + break; + + case TestProfileTabs.Compound: + UpdateFromCompoundTab(); + listViewEx = compoundListViewEx; + break; + + case TestProfileTabs.ErrorFlags: + UpdateFromErrorFlagsTab(); + listViewEx = errorFlagsListViewEx; + break; + + case TestProfileTabs.ErrorFlags2: + UpdateFromErrorFlags2Tab(); + listViewEx = errorFlags2ListViewEx; + break; + + default: return; + } + + /// Check the selected index validity + if (listViewEx.SelectedItems.Count != 1) return; + + int ix = listViewEx.SelectedIndices[0]; + if (ix < 0 || ix >= listViewEx.Items.Count - 1) return; + + /// Swap two items (move the selected item down) + PTest test1 = LoadedProfile.Tests[ix]; + PTest test2 = LoadedProfile.Tests[ix + 1]; + test1.ItemNr++; + test2.ItemNr--; + LoadedProfile.Tests.RemoveAt(ix + 1); + LoadedProfile.Tests.Insert(ix, test2); if ((SelectedTestIx >= 0) && (SelectedTestIx < listViewEx.Items.Count - 1)) SelectedTestIx++; - RefreshMetrologyAndErrorFlagsTabs(); + RefreshMetrologyAndErrorFlagsTabs(); - listViewEx.Focus(); - listViewEx.Items[ix + 1].Selected = true; - listViewEx.Items[ix + 1].EnsureVisible(); - } + listViewEx.Focus(); + listViewEx.Items[ix + 1].Selected = true; + listViewEx.Items[ix + 1].EnsureVisible(); + } #endregion - private void metrologyListViewEx_SelectedIndexChanged(object sender, EventArgs e) { SelectedIndexChanged(sender, e); } + private void metrologyListViewEx_SelectedIndexChanged(object sender, EventArgs e) { SelectedIndexChanged(sender, e); } + private void compoundListViewEx_SelectedIndexChanged(object sender, EventArgs e) { SelectedIndexChanged(sender, e); } private void errorFlagsListViewEx_SelectedIndexChanged(object sender, EventArgs e) { SelectedIndexChanged(sender, e); } private void errorFlags2ListViewEx_SelectedIndexChanged(object sender, EventArgs e) { SelectedIndexChanged(sender, e); } - /// - /// Common part for four xxxListViewEx_SelectedIndexChanged event handlers - /// - void SelectedIndexChanged(object sender, EventArgs e) - { + /// + /// Common part for four xxxListViewEx_SelectedIndexChanged event handlers + /// + void SelectedIndexChanged(object sender, EventArgs e) + { ListViewEx listViewEx = sender as ListViewEx; if ((listViewEx == null) || (listViewEx.SelectedItems.Count != 1)) - { - UpdateButtonStates(SharedButtons.SelectedItemPos.None); + { + UpdateButtonStates(SharedButtons.SelectedItemPos.None); SelectedTestIx = -1; return; - } + } SelectedTestIx = listViewEx.SelectedIndices[0]; - if (listViewEx.Items.Count == 1) - { - UpdateButtonStates(SharedButtons.SelectedItemPos.FirstAndLast); - } + if (listViewEx.Items.Count == 1) + { + UpdateButtonStates(SharedButtons.SelectedItemPos.FirstAndLast); + } else if (SelectedTestIx == 0) - { - UpdateButtonStates(SharedButtons.SelectedItemPos.First); - } + { + UpdateButtonStates(SharedButtons.SelectedItemPos.First); + } else if (SelectedTestIx == (listViewEx.Items.Count - 1)) - { - UpdateButtonStates(SharedButtons.SelectedItemPos.Last); - } - else - { - UpdateButtonStates(SharedButtons.SelectedItemPos.Middle); - } - } + { + UpdateButtonStates(SharedButtons.SelectedItemPos.Last); + } + else + { + UpdateButtonStates(SharedButtons.SelectedItemPos.Middle); + } + } public void UpdateButtonStates(SharedButtons.SelectedItemPos selectedItemPos) { @@ -1411,7 +1762,7 @@ namespace TBF.UI.Bench.TestProfiles string SByte2String(SByte e) { - return ((ErrorFlagsMode) e).ToDescription(); + return ((ErrorFlagsMode)e).ToDescription(); } bool IsValidEFlagsMode(string str, out sbyte eflags) @@ -1429,21 +1780,6 @@ namespace TBF.UI.Bench.TestProfiles return false; } - bool IsValidEFlagsMode(string str, out ErrorFlagsMode eflags) - { - for (ErrorFlagsMode e = 0; e < ErrorFlagsMode.Count; e++) - { - if (e.ToDescription() == str) - { - eflags = e; - return true; - } - } - - eflags = 0; - return false; - } - sbyte String2SByte(string str) { for (ErrorFlagsMode e = 0; e < ErrorFlagsMode.Count; e++) @@ -1452,5 +1788,29 @@ namespace TBF.UI.Bench.TestProfiles } return 0; } + + private void profileTypeRadioButton5_CheckedChanged(object sender, EventArgs e) + { + CompoundRBCheckedChanged(); + } + + private void profileTypeRadioButton6_CheckedChanged(object sender, EventArgs e) + { + CompoundRBCheckedChanged(); + } + + private void profileTypeRadioButton7_CheckedChanged(object sender, EventArgs e) + { + CompoundRBCheckedChanged(); + } + + private void CompoundRBCheckedChanged() + { + bool isCompound = false; /// = profileTypeRadioButton5.Checked || profileTypeRadioButton6.Checked || profileTypeRadioButton7.Checked; + metrologyTabPage.Enabled = !isCompound; + metrologyListViewEx.Enabled = !isCompound; + compoundTabPage.Enabled = isCompound; + compoundListViewEx.Enabled = isCompound; + } } } diff --git a/TBF/UI/Bench/TestProfiles/TestProfileDlg.designer.cs b/TBF/UI/Bench/TestProfiles/TestProfileDlg.designer.cs index c7dc40a8c..151637e86 100644 --- a/TBF/UI/Bench/TestProfiles/TestProfileDlg.designer.cs +++ b/TBF/UI/Bench/TestProfiles/TestProfileDlg.designer.cs @@ -39,11 +39,14 @@ namespace TBF.UI.Bench.TestProfiles this.errorCalculationRadioButton2 = new System.Windows.Forms.RadioButton(); this.errorCalculationRadioButton1 = new System.Windows.Forms.RadioButton(); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.profileTypeRadioButton1 = new System.Windows.Forms.RadioButton(); + this.profileTypeRadioButton8 = new System.Windows.Forms.RadioButton(); + this.profileTypeRadioButton7 = new System.Windows.Forms.RadioButton(); + this.profileTypeRadioButton6 = new System.Windows.Forms.RadioButton(); this.profileTypeRadioButton5 = new System.Windows.Forms.RadioButton(); - this.profileTypeRadioButton2 = new System.Windows.Forms.RadioButton(); this.profileTypeRadioButton4 = new System.Windows.Forms.RadioButton(); this.profileTypeRadioButton3 = new System.Windows.Forms.RadioButton(); + this.profileTypeRadioButton2 = new System.Windows.Forms.RadioButton(); + this.profileTypeRadioButton1 = new System.Windows.Forms.RadioButton(); this.lastChangedOnTextBox = new System.Windows.Forms.TextBox(); this.label15 = new System.Windows.Forms.Label(); this.lastChangedByTextBox = new System.Windows.Forms.TextBox(); @@ -58,6 +61,8 @@ namespace TBF.UI.Bench.TestProfiles this.label1 = new System.Windows.Forms.Label(); this.metrologyTabPage = new System.Windows.Forms.TabPage(); this.metrologyListViewEx = new Common.Forms.ListViewEx(); + this.compoundTabPage = new System.Windows.Forms.TabPage(); + this.compoundListViewEx = new Common.Forms.ListViewEx(); this.errorFlagsTabPage = new System.Windows.Forms.TabPage(); this.errorFlagsListViewEx = new Common.Forms.ListViewEx(); this.errorFlags2TabPage = new System.Windows.Forms.TabPage(); @@ -72,6 +77,7 @@ namespace TBF.UI.Bench.TestProfiles this.groupBox2.SuspendLayout(); this.groupBox1.SuspendLayout(); this.metrologyTabPage.SuspendLayout(); + this.compoundTabPage.SuspendLayout(); this.errorFlagsTabPage.SuspendLayout(); this.errorFlags2TabPage.SuspendLayout(); this.SuspendLayout(); @@ -94,6 +100,7 @@ namespace TBF.UI.Bench.TestProfiles // this.tabControl.Controls.Add(this.generalTabPage); this.tabControl.Controls.Add(this.metrologyTabPage); + this.tabControl.Controls.Add(this.compoundTabPage); this.tabControl.Controls.Add(this.errorFlagsTabPage); this.tabControl.Controls.Add(this.errorFlags2TabPage); resources.ApplyResources(this.tabControl, "tabControl"); @@ -145,21 +152,40 @@ namespace TBF.UI.Bench.TestProfiles // // groupBox1 // - this.groupBox1.Controls.Add(this.profileTypeRadioButton1); + this.groupBox1.Controls.Add(this.profileTypeRadioButton8); + this.groupBox1.Controls.Add(this.profileTypeRadioButton7); + this.groupBox1.Controls.Add(this.profileTypeRadioButton6); this.groupBox1.Controls.Add(this.profileTypeRadioButton5); - this.groupBox1.Controls.Add(this.profileTypeRadioButton2); this.groupBox1.Controls.Add(this.profileTypeRadioButton4); this.groupBox1.Controls.Add(this.profileTypeRadioButton3); + this.groupBox1.Controls.Add(this.profileTypeRadioButton2); + this.groupBox1.Controls.Add(this.profileTypeRadioButton1); resources.ApplyResources(this.groupBox1, "groupBox1"); this.groupBox1.Name = "groupBox1"; this.groupBox1.TabStop = false; // - // profileTypeRadioButton1 + // profileTypeRadioButton8 // - resources.ApplyResources(this.profileTypeRadioButton1, "profileTypeRadioButton1"); - this.profileTypeRadioButton1.Name = "profileTypeRadioButton1"; - this.profileTypeRadioButton1.TabStop = true; - this.profileTypeRadioButton1.UseVisualStyleBackColor = true; + resources.ApplyResources(this.profileTypeRadioButton8, "profileTypeRadioButton8"); + this.profileTypeRadioButton8.Name = "profileTypeRadioButton8"; + this.profileTypeRadioButton8.TabStop = true; + this.profileTypeRadioButton8.UseVisualStyleBackColor = true; + // + // profileTypeRadioButton7 + // + resources.ApplyResources(this.profileTypeRadioButton7, "profileTypeRadioButton7"); + this.profileTypeRadioButton7.Name = "profileTypeRadioButton7"; + this.profileTypeRadioButton7.TabStop = true; + this.profileTypeRadioButton7.UseVisualStyleBackColor = true; + this.profileTypeRadioButton7.CheckedChanged += new System.EventHandler(this.profileTypeRadioButton7_CheckedChanged); + // + // profileTypeRadioButton6 + // + resources.ApplyResources(this.profileTypeRadioButton6, "profileTypeRadioButton6"); + this.profileTypeRadioButton6.Name = "profileTypeRadioButton6"; + this.profileTypeRadioButton6.TabStop = true; + this.profileTypeRadioButton6.UseVisualStyleBackColor = true; + this.profileTypeRadioButton6.CheckedChanged += new System.EventHandler(this.profileTypeRadioButton6_CheckedChanged); // // profileTypeRadioButton5 // @@ -167,13 +193,7 @@ namespace TBF.UI.Bench.TestProfiles this.profileTypeRadioButton5.Name = "profileTypeRadioButton5"; this.profileTypeRadioButton5.TabStop = true; this.profileTypeRadioButton5.UseVisualStyleBackColor = true; - // - // profileTypeRadioButton2 - // - resources.ApplyResources(this.profileTypeRadioButton2, "profileTypeRadioButton2"); - this.profileTypeRadioButton2.Name = "profileTypeRadioButton2"; - this.profileTypeRadioButton2.TabStop = true; - this.profileTypeRadioButton2.UseVisualStyleBackColor = true; + this.profileTypeRadioButton5.CheckedChanged += new System.EventHandler(this.profileTypeRadioButton5_CheckedChanged); // // profileTypeRadioButton4 // @@ -189,6 +209,20 @@ namespace TBF.UI.Bench.TestProfiles this.profileTypeRadioButton3.TabStop = true; this.profileTypeRadioButton3.UseVisualStyleBackColor = true; // + // profileTypeRadioButton2 + // + resources.ApplyResources(this.profileTypeRadioButton2, "profileTypeRadioButton2"); + this.profileTypeRadioButton2.Name = "profileTypeRadioButton2"; + this.profileTypeRadioButton2.TabStop = true; + this.profileTypeRadioButton2.UseVisualStyleBackColor = true; + // + // profileTypeRadioButton1 + // + resources.ApplyResources(this.profileTypeRadioButton1, "profileTypeRadioButton1"); + this.profileTypeRadioButton1.Name = "profileTypeRadioButton1"; + this.profileTypeRadioButton1.TabStop = true; + this.profileTypeRadioButton1.UseVisualStyleBackColor = true; + // // lastChangedOnTextBox // resources.ApplyResources(this.lastChangedOnTextBox, "lastChangedOnTextBox"); @@ -263,11 +297,32 @@ namespace TBF.UI.Bench.TestProfiles this.metrologyListViewEx.DoubleClickActivation = false; this.metrologyListViewEx.FullRowSelect = true; this.metrologyListViewEx.GridLines = true; + this.metrologyListViewEx.HideSelection = false; this.metrologyListViewEx.Name = "metrologyListViewEx"; this.metrologyListViewEx.UseCompatibleStateImageBehavior = false; this.metrologyListViewEx.View = System.Windows.Forms.View.Details; this.metrologyListViewEx.SelectedIndexChanged += new System.EventHandler(this.metrologyListViewEx_SelectedIndexChanged); // + // compoundTabPage + // + this.compoundTabPage.Controls.Add(this.compoundListViewEx); + resources.ApplyResources(this.compoundTabPage, "compoundTabPage"); + this.compoundTabPage.Name = "compoundTabPage"; + this.compoundTabPage.UseVisualStyleBackColor = true; + // + // compoundListViewEx + // + this.compoundListViewEx.AllowColumnReorder = true; + resources.ApplyResources(this.compoundListViewEx, "compoundListViewEx"); + this.compoundListViewEx.DoubleClickActivation = false; + this.compoundListViewEx.FullRowSelect = true; + this.compoundListViewEx.GridLines = true; + this.compoundListViewEx.HideSelection = false; + this.compoundListViewEx.Name = "compoundListViewEx"; + this.compoundListViewEx.UseCompatibleStateImageBehavior = false; + this.compoundListViewEx.View = System.Windows.Forms.View.Details; + this.compoundListViewEx.SelectedIndexChanged += new System.EventHandler(this.compoundListViewEx_SelectedIndexChanged); + // // errorFlagsTabPage // this.errorFlagsTabPage.Controls.Add(this.errorFlagsListViewEx); @@ -282,6 +337,7 @@ namespace TBF.UI.Bench.TestProfiles this.errorFlagsListViewEx.DoubleClickActivation = false; this.errorFlagsListViewEx.FullRowSelect = true; this.errorFlagsListViewEx.GridLines = true; + this.errorFlagsListViewEx.HideSelection = false; this.errorFlagsListViewEx.Name = "errorFlagsListViewEx"; this.errorFlagsListViewEx.UseCompatibleStateImageBehavior = false; this.errorFlagsListViewEx.View = System.Windows.Forms.View.Details; @@ -301,6 +357,7 @@ namespace TBF.UI.Bench.TestProfiles this.errorFlags2ListViewEx.DoubleClickActivation = false; this.errorFlags2ListViewEx.FullRowSelect = true; this.errorFlags2ListViewEx.GridLines = true; + this.errorFlags2ListViewEx.HideSelection = false; this.errorFlags2ListViewEx.Name = "errorFlags2ListViewEx"; this.errorFlags2ListViewEx.UseCompatibleStateImageBehavior = false; this.errorFlags2ListViewEx.View = System.Windows.Forms.View.Details; @@ -330,6 +387,7 @@ namespace TBF.UI.Bench.TestProfiles this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.metrologyTabPage.ResumeLayout(false); + this.compoundTabPage.ResumeLayout(false); this.errorFlagsTabPage.ResumeLayout(false); this.errorFlags2TabPage.ResumeLayout(false); this.ResumeLayout(false); @@ -356,18 +414,23 @@ namespace TBF.UI.Bench.TestProfiles private System.Windows.Forms.Label label12; private System.Windows.Forms.TextBox procNameTextBox; private System.Windows.Forms.Label label1; - private System.Windows.Forms.RadioButton profileTypeRadioButton2; - private System.Windows.Forms.RadioButton profileTypeRadioButton1; - private System.Windows.Forms.TabPage errorFlagsTabPage; + private System.Windows.Forms.TabPage errorFlagsTabPage; private Common.Forms.ListViewEx errorFlagsListViewEx; - private System.Windows.Forms.RadioButton profileTypeRadioButton3; - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.RadioButton errorCalculationRadioButton2; - private System.Windows.Forms.RadioButton errorCalculationRadioButton1; private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.RadioButton profileTypeRadioButton5; + private System.Windows.Forms.RadioButton profileTypeRadioButton1; + private System.Windows.Forms.RadioButton profileTypeRadioButton2; + private System.Windows.Forms.RadioButton profileTypeRadioButton3; private System.Windows.Forms.RadioButton profileTypeRadioButton4; + private System.Windows.Forms.RadioButton profileTypeRadioButton5; + private System.Windows.Forms.RadioButton profileTypeRadioButton6; + private System.Windows.Forms.RadioButton profileTypeRadioButton7; + private System.Windows.Forms.RadioButton profileTypeRadioButton8; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.RadioButton errorCalculationRadioButton1; + private System.Windows.Forms.RadioButton errorCalculationRadioButton2; private System.Windows.Forms.TabPage errorFlags2TabPage; private Common.Forms.ListViewEx errorFlags2ListViewEx; - } + private System.Windows.Forms.TabPage compoundTabPage; + private Common.Forms.ListViewEx compoundListViewEx; + } } \ No newline at end of file diff --git a/TBF/UI/Bench/TestProfiles/TestProfileDlg.resx b/TBF/UI/Bench/TestProfiles/TestProfileDlg.resx index daf4087e4..7da643249 100644 --- a/TBF/UI/Bench/TestProfiles/TestProfileDlg.resx +++ b/TBF/UI/Bench/TestProfiles/TestProfileDlg.resx @@ -222,36 +222,96 @@ 0 - + True - + NoControl - - 28, 21 + + 28, 173 - - 71, 17 + + 234, 17 - - 34 + + 41 - - Q3 and R + + Entering numbers and designations manually - - profileTypeRadioButton1 + + profileTypeRadioButton8 - + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + groupBox1 - + 0 + + True + + + NoControl + + + 28, 151 + + + 128, 17 + + + 40 + + + qp and qi - compound + + + profileTypeRadioButton7 + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 1 + + + True + + + NoControl + + + 28, 129 + + + 147, 17 + + + 39 + + + Qn and Class - compound + + + profileTypeRadioButton6 + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 2 + True @@ -262,13 +322,13 @@ 28, 107 - 234, 17 + 130, 17 38 - Entering numbers and designations manually + Q3 and R - compound profileTypeRadioButton5 @@ -280,37 +340,7 @@ groupBox1 - 1 - - - True - - - NoControl - - - 28, 42 - - - 146, 17 - - - 35 - - - Qn and Class - cold water - - - profileTypeRadioButton2 - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox1 - - - 2 + 3 True @@ -322,13 +352,13 @@ 28, 85 - 73, 17 + 69, 17 37 - Qp and Qi + qp and qi profileTypeRadioButton4 @@ -340,7 +370,7 @@ groupBox1 - 3 + 4 True @@ -370,13 +400,73 @@ groupBox1 - 4 + 5 + + + True + + + NoControl + + + 28, 42 + + + 146, 17 + + + 35 + + + Qn and Class - cold water + + + profileTypeRadioButton2 + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 6 + + + True + + + NoControl + + + 28, 21 + + + 71, 17 + + + 34 + + + Q3 and R + + + profileTypeRadioButton1 + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 7 23, 123 - 366, 137 + 366, 203 39 @@ -777,6 +867,54 @@ 1 + + Fill + + + 0, 0 + + + 923, 366 + + + 1 + + + compoundListViewEx + + + Common.Forms.ListViewEx, Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + compoundTabPage + + + 0 + + + 4, 34 + + + 923, 366 + + + 7 + + + Compound + + + compoundTabPage + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabControl + + + 2 + Fill @@ -823,7 +961,7 @@ tabControl - 2 + 3 Fill @@ -871,7 +1009,7 @@ tabControl - 3 + 4 Fill @@ -925,7 +1063,7 @@ sharedButtons - TBF.UI.Shared.SharedButtons, TBF, Version=3.4.1981.0, Culture=neutral, PublicKeyToken=null + TBF.UI.Shared.SharedButtons, TBF, Version=3.6.2071.0, Culture=neutral, PublicKeyToken=null mainSplitContainer.Panel2 diff --git a/TBF/UI/Procedures/TestWizard/TestProfileSelection.cs b/TBF/UI/Procedures/TestWizard/TestProfileSelection.cs index 815198335..9e1802d94 100644 --- a/TBF/UI/Procedures/TestWizard/TestProfileSelection.cs +++ b/TBF/UI/Procedures/TestWizard/TestProfileSelection.cs @@ -109,8 +109,9 @@ namespace TBF.UI.Procedures.TestWizard case ProfileType.Q3R: qnLabel.Text = "Q3"; break; - case ProfileType.QpQi: - qnLabel.Text = "qp"; + case ProfileType.Q3RCompound: + qnLabel.Text = "Q3 main"; + qnAuxLabel.Text = "Q3 aux"; break; case ProfileType.QnClassColdWater: case ProfileType.QnClassHotWater: @@ -118,6 +119,17 @@ namespace TBF.UI.Procedures.TestWizard default: qnLabel.Text = "Qn"; break; + case ProfileType.QnClassCompound: + qnLabel.Text = "Qn main"; + qnAuxLabel.Text = "Qn aux"; + break; + case ProfileType.QpQi: + qnLabel.Text = "qp"; + break; + case ProfileType.QpQiCompound: + qnLabel.Text = "qp main"; + qnAuxLabel.Text = "qp aux"; + break; } } @@ -125,6 +137,7 @@ namespace TBF.UI.Procedures.TestWizard { string oriText = metroClassComboBox.Text; metroClassComboBox.Items.Clear(); + metroClassAuxComboBox.Items.Clear(); bool clearTextFlag = true; if (profile != null) @@ -134,6 +147,7 @@ namespace TBF.UI.Procedures.TestWizard { default: case ProfileType.Q3R: + case ProfileType.Q3RCompound: mClasses = new string[] { "R40", "R50", "R63", "R80", "R100", "R125", "R160", "R200", "R250", "R315", "R400", "R500", "R630", "R800", "R1000", "R1250", "R1600", "R2000", "R2500" }; break; @@ -143,7 +157,11 @@ namespace TBF.UI.Procedures.TestWizard case ProfileType.QnClassHotWater: mClasses = new string[] { "A", "B", "C", "D" }; break; + case ProfileType.QnClassCompound: + mClasses = new string[] { "A", "B" }; + break; case ProfileType.QpQi: + case ProfileType.QpQiCompound: mClasses = new string[] { "1", "2", "3" }; break; } @@ -151,6 +169,7 @@ namespace TBF.UI.Procedures.TestWizard foreach (var mc in mClasses) { metroClassComboBox.Items.Add(mc); + metroClassAuxComboBox.Items.Add(mc); if (oriText == mc) clearTextFlag = false; } } @@ -258,6 +277,10 @@ namespace TBF.UI.Procedures.TestWizard qpQiRatioGroupBox.Visible = (SelectedProfile.ProfileType == ProfileType.QpQi); metroClassGroupBox.Visible = (SelectedProfile.ProfileType != ProfileType.Manual); + qnAuxLabel.Visible = qnAuxTextBox.Visible = metroClassAuxComboBox.Visible = + (SelectedProfile.ProfileType == ProfileType.Q3RCompound || + SelectedProfile.ProfileType == ProfileType.QnClassCompound || + SelectedProfile.ProfileType == ProfileType.QpQiCompound); profileTypeLabel.Text = (newProfile != null) ? newProfile.ProfileType.ToString() : string.Empty; profileDescriptionLabel.Text = (newProfile != null) ? newProfile.Description : string.Empty; diff --git a/TBF/UI/Procedures/TestWizard/TestProfileSelection.designer.cs b/TBF/UI/Procedures/TestWizard/TestProfileSelection.designer.cs index cedca9105..8e8d7df1e 100644 --- a/TBF/UI/Procedures/TestWizard/TestProfileSelection.designer.cs +++ b/TBF/UI/Procedures/TestWizard/TestProfileSelection.designer.cs @@ -47,6 +47,9 @@ namespace TBF.UI.Procedures.TestWizard this.listViewEx = new Common.Forms.ListViewEx(); this.cancelButton = new System.Windows.Forms.Button(); this.nextButton = new System.Windows.Forms.Button(); + this.qnAuxTextBox = new System.Windows.Forms.TextBox(); + this.qnAuxLabel = new System.Windows.Forms.Label(); + this.metroClassAuxComboBox = new System.Windows.Forms.ComboBox(); ((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).BeginInit(); this.horizSplitContainer.Panel1.SuspendLayout(); this.horizSplitContainer.Panel2.SuspendLayout(); @@ -165,6 +168,8 @@ namespace TBF.UI.Procedures.TestWizard // // qnGroupBox // + this.qnGroupBox.Controls.Add(this.qnAuxTextBox); + this.qnGroupBox.Controls.Add(this.qnAuxLabel); this.qnGroupBox.Controls.Add(this.qnTextBox); this.qnGroupBox.Controls.Add(this.qnLabel); this.qnGroupBox.Location = new System.Drawing.Point(406, 12); @@ -176,7 +181,7 @@ namespace TBF.UI.Procedures.TestWizard // // qnTextBox // - this.qnTextBox.Location = new System.Drawing.Point(50, 22); + this.qnTextBox.Location = new System.Drawing.Point(55, 22); this.qnTextBox.Name = "qnTextBox"; this.qnTextBox.Size = new System.Drawing.Size(82, 20); this.qnTextBox.TabIndex = 11; @@ -185,7 +190,7 @@ namespace TBF.UI.Procedures.TestWizard // qnLabel // this.qnLabel.AutoSize = true; - this.qnLabel.Location = new System.Drawing.Point(17, 26); + this.qnLabel.Location = new System.Drawing.Point(10, 26); this.qnLabel.Name = "qnLabel"; this.qnLabel.Size = new System.Drawing.Size(21, 13); this.qnLabel.TabIndex = 10; @@ -193,6 +198,7 @@ namespace TBF.UI.Procedures.TestWizard // // metroClassGroupBox // + this.metroClassGroupBox.Controls.Add(this.metroClassAuxComboBox); this.metroClassGroupBox.Controls.Add(this.metroClassComboBox); this.metroClassGroupBox.Location = new System.Drawing.Point(571, 12); this.metroClassGroupBox.Name = "metroClassGroupBox"; @@ -210,12 +216,16 @@ namespace TBF.UI.Procedures.TestWizard this.metroClassComboBox.TabIndex = 0; this.metroClassComboBox.SelectedIndexChanged += new System.EventHandler(this.metroClassComboBox_SelectedIndexChanged); // - // listView + // listViewEx // + this.listViewEx.AllowColumnReorder = true; this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill; + this.listViewEx.DoubleClickActivation = false; + this.listViewEx.FullRowSelect = true; this.listViewEx.GridLines = true; + this.listViewEx.HideSelection = false; this.listViewEx.Location = new System.Drawing.Point(0, 0); - this.listViewEx.Name = "listView"; + this.listViewEx.Name = "listViewEx"; this.listViewEx.Size = new System.Drawing.Size(850, 164); this.listViewEx.TabIndex = 0; this.listViewEx.UseCompatibleStateImageBehavior = false; @@ -243,6 +253,33 @@ namespace TBF.UI.Procedures.TestWizard this.nextButton.UseVisualStyleBackColor = true; this.nextButton.Click += new System.EventHandler(this.nextButton_Click); // + // qnAuxTextBox + // + this.qnAuxTextBox.Location = new System.Drawing.Point(55, 48); + this.qnAuxTextBox.Name = "qnAuxTextBox"; + this.qnAuxTextBox.Size = new System.Drawing.Size(82, 20); + this.qnAuxTextBox.TabIndex = 13; + this.qnAuxTextBox.Visible = false; + // + // qnAuxLabel + // + this.qnAuxLabel.AutoSize = true; + this.qnAuxLabel.Location = new System.Drawing.Point(10, 52); + this.qnAuxLabel.Name = "qnAuxLabel"; + this.qnAuxLabel.Size = new System.Drawing.Size(41, 13); + this.qnAuxLabel.TabIndex = 12; + this.qnAuxLabel.Text = "Q3 aux"; + this.qnAuxLabel.Visible = false; + // + // metroClassAuxComboBox + // + this.metroClassAuxComboBox.FormattingEnabled = true; + this.metroClassAuxComboBox.Location = new System.Drawing.Point(23, 48); + this.metroClassAuxComboBox.Name = "metroClassAuxComboBox"; + this.metroClassAuxComboBox.Size = new System.Drawing.Size(100, 21); + this.metroClassAuxComboBox.TabIndex = 1; + this.metroClassAuxComboBox.Visible = false; + // // TestProfileSelection // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -289,5 +326,8 @@ namespace TBF.UI.Procedures.TestWizard private System.Windows.Forms.GroupBox qpQiRatioGroupBox; private System.Windows.Forms.ComboBox qpQiRatioComboBox; private System.Windows.Forms.TextBox qnTextBox; - } + private System.Windows.Forms.TextBox qnAuxTextBox; + private System.Windows.Forms.Label qnAuxLabel; + private System.Windows.Forms.ComboBox metroClassAuxComboBox; + } } \ No newline at end of file