From b3fdb11b8126aeaf95f2cbd24444e5828d339fd7 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Thu, 31 Oct 2019 14:02:20 +0100 Subject: [PATCH] TestProfiles : UI changes --- TBF/LocalSettings.cs | 5 + TBF/Resources/Strings.Designer.cs | 63 + TBF/Resources/Strings.cs.resx | 6 + TBF/Resources/Strings.resx | 21 + TBF/UI/Bench/TestProfiles/TestProfileDlg.cs | 1819 +++-------------- .../TestProfiles/TestProfileDlg.designer.cs | 463 ++--- TBF/UI/Bench/TestProfiles/TestProfileDlg.resx | 1119 +++------- TBF/UI/Bench/TestProfiles/TestProfilesCtrl.cs | 139 +- TBF/UI/Procedures/ProcedureDlg.cs | 4 +- 9 files changed, 850 insertions(+), 2789 deletions(-) diff --git a/TBF/LocalSettings.cs b/TBF/LocalSettings.cs index 3fc26d3df..9a6a292e3 100644 --- a/TBF/LocalSettings.cs +++ b/TBF/LocalSettings.cs @@ -182,6 +182,11 @@ namespace TBF public int OneProcedureDlgWidth; public int OneProcedureDlgHeight; + [XmlArrayAttribute("ProfilesColumnWidths")] + public int[] ProfilesColumnWidths; + [XmlIgnore] + public int ProfilesColumnCount { get { return (ProfilesColumnWidths != null) ? ProfilesColumnWidths.Length : 0; } } + public int PrintOrderLeft; public int PrintOrderTop; diff --git a/TBF/Resources/Strings.Designer.cs b/TBF/Resources/Strings.Designer.cs index c15d749cf..ae83450f9 100644 --- a/TBF/Resources/Strings.Designer.cs +++ b/TBF/Resources/Strings.Designer.cs @@ -2814,6 +2814,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Profile. + /// + internal static string New_profile_name { + get { + return ResourceManager.GetString("New_profile_name", resourceCulture); + } + } + /// /// Looks up a localized string similar to New Q. /// @@ -3255,6 +3264,24 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Press. lim. hi [bar]. + /// + internal static string Press_lim_hi_chdr { + get { + return ResourceManager.GetString("Press_lim_hi_chdr", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Press. lim. lo [bar]. + /// + internal static string Press_lim_lo_chdr { + get { + return ResourceManager.GetString("Press_lim_lo_chdr", resourceCulture); + } + } + /// /// Looks up a localized string similar to Press OK to start the bench. /// @@ -3507,6 +3534,33 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Profile. + /// + internal static string Profile { + get { + return ResourceManager.GetString("Profile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Profile {0} added.. + /// + internal static string Profile_0_added { + get { + return ResourceManager.GetString("Profile_0_added", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Profile {0} modified.. + /// + internal static string Profile_0_modified { + get { + return ResourceManager.GetString("Profile_0_modified", resourceCulture); + } + } + /// /// Looks up a localized string similar to Program must be closed.. /// @@ -5307,6 +5361,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Test profiles. + /// + internal static string Test_profiles { + get { + return ResourceManager.GetString("Test_profiles", resourceCulture); + } + } + /// /// Looks up a localized string similar to Test repetition count exceeded upper limit. /// diff --git a/TBF/Resources/Strings.cs.resx b/TBF/Resources/Strings.cs.resx index aa808efb1..489447447 100644 --- a/TBF/Resources/Strings.cs.resx +++ b/TBF/Resources/Strings.cs.resx @@ -1512,4 +1512,10 @@ Vyprázdnění před + + Testovací profily + + + Profil + \ No newline at end of file diff --git a/TBF/Resources/Strings.resx b/TBF/Resources/Strings.resx index 8ed1c9b18..8be5c6e3c 100644 --- a/TBF/Resources/Strings.resx +++ b/TBF/Resources/Strings.resx @@ -2092,4 +2092,25 @@ Q tg [m3/h] + + Test profiles + + + Profile + + + Press. lim. hi [bar] + + + Press. lim. lo [bar] + + + Profile + + + Profile {0} added. + + + Profile {0} modified. + \ No newline at end of file diff --git a/TBF/UI/Bench/TestProfiles/TestProfileDlg.cs b/TBF/UI/Bench/TestProfiles/TestProfileDlg.cs index cf9df3182..3dd323fa4 100644 --- a/TBF/UI/Bench/TestProfiles/TestProfileDlg.cs +++ b/TBF/UI/Bench/TestProfiles/TestProfileDlg.cs @@ -28,29 +28,16 @@ namespace TBF.UI.Bench.TestProfiles readonly bool openUnlocked; /// - /// Procedure to be updated by this dialog. + /// Profile to be updated by this dialog. /// Set by the constructor or updated by the parent after creation and before loading. /// - public Procedure LoadedProcedure; + public Profile LoadedProfile; public int SelectedTestIx; /// -1 = none, 0 = 1st = top IList usedNames; /// Already used names /// Auxiliary public lists used also by user controls in tab pages public IList TbfComponents; - public IList Valves; - public IList RegulValves; - public IList TestMethods; - public IList UsedTestMethods; - ComboBox methodCBox; - - /// Auxiliary private lists - IList feedingPaths; - IList benchPaths; - IList outputPaths; - IList metersPaths; - IList heatMetersPaths; - IList transitionSequences; bool unlocked; @@ -63,21 +50,10 @@ namespace TBF.UI.Bench.TestProfiles InitializeComponent(); /// SharedDlgButtons configuration -#if KEMPNO_50 || KRAKOW_50 - sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.WaterMeterAuthority }; -#else - sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists }; -#endif + sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.WaterMeterAuthority }; -#if TURA_SPECIAL || TURA_IPERL || TURA_IPERL_NEW - sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove | - SharedButtons.Buttons.Up | SharedButtons.Buttons.Down |SharedButtons.Buttons.Custom1; - sharedButtons.Custom1Caption = string.Format("Načítaj testy{0}iPerl z Oracle", Environment.NewLine); - sharedButtons.Custom1Clicked += iPerlWizardButton_Click; -#else sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up | SharedButtons.Buttons.Down; -#endif sharedButtons.Unlocked += Unlocked; sharedButtons.OKClicked += okButton_Click; sharedButtons.CancelClicked += cancelButton_Click; @@ -87,161 +63,44 @@ namespace TBF.UI.Bench.TestProfiles sharedButtons.DownClicked += downButton_Click; /// ListViewEx-es configuration - metrology1ListViewEx.SubItemClicked += new SubItemEventHandler(metrology1ListViewEx_SubItemClicked); - metrology1ListViewEx.SubItemRightClicked += new SubItemEventHandler(metrology1ListViewEx_SubItemRightClicked); - metrology1ListViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(metrology1ListViewEx_SubItemEndEditing); + metrologyListViewEx.SubItemClicked += new SubItemEventHandler(metrologyListViewEx_SubItemClicked); + metrologyListViewEx.SubItemRightClicked += new SubItemEventHandler(metrologyListViewEx_SubItemRightClicked); + metrologyListViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(metrologyListViewEx_SubItemEndEditing); - metrology2ListViewEx.SubItemClicked += new SubItemEventHandler(metrology2ListViewEx_SubItemClicked); - metrology2ListViewEx.SubItemRightClicked += new SubItemEventHandler(metrology2ListViewEx_SubItemRightClicked); - metrology2ListViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(metrology2ListViewEx_SubItemEndEditing); - - processListViewEx.SubItemClicked += new SubItemEventHandler(processListViewEx_SubItemClicked); - processListViewEx.SubItemRightClicked += new SubItemEventHandler(processListViewEx_SubItemRightClicked); - processListViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(processListViewEx_SubItemEndEditing); - - parametersListViewEx.SubItemClicked += new SubItemEventHandler(parametersListViewEx_SubItemClicked); - parametersListViewEx.SubItemRightClicked += new SubItemEventHandler(parametersListViewEx_SubItemRightClicked); - parametersListViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(parametersListViewEx_SubItemEndEditing); + errorFlagsListViewEx.SubItemClicked += new SubItemEventHandler(errorFlagsListViewEx_SubItemClicked); + errorFlagsListViewEx.SubItemRightClicked += new SubItemEventHandler(errorFlagsListViewEx_SubItemRightClicked); + errorFlagsListViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(errorFlagsListViewEx_SubItemEndEditing); SelectedTestIx = -1; } - public TestProfileDlg(Config.Entities.Procedure procedure, IList usedNames, bool openUnlocked = false) + public TestProfileDlg(Config.Entities.Profile profile, IList usedNames, bool openUnlocked = false) : this() { - if (procedure == null) throw new ArgumentNullException("procedure"); + if (profile == null) throw new ArgumentNullException("profile"); - LoadedProcedure = procedure; + LoadedProfile = profile; this.usedNames = usedNames; this.openUnlocked = openUnlocked; -#if KEMPNO_50 || KRAKOW_50 - sharedButtons.RequiredGroupMembership = procedure.Protected ? new Users.Grp.GID[] { Users.Grp.GID.WaterMeterAuthority } - : new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.WaterMeterAuthority }; -#else - sharedButtons.RequiredGroupMembership = procedure.Protected ? new Users.Grp.GID[] { Users.Grp.GID.Metrologists } - : new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists }; -#endif - using (NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config)) - { - /// - /// Prepare a list of components and a list of all valves in the test bench - /// - TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(session); - Valves = BenchControl.GenericDevices.ValveBase.MasterValves(TbfComponents); - RegulValves = new List(); - TestMethods = new List(); - dataEntryComboBox.Items.Add("---"); - printer1ComboBox.Items.Add("---"); - printer2ComboBox.Items.Add("---"); - fileWriter1ComboBox.Items.Add("---"); - fileWriter2ComboBox.Items.Add("---"); - fileWriter3ComboBox.Items.Add("---"); - fileWriter4ComboBox.Items.Add("---"); - - foreach (var cmpnt in TbfComponents) - { - if (cmpnt is IRegulValve) RegulValves.Add(cmpnt as IRegulValve); - if (cmpnt is ITestMethod) TestMethods.Add(cmpnt as ITestMethod); - if (cmpnt is IDataEntry) dataEntryComboBox.Items.Add(cmpnt.Cfg.Name); - if (cmpnt is IResultsPrinter) - { - printer1ComboBox.Items.Add(cmpnt.Cfg.Name); - printer2ComboBox.Items.Add(cmpnt.Cfg.Name); - } - if (cmpnt is IResultsWriter) - { - fileWriter1ComboBox.Items.Add(cmpnt.Cfg.Name); - fileWriter2ComboBox.Items.Add(cmpnt.Cfg.Name); - fileWriter3ComboBox.Items.Add(cmpnt.Cfg.Name); - fileWriter4ComboBox.Items.Add(cmpnt.Cfg.Name); - } - } - - /// - /// Loads paths, this must be done before PrepareMetrology12AndProcessTabs() call - /// - feedingPaths = session.QueryOver().List(); - benchPaths = session.QueryOver().List(); - outputPaths = session.QueryOver().List(); - metersPaths = session.QueryOver().List(); -#if HEAT_METERS - heatMetersPaths = session.QueryOver().List(); -#else - heatMetersPaths = new List(); -#endif - transitionSequences = session.QueryOver().List(); - } - - transitionStartComboBox.Items.Add("---"); - transitionEndComboBox.Items.Add("---"); - foreach (var trans in transitionSequences) - { - transitionStartComboBox.Items.Add(trans.Name); - transitionEndComboBox.Items.Add(trans.Name); - } - - /////--------------------- - ///// Other components - /////--------------------- - - ///// Create a control for the water meters and add it to the list. - //IList other = new List(); - //foreach (var cmpnt in TbfComponents) - //{ - // if (cmpnt is TBF.BenchControl.Modbus.Easytherm.Easytherm) other.Add(cmpnt); - //} - - //if (other.Count > 0) - //{ - // ProcedureParamsCtrl newCtrl = new ProcedureParamsCtrl(this, other, false); - // procedureParamsCtrls.Add(newCtrl); - - // TabPage newTab = new TabPage(Strings.Temperature); - // newTab.Controls.Add(newCtrl); - // newTab.Tag = newCtrl; - // tabControl.TabPages.Add(newTab); - //} + sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.WaterMeterAuthority }; } private void ProcedureDlg_Load(object sender, EventArgs e) { Localize(); - if (LoadedProcedure == 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(); - /// Enable/disable/show/hide controls in General tab -#if KEMPNO_50 || KRAKOW_50 - altProcNameLabel.Visible = true; - altProcNameTextBox.Visible = true; - //altProcPeriodLabel.Visible = true; - //altProcPeriodTextBox.Visible = true; -#endif procNameTextBox.Enabled = false; descriptionTextBox.Enabled = false; - watermetersTextBox.Enabled = false; - protectedCheckBox.Enabled = false; - mustBeCompleteCheckBox.Enabled = false; - manualControlDisabledCheckBox.Enabled = false; - altProcNameTextBox.Enabled = false; - altProcPeriodTextBox.Enabled = false; - dataEntryComboBox.Enabled = false; - transitionStartComboBox.Enabled = false; - transitionEndComboBox.Enabled = false; - printer1ComboBox.Enabled = false; - printer2ComboBox.Enabled = false; - fileWriter1ComboBox.Enabled = false; - fileWriter2ComboBox.Enabled = false; - fileWriter3ComboBox.Enabled = false; - fileWriter4ComboBox.Enabled = false; - metersKindRadioButton1.Enabled = false; - metersKindRadioButton2.Enabled = false; - metersKindRadioButton3.Enabled = false; - notesTextBox.Enabled = false; + profileTypeRadioButton1.Enabled = false; + profileTypeRadioButton2.Enabled = false; + profileTypeRadioButton3.Enabled = false; #if !HEAT_METERS - metersKindRadioButton3.Visible = false; + profileTypeRadioButton3.Visible = false; #endif /// Make some controls readonly createdByTextBox.ReadOnly = true; @@ -249,21 +108,14 @@ namespace TBF.UI.Bench.TestProfiles lastChangedByTextBox.ReadOnly = true; lastChangedOnTextBox.ReadOnly = true; - /// History tab - InitializeHistoryTab(); /// Create ListViewEx columns for 'History of changes' - /// LisViewEx columns and edit controls for 'Metrology1', 'Metrology2', 'Process' and 'Parameters' tabs - PrepareMetrology1Tab(); - PrepareMetrology2Tab(); - PrepareProcess(); - PrepareParameters(); + PrepareMetrologyTab(); + PrepareErrorFlags(); /// Now refresh the content of the dialog RefreshGeneralTab(); - RefreshMetrology1Tab(); - RefreshMetrology2Tab(); - RefreshProcessTab(); - RefreshParametersTab(); + RefreshMetrologyTab(); + RefreshErrorFlagsTab(); /// Optionally unlock this dialog if (openUnlocked) @@ -275,13 +127,10 @@ namespace TBF.UI.Bench.TestProfiles void Localize() { - Text = Strings.Procedure; + Text = Strings.Test_profiles; generalTabPage.Text = Strings.General; - historyTabPage.Text = Strings.History_of_changes; - metrology1TabPage.Text = Strings.Metrology + " I."; - metrology2TabPage.Text = Strings.Metrology + " II."; - processTabPage.Text = Strings.Process; + metrology1TabPage.Text = Strings.Metrology; parametersTabPage.Text = Strings.Parameters; label1.Text = Strings.Procedure_name; @@ -290,409 +139,153 @@ namespace TBF.UI.Bench.TestProfiles label16.Text = Strings.Last_changed_by; label14.Text = Strings.Date; label15.Text = Strings.Date; - label18.Text = Strings.Notes; - watermetersLabel.Text = Strings.Meter_types_tested; - altProcNameLabel.Text = Strings.Conditions; - protectedCheckBox.Text = Strings.Protected_procedure; - mustBeCompleteCheckBox.Text = Strings.All_tests_must_be_completed; - manualControlDisabledCheckBox.Text = Strings.Manual_control_disabled; - dataEntryLabel.Text = Strings.Data_entry; - transitionStartLabel.Text = Strings.Purge_Begin; - transitionEndLabel.Text = Strings.Purge_End; - resultsPrinterLabel.Text = Strings.Printing; - resultsWriterLabel.Text = Strings.Saving_results; - metersKindRadioButton1.Text = Strings.SingleBtnText; - metersKindRadioButton2.Text = Strings.Compound; - metersKindRadioButton3.Text = Strings.Heat_meter; + //profileTypeRadioButton1.Text = Strings.SingleBtnText; + //profileTypeRadioButton2.Text = Strings.Compound; + //profileTypeRadioButton3.Text = Strings.Heat_meter; } #region General void RefreshGeneralTab() { - procNameTextBox.Text = LoadedProcedure.Name; - Text = string.Format("{0} {1} {2}", Strings.Procedure, LoadedProcedure.ItemNr + 1, LoadedProcedure.Name); + procNameTextBox.Text = LoadedProfile.Name; + Text = string.Format("{0} {1} {2}", Strings.Profile, LoadedProfile.ItemNr + 1, LoadedProfile.Name); - descriptionTextBox.Text = LoadedProcedure.Description; - createdByTextBox.Text = LoadedProcedure.CreationUser; - createdOnTextBox.Text = LoadedProcedure.CreationTime.ToString(); - lastChangedByTextBox.Text = LoadedProcedure.LastChgUser; - if (LoadedProcedure.LastChgTime > LoadedProcedure.CreationTime) + descriptionTextBox.Text = LoadedProfile.Description; + createdByTextBox.Text = LoadedProfile.CreationUser; + createdOnTextBox.Text = LoadedProfile.CreationTime.ToString(); + lastChangedByTextBox.Text = LoadedProfile.LastChgUser; + if (LoadedProfile.LastChgTime > LoadedProfile.CreationTime) { - lastChangedOnTextBox.Text = LoadedProcedure.LastChgTime.ToString(); + lastChangedOnTextBox.Text = LoadedProfile.LastChgTime.ToString(); } - watermetersTextBox.Text = LoadedProcedure.Watermeters; - protectedCheckBox.Checked = LoadedProcedure.Protected; - mustBeCompleteCheckBox.Checked = LoadedProcedure.MustBeComplete; - manualControlDisabledCheckBox.Checked = LoadedProcedure.ManualCtrlDisabled; - dataEntryComboBox.Text = string.IsNullOrEmpty(LoadedProcedure.DataEntry) ? "---" : LoadedProcedure.DataEntry; - transitionStartComboBox.Text = string.IsNullOrEmpty(LoadedProcedure.TransitionStart) ? "---" : LoadedProcedure.TransitionStart; - transitionEndComboBox.Text = string.IsNullOrEmpty(LoadedProcedure.TransitionEnd) ? "---" : LoadedProcedure.TransitionEnd; - - altProcNameTextBox.Text = string.IsNullOrEmpty(LoadedProcedure.AltProcName) ? "---" : LoadedProcedure.AltProcName; - altProcPeriodTextBox.Text = LoadedProcedure.AltProcPeriod.ToString(); - - if (string.IsNullOrEmpty(LoadedProcedure.ResultsPrinter)) - { - printer1ComboBox.Text = "---"; - printer2ComboBox.Text = "---"; - } - else - { - string[] fields = LoadedProcedure.ResultsPrinter.Split(new char[] { '~' }); - printer1ComboBox.Text = fields[0]; - printer2ComboBox.Text = (fields.Length == 2) ? fields[1] : "---"; - } - - if (string.IsNullOrEmpty(LoadedProcedure.ResultsWriter)) - { - fileWriter1ComboBox.Text = "---"; - fileWriter2ComboBox.Text = "---"; - fileWriter3ComboBox.Text = "---"; - fileWriter4ComboBox.Text = "---"; - } - else - { - string[] fields = LoadedProcedure.ResultsWriter.Split(new char[] { '~' }); - fileWriter1ComboBox.Text = fields[0]; - fileWriter2ComboBox.Text = (fields.Length >= 2) ? fields[1] : "---"; - fileWriter3ComboBox.Text = (fields.Length >= 3) ? fields[2] : "---"; - fileWriter4ComboBox.Text = (fields.Length >= 4) ? fields[3] : "---"; - } - - metersKindRadioButton1.Checked = (LoadedProcedure.MetersKind == MetersKind.Single - || (LoadedProcedure.MetersKind != MetersKind.Combined && LoadedProcedure.MetersKind != MetersKind.HeatMeter)); - metersKindRadioButton2.Checked = (LoadedProcedure.MetersKind == MetersKind.Combined); - metersKindRadioButton3.Checked = (LoadedProcedure.MetersKind == MetersKind.HeatMeter); - - notesTextBox.Text = LoadedProcedure.LongDescription; } void UpdateFromGeneralTab() { - LoadedProcedure.Name = procNameTextBox.Text; - Text = string.Format("{0} {1} {2}", Strings.Procedure, LoadedProcedure.ItemNr + 1, LoadedProcedure.Name); + LoadedProfile.Name = procNameTextBox.Text; + Text = string.Format("{0} {1} {2}", Strings.Profile, LoadedProfile.ItemNr + 1, LoadedProfile.Name); - LoadedProcedure.Description = descriptionTextBox.Text; - LoadedProcedure.Watermeters = watermetersTextBox.Text; - - LoadedProcedure.Protected = protectedCheckBox.Checked; - LoadedProcedure.MustBeComplete = mustBeCompleteCheckBox.Checked; - LoadedProcedure.ManualCtrlDisabled = manualControlDisabledCheckBox.Checked; - - LoadedProcedure.AltProcName = altProcNameTextBox.Text.Equals("---") ? string.Empty : altProcNameTextBox.Text; - - int itmp; - if (int.TryParse(altProcPeriodTextBox.Text, out itmp) && itmp >= 0) - { - LoadedProcedure.AltProcPeriod = itmp; - } - - if (transitionStartComboBox.Items.Contains(transitionStartComboBox.Text)) - { - LoadedProcedure.TransitionStart = transitionStartComboBox.Text.Equals("---") ? string.Empty : transitionStartComboBox.Text; - } - if (transitionEndComboBox.Items.Contains(transitionEndComboBox.Text)) - { - LoadedProcedure.TransitionEnd = transitionEndComboBox.Text.Equals("---") ? string.Empty : transitionEndComboBox.Text; - } - if (dataEntryComboBox.Items.Contains(dataEntryComboBox.Text)) - { - LoadedProcedure.DataEntry = dataEntryComboBox.Text.Equals("---") ? string.Empty : dataEntryComboBox.Text; - } - - if (printer1ComboBox.Items.Contains(printer1ComboBox.Text) && printer2ComboBox.Items.Contains(printer2ComboBox.Text)) - { - bool pr = !printer1ComboBox.Text.Equals("---"); - bool pr2 = !printer2ComboBox.Text.Equals("---") && !printer2ComboBox.Text.Equals(printer1ComboBox.Text); - - if (!pr && !pr2) LoadedProcedure.ResultsPrinter = string.Empty; - else if (pr && !pr2) LoadedProcedure.ResultsPrinter = printer1ComboBox.Text; - else if (!pr && pr2) LoadedProcedure.ResultsPrinter = printer2ComboBox.Text; - else LoadedProcedure.ResultsPrinter = printer1ComboBox.Text + '~' + printer2ComboBox.Text; - } - - if (fileWriter1ComboBox.Items.Contains(fileWriter1ComboBox.Text) && - fileWriter2ComboBox.Items.Contains(fileWriter2ComboBox.Text) && - fileWriter3ComboBox.Items.Contains(fileWriter3ComboBox.Text) && - fileWriter4ComboBox.Items.Contains(fileWriter4ComboBox.Text)) - { - bool first = true; - StringBuilder sb = new StringBuilder(); - if (!fileWriter1ComboBox.Text.Equals("---")) - { - sb.Append(fileWriter1ComboBox.Text); - first = false; - } - if (!fileWriter2ComboBox.Text.Equals("---") && !fileWriter2ComboBox.Text.Equals(fileWriter1ComboBox.Text)) - { - if (!first) sb.Append("~"); - sb.Append(fileWriter2ComboBox.Text); - first = false; - } - if (!fileWriter3ComboBox.Text.Equals("---") && !fileWriter3ComboBox.Text.Equals(fileWriter1ComboBox.Text) - && !fileWriter3ComboBox.Text.Equals(fileWriter2ComboBox.Text)) - { - if (!first) sb.Append("~"); first = false; - sb.Append(fileWriter3ComboBox.Text); - first = false; - } - if (!fileWriter4ComboBox.Text.Equals("---") && !fileWriter4ComboBox.Text.Equals(fileWriter1ComboBox.Text) - && !fileWriter4ComboBox.Text.Equals(fileWriter2ComboBox.Text) - && !fileWriter4ComboBox.Text.Equals(fileWriter3ComboBox.Text)) - { - if (!first) sb.Append("~"); - sb.Append(fileWriter4ComboBox.Text); - } - LoadedProcedure.ResultsWriter = sb.ToString(); - } - - LoadedProcedure.MetersKind = (metersKindRadioButton1.Checked ? MetersKind.Single - : (metersKindRadioButton2.Checked ? MetersKind.Combined - : MetersKind.HeatMeter)); - LoadedProcedure.LongDescription = notesTextBox.Text; + LoadedProfile.Description = descriptionTextBox.Text; } #endregion - #region History + #region Metrology - void InitializeHistoryTab() - { - TBF.LocalSettings ls = Program.LocalSettings; - - historyListViewEx.Columns.Add(Strings.Name, (ls.HistoryColumnCount > 0) ? ls.HistoryColumnWidths[0] : 80); - historyListViewEx.Columns.Add(Strings.Revision, (ls.HistoryColumnCount > 1) ? ls.HistoryColumnWidths[1] : 80); - historyListViewEx.Columns.Add(Strings.Date_and_time, (ls.HistoryColumnCount > 2) ? ls.HistoryColumnWidths[2] : 120); - historyListViewEx.Columns.Add(Strings.User, (ls.HistoryColumnCount > 3) ? ls.HistoryColumnWidths[3] : 55); - historyListViewEx.Columns.Add(Strings.DescriptionColHdr, (ls.HistoryColumnCount > 4) ? ls.HistoryColumnWidths[4] : 150); - historyListViewEx.Columns.Add(Strings.Other, (ls.HistoryColumnCount > 5) ? ls.HistoryColumnWidths[5] : 150); - - RefreshHistoryTab(); - } - - void RefreshHistoryTab() - { - NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); - IList procedures = session - .QueryOver() - .Where(x => x.ProcedureState == ProcedureState.History) - .List(); - - int predecessorId = LoadedProcedure.PredecessorId; - - IList oneProcedure = session - .QueryOver() - .Where(x => (x.ProcedureState == ProcedureState.Active)) - .And(x => (x.Id == predecessorId)) - .List(); - - if (oneProcedure.Count == 1) - { - predecessorId = oneProcedure[0].PredecessorId; - } - else - { - return; - } - - while (predecessorId != 0) - { - bool found = false; - foreach (var p in procedures) - { - if (p.Id == predecessorId) - { - found = true; - ListViewItem item = new ListViewItem(p.Name); - item.SubItems.Add(p.Revision.ToString()); - item.SubItems.Add(p.LastChgTime.ToString()); - item.SubItems.Add(p.LastChgUser.ToString()); - item.SubItems.Add(p.Description); - - string other = string.Empty; - //if ((p.Watermeters != null) && (p.Watermeters.Count > 0) && (p.Watermeters[0] != null)) other = p.Watermeters[0]; - item.SubItems.Add(other); - - historyListViewEx.Items.Add(item); - - predecessorId = p.PredecessorId; /// Iterate - break; - } - } - if (!found) break; - } - } - - void UpdateFromHistoryTab() - { - // Do nothing - } - - #endregion - - #region Metrology1 - - Control[] metrology1Editors; + Control[] metrologyEditors; public enum MtrlgyClmn { Name, - Part, -#if TEST_PROFILES - Qtg, -#endif - Qfrom, - Qto, - Volume, - TestTime, + CoefQfrom, + CoefQto, ErrLimLo, ErrLimHi, TempLimLo, TempLimHi, - Method, - CoulumnsCount + PressLimLo, + PressLimHi, + ColumnsCount } - void PrepareMetrology1Tab() + void PrepareMetrologyTab() { - ListViewEx lv = metrology1ListViewEx; + ListViewEx lv = metrologyListViewEx; lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.Part, Width = 40 }); -#if TEST_PROFILES - lv.Columns.Add(new ColumnHeader { Text = Strings.Q_tg_m3h, Width = 80 }); -#endif lv.Columns.Add(new ColumnHeader { Text = Strings.Q_from_m3h, Width = 80 }); lv.Columns.Add(new ColumnHeader { Text = Strings.Q_to_m3h, Width = 80 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.Volume + " [l]", Width = 70 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.Test_time_s_chdr, Width = 70 }); 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.Method_chdr, Width = 200 }); + 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 }); - methodCBox = new ComboBox(); - foreach (var m in TestMethods) methodCBox.Items.Add(m.Cfg.Name); - - metrology1Editors = new Control[] + metrologyEditors = new Control[] { new TextBox(), /// Name - new TextBox(), /// Part -#if TEST_PROFILES - new TextBox(), /// Qtg -#endif - new TextBox(), /// Qfrom - new TextBox(), /// Qto - new TextBox(), /// Volume - new TextBox(), /// Test time + new TextBox(), /// CoefQfrom + new TextBox(), /// CoefQto new TextBox(), /// Err.Lim. - new TextBox(), /// Err.Lim. + new TextBox(), /// Temp.Lim. - new TextBox(), /// Temp.Lim. + - methodCBox, /// Method + new TextBox(), /// Press.Lim. - + new TextBox(), /// Press.Lim. + }; - foreach (var ctrl in metrology1Editors) + foreach (var ctrl in metrologyEditors) { metrology1TabPage.Controls.Add(ctrl); } } - void RefreshMetrology1Tab() + void RefreshMetrologyTab() { - metrology1ListViewEx.Items.Clear(); - foreach (var test in LoadedProcedure.Tests) AddToMetrology1Tab(test); + metrologyListViewEx.Items.Clear(); + foreach (var test in LoadedProfile.Tests) AddToMetrologyTab(test); - if (0 <= SelectedTestIx && SelectedTestIx < metrology1ListViewEx.Items.Count) + if (0 <= SelectedTestIx && SelectedTestIx < metrologyListViewEx.Items.Count) { - metrology1ListViewEx.Items[SelectedTestIx].Selected = true; + metrologyListViewEx.Items[SelectedTestIx].Selected = true; } } - void AddToMetrology1Tab(Test test) + void AddToMetrologyTab(PTest pTest) { /// /// Metrology 1 item with subitems /// - ListViewItem lvi = new ListViewItem(test.Name); /// Name - lvi.Tag = test; - lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part -#if TEST_PROFILES - lvi.SubItems.Add(test.Qtg.ToString()); /// Q_tg (target flow) -#endif - lvi.SubItems.Add(test.Qfrom.ToString()); /// Q_from - lvi.SubItems.Add(test.Qto.ToString()); /// Q_to - lvi.SubItems.Add(test.Volume.ToString()); /// VOlume - lvi.SubItems.Add(test.TstTime.ToString()); - lvi.SubItems.Add(test.ErrLimLo.ToString()); - lvi.SubItems.Add(test.ErrLimHi.ToString()); - lvi.SubItems.Add(test.TempLimLo.ToString()); - lvi.SubItems.Add(test.TempLimHi.ToString()); - lvi.SubItems.Add((test.Method != null) ? test.Method.ToString() : string.Empty); + ListViewItem lvi = new ListViewItem(pTest.Name); + lvi.Tag = pTest; + lvi.SubItems.Add(pTest.CoefQfrom.ToString()); + lvi.SubItems.Add(pTest.CoefQto.ToString()); + lvi.SubItems.Add(pTest.ErrLimLo.ToString()); + lvi.SubItems.Add(pTest.ErrLimHi.ToString()); + lvi.SubItems.Add(pTest.TempLimLo.ToString()); + lvi.SubItems.Add(pTest.TempLimHi.ToString()); + lvi.SubItems.Add(pTest.PressLimLo.ToString()); + lvi.SubItems.Add(pTest.PressLimHi.ToString()); - metrology1ListViewEx.Items.Add(lvi); + metrologyListViewEx.Items.Add(lvi); } - void UpdateFromMetrology1Tab() + void UpdateFromMetrologyTab() { - for (int i = 0; i < metrology1ListViewEx.Items.Count; i++) + for (int i = 0; i < metrologyListViewEx.Items.Count; i++) { - ListViewItem lvi = metrology1ListViewEx.Items[i]; - Test entity = (Test)lvi.Tag; + ListViewItem lvi = metrologyListViewEx.Items[i]; + PTest entity = (PTest)lvi.Tag; entity.Name = lvi.Text; entity.ItemNr = i; - int part = entity.Part; - if (lvi.SubItems[(int)MtrlgyClmn.Part].Text.Equals("-")) - { - entity.Part = 0; - } - else if (int.TryParse(lvi.SubItems[(int)MtrlgyClmn.Part].Text, out part)) - { - entity.Part = part; - } - float tmp; -#if TEST_PROFILES - if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.Qtg].Text, out tmp)) entity.Qtg = tmp; -#endif - if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.Qfrom].Text, out tmp)) entity.Qfrom = tmp; - if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.Qto].Text, out tmp)) entity.Qto = tmp; - if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.Volume].Text, out tmp)) entity.Volume = tmp; - if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.TestTime].Text,out tmp)) entity.TstTime = tmp; - + if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.CoefQfrom].Text, out tmp)) entity.CoefQfrom = tmp; + if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.CoefQto].Text, out tmp)) entity.CoefQto = tmp; if (Utils.TryParseSFloat(lvi.SubItems[(int)MtrlgyClmn.ErrLimLo].Text, out tmp)) entity.ErrLimLo = tmp; if (Utils.TryParseSFloat(lvi.SubItems[(int)MtrlgyClmn.ErrLimHi].Text, out tmp)) entity.ErrLimHi = tmp; if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.TempLimLo].Text, out tmp)) entity.TempLimLo = tmp; if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.TempLimHi].Text, out tmp)) entity.TempLimHi = tmp; - - if (methodCBox.Items.Contains(lvi.SubItems[(int)MtrlgyClmn.Method].Text)) - { - entity.Method = lvi.SubItems[(int)MtrlgyClmn.Method].Text; - } + if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.PressLimLo].Text, out tmp)) entity.PressLimLo = tmp; + if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.PressLimHi].Text, out tmp)) entity.PressLimHi = tmp; } } - private void metrology1ListViewEx_SubItemClicked(object sender, SubItemEventArgs e) + private void metrologyListViewEx_SubItemClicked(object sender, SubItemEventArgs e) { -#if TEST_PROFILES - if (e.SubItem == (int)MtrlgyClmn.Qtg) return; -#endif - if (unlocked && (e.SubItem < (int)MtrlgyClmn.CoulumnsCount)) + if (e.SubItem == (int)MtrlgyClmn.Name) return; + if (unlocked && (e.SubItem < (int)MtrlgyClmn.ColumnsCount)) { - metrology1ListViewEx.StartEditing(metrology1Editors[e.SubItem], e.Item, e.SubItem); + metrologyListViewEx.StartEditing(metrologyEditors[e.SubItem], e.Item, e.SubItem); } } - void metrology1ListViewEx_SubItemRightClicked(object sender, SubItemEventArgs e) + void metrologyListViewEx_SubItemRightClicked(object sender, SubItemEventArgs e) { -#if TEST_PROFILES - if (e.SubItem == (int)MtrlgyClmn.Qtg) return; -#endif - if (!unlocked || e.SubItem >= (int)MtrlgyClmn.CoulumnsCount) return; + if (!unlocked || e.SubItem >= (int)MtrlgyClmn.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)) @@ -700,7 +293,7 @@ namespace TBF.UI.Bench.TestProfiles int columnNr = e.SubItem; string value = null; System.Drawing.Color backColor = System.Drawing.Color.White; - foreach (ListViewItem item in metrology1ListViewEx.Items) + foreach (ListViewItem item in metrologyListViewEx.Items) { if (value != null && item.SubItems.Count > columnNr) { @@ -716,7 +309,7 @@ namespace TBF.UI.Bench.TestProfiles } } - private void metrology1ListViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e) + private void metrologyListViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e) { if (e.SubItem == (int)MtrlgyClmn.Name) { @@ -728,811 +321,175 @@ namespace TBF.UI.Bench.TestProfiles } } - int dummy; - if (e.SubItem == (int)MtrlgyClmn.Part) - { - if (e.DisplayText.Equals("-")) return; /// OK - if (!int.TryParse(e.DisplayText, out dummy) || !Test.IsGoodPartNr(dummy)) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - return; /// NOK - } - } - -#if TEST_PROFILES float fdummy; - if ((e.SubItem == (int)MtrlgyClmn.Qtg) && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - return; - } -#endif - - if ((e.SubItem != (int)MtrlgyClmn.Qfrom) && - (e.SubItem != (int)MtrlgyClmn.Qto) && - (e.SubItem != (int)MtrlgyClmn.Volume) && - (e.SubItem != (int)MtrlgyClmn.TestTime)) - { - return; - } - float Qfrom = 1.0f; - float Qto = 1.0f; - float volume = 0.0f; - float testTime = 0.0f; - - bool calculateVolume = false; - bool calculateTime = false; - bool allOk = true; - - if ((e.SubItem == (int)MtrlgyClmn.Qfrom) && Utils.TryParseUFloat(e.DisplayText, out Qfrom)) - { - allOk &= Utils.TryParseUFloat(e.Item.SubItems[(int)MtrlgyClmn.Qto].Text, out Qto); - allOk &= Utils.TryParseUFloat(e.Item.SubItems[(int)MtrlgyClmn.Volume].Text, out volume); - if (allOk) calculateTime = true; - } - else if ((e.SubItem == (int)MtrlgyClmn.Qto) && Utils.TryParseUFloat(e.DisplayText, out Qto)) - { - allOk &= Utils.TryParseUFloat(e.Item.SubItems[(int)MtrlgyClmn.Qfrom].Text, out Qfrom); - allOk &= Utils.TryParseUFloat(e.Item.SubItems[(int)MtrlgyClmn.Volume].Text, out volume); - if (allOk) calculateTime = true; - } - else if ((e.SubItem == (int)MtrlgyClmn.Volume) && Utils.TryParseUFloat(e.DisplayText, out volume)) - { - allOk &= Utils.TryParseUFloat(e.Item.SubItems[(int)MtrlgyClmn.Qfrom].Text, out Qfrom); - allOk &= Utils.TryParseUFloat(e.Item.SubItems[(int)MtrlgyClmn.Qto].Text, out Qto); - if (allOk) calculateTime = true; - } - else if ((e.SubItem == (int)MtrlgyClmn.TestTime) && Utils.TryParseUFloat(e.DisplayText, out testTime)) - { - allOk &= Utils.TryParseUFloat(e.Item.SubItems[(int)MtrlgyClmn.Qfrom].Text, out Qfrom); - allOk &= Utils.TryParseUFloat(e.Item.SubItems[(int)MtrlgyClmn.Qto].Text, out Qto); - if (allOk) calculateVolume = true; - } - - float Qave_lps = (Qfrom + Qto) / 7.2f; - if (calculateTime) - { - testTime = volume / Qave_lps; - e.Item.SubItems[(int)MtrlgyClmn.TestTime].Text = testTime.ToString(); - } - else if (calculateVolume) - { - volume = testTime * Qave_lps; - e.Item.SubItems[(int)MtrlgyClmn.Volume].Text = volume.ToString(); - } - else - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - } - } - - #endregion - - #region Metrology2 - - public enum Mtrlgy2Clmn - { - Name, - Part, - Uncertainty, - Repeats, - ControlWaterTemp, - ShortPulses, - Publish, - Evaluate, - ColumnsCount - } - - Control[] metrology2Editors; - - void PrepareMetrology2Tab() - { - ListViewEx lv = metrology2ListViewEx; - 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 = Strings.Uncertainty_pct_chdr, Width = 90 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.Repeats_nr_chdr, Width = 90 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.Control_water_temp_chdr, Width = 110 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.Short_pulses, Width = 100 }); /// Strings.Tol_red_pct_chdr - lv.Columns.Add(new ColumnHeader { Text = Strings.Publish, Width = 100 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.Evaluate, Width = 100 }); - - ComboBox publishCBox = new ComboBox(); /// control for Publish - for (Config.Entities.Publish pb = 0; pb < Config.Entities.Publish.Count; pb++) - { - publishCBox.Items.Add(pb.ToDescription()); - } - - ComboBox yesNo2CBox = new ComboBox(); /// control for Control water temp. - yesNo2CBox.Items.Add(Strings.yes); - yesNo2CBox.Items.Add(Strings.no); - - ComboBox yesNo3CBox = new ComboBox(); /// control for Evaluate - yesNo3CBox.Items.Add(Strings.yes); - yesNo3CBox.Items.Add(Strings.no); - - metrology2Editors = new Control[] - { - new TextBox(), /// Name - new TextBox(), /// Part - new TextBox(), /// Uncertainty - new TextBox(), /// Repeats count - yesNo2CBox, /// Control water temp. - new TextBox(), /// Short pulses - publishCBox, /// Publish - yesNo3CBox, /// Evaluate - }; - - foreach (var ctrl in metrology2Editors) - { - metrology2TabPage.Controls.Add(ctrl); - } - } - - void RefreshMetrology2Tab() - { - metrology2ListViewEx.Items.Clear(); - foreach (var test in LoadedProcedure.Tests) AddToMetrology2Tab(test); - - if (0 <= SelectedTestIx && SelectedTestIx < metrology2ListViewEx.Items.Count) - { - metrology2ListViewEx.Items[SelectedTestIx].Selected = true; - } - } - - void AddToMetrology2Tab(Test test) - { - /// - /// Metrology 2 item with subitems - /// - ListViewItem lvi = new ListViewItem(test.Name); /// Name - lvi.Tag = test; - lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part - lvi.SubItems.Add(test.Uncertainty.ToString()); - lvi.SubItems.Add(test.Repeats.ToString()); - lvi.SubItems.Add(test.DoControlWaterTemp ? Strings.yes : Strings.no); - lvi.SubItems.Add(test.TolerRed.ToString()); - lvi.SubItems.Add(((Config.Entities.Publish)test.Publish).ToDescription()); - lvi.SubItems.Add(test.DoEvaluate ? Strings.yes : Strings.no); - - metrology2ListViewEx.Items.Add(lvi); - } - - void UpdateFromMetrology2Tab() - { - for (int i = 0; i < metrology2ListViewEx.Items.Count; i++) - { - try - { - ListViewItem lvi = metrology2ListViewEx.Items[i]; - Test entity = (Test)lvi.Tag; - entity.ItemNr = i; - entity.Name = lvi.SubItems[(int)Mtrlgy2Clmn.Name].Text; - entity.Part = lvi.SubItems[(int)Mtrlgy2Clmn.Part].Text.Equals("-") ? 0 : int.Parse(lvi.SubItems[(int)Mtrlgy2Clmn.Part].Text); - entity.Uncertainty = Utils.ParseUFloat(lvi.SubItems[(int)Mtrlgy2Clmn.Uncertainty].Text); - entity.Repeats = int.Parse(lvi.SubItems[(int)Mtrlgy2Clmn.Repeats].Text); - entity.DoControlWaterTemp = lvi.SubItems[(int)Mtrlgy2Clmn.ControlWaterTemp].Text.Equals(Strings.yes); - entity.TolerRed = (double)Utils.ParseUFloat(lvi.SubItems[(int)Mtrlgy2Clmn.ShortPulses].Text); - entity.DoEvaluate = lvi.SubItems[(int)Mtrlgy2Clmn.Evaluate].Text.Equals(Strings.yes); - - for (Config.Entities.Publish pb = 0; pb < Config.Entities.Publish.Count; pb++) - { - if (lvi.SubItems[(int)Mtrlgy2Clmn.Publish].Text.Equals(pb.ToDescription())) - { - entity.Publish = (sbyte)pb; - break; - } - } - } - catch (Exception exc) - { - MessageBox.Show(string.Format("Unexpected problem: {0}", exc.Message)); - } - } - } - - private void metrology2ListViewEx_SubItemClicked(object sender, SubItemEventArgs e) - { - if (!unlocked || e.SubItem >= (int)Mtrlgy2Clmn.ColumnsCount) - { - return; - } - - metrology2ListViewEx.StartEditing(metrology2Editors[e.SubItem], e.Item, e.SubItem); - } - - void metrology2ListViewEx_SubItemRightClicked(object sender, SubItemEventArgs e) - { - if (!unlocked || e.SubItem >= (int)Mtrlgy2Clmn.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 metrology2ListViewEx.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 metrology2ListViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e) - { - if (e.SubItem == (int)Mtrlgy2Clmn.Name) - { - if (!Utils.IsGoodFName(e.DisplayText)) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - return; - } - } - - int dummy; - if (e.SubItem == (int)Mtrlgy2Clmn.Part) - { - if (e.DisplayText.Equals("-")) return; /// OK - if (!int.TryParse(e.DisplayText, out dummy) || !Test.IsGoodPartNr(dummy)) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - return; /// NOK - } - } - - if ((e.SubItem == (int)Mtrlgy2Clmn.Repeats) && !int.TryParse(e.DisplayText, out dummy)) + if ((e.SubItem == (int)MtrlgyClmn.CoefQfrom && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) || + (e.SubItem == (int)MtrlgyClmn.CoefQto && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) || + (e.SubItem == (int)MtrlgyClmn.ErrLimLo && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) || + (e.SubItem == (int)MtrlgyClmn.ErrLimHi && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) || + (e.SubItem == (int)MtrlgyClmn.TempLimLo && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) || + (e.SubItem == (int)MtrlgyClmn.TempLimHi && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) || + (e.SubItem == (int)MtrlgyClmn.PressLimLo && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) || + (e.SubItem == (int)MtrlgyClmn.PressLimHi && !Utils.TryParseUFloat(e.DisplayText, out fdummy))) { + /// Cannot parse => revert content of the cell e.DisplayText = e.Item.SubItems[e.SubItem].Text; e.Cancel = true; return; } - - float fdummy; - if ((e.SubItem == (int)Mtrlgy2Clmn.ShortPulses) && !Utils.TryParseUFloat(e.DisplayText, out fdummy)) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - return; - } - - - /// Combo boxes - if ((e.SubItem == (int)Mtrlgy2Clmn.ControlWaterTemp) || (e.SubItem == (int)Mtrlgy2Clmn.Publish) || (e.SubItem == (int)Mtrlgy2Clmn.Evaluate)) - { - if (!(metrology2Editors[e.SubItem] as ComboBox).Items.Contains(e.DisplayText)) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - return; - } - } } #endregion - #region Process + #region Error flags - public enum ProcessClmn + public enum ErrorFlagsClmn { Name, - Part, - DrainingBefore, - DrainingAfter, - Feeding, - Bench, - Output, - Sensor, -#if HEAT_METERS - HeatMeterSensors, -#endif - TrnStart, - TrnBetween, - TrnStop, + E1, + E2, + E3, + E4, + E5, + E6, + E7, + E8, + E9, + E10, + E11, + E12, + E13, + E14, + E15, + E16, + E21, ColumnsCount } - Control[] processEditors; + Control[] errorFlagsEditors; - void PrepareProcess() - { - ListViewEx lv = processListViewEx; - 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 = Strings.Draining_before, Width = 90 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.Draining_after, Width = 90 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.Feeding_chdr, Width = 80 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.Bench_chdr, Width = 80 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.Output_chdr, Width = 80 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.Sensors_chdr, Width = 80 }); -#if HEAT_METERS - lv.Columns.Add(new ColumnHeader { Text = Strings.Heat_meter_sensors, Width = 110 }); -#endif - lv.Columns.Add(new ColumnHeader { Text = Strings.TransitionStart_chdr, Width = 100 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.TransitionBetween_chdr, Width = 100 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.TransitionEnd_chdr, Width = 100 }); - - ComboBox yesNo1CBox = new ComboBox(); /// control for Draining before test - yesNo1CBox.Items.Add(Strings.yes); - yesNo1CBox.Items.Add(Strings.no); - - ComboBox yesNo2CBox = new ComboBox(); /// control for Draining after test - yesNo2CBox.Items.Add(Strings.yes); - yesNo2CBox.Items.Add(Strings.no); - - processEditors = new Control[] - { - new TextBox(), /// Name - new TextBox(), /// Part - yesNo1CBox, - yesNo2CBox, - new ComboBox(), /// Feeding - new ComboBox(), /// Table - new ComboBox(), /// Output - new ComboBox(), /// Meters -#if HEAT_METERS - new ComboBox(), /// Heat meters -#endif - new ComboBox(), /// Transition-Start - new ComboBox(), /// Transition-Between - new ComboBox(), /// Transition-End - }; - - foreach (var path in feedingPaths) ((ComboBox)processEditors[(int)ProcessClmn.Feeding]).Items.Add(path.Name); - foreach (var path in benchPaths) ((ComboBox)processEditors[(int)ProcessClmn.Bench]).Items.Add(path.Name); - foreach (var path in outputPaths) ((ComboBox)processEditors[(int)ProcessClmn.Output]).Items.Add(path.Name); - foreach (var path in metersPaths) ((ComboBox)processEditors[(int)ProcessClmn.Sensor]).Items.Add(path.Name); -#if HEAT_METERS - foreach (var path in heatMetersPaths) ((ComboBox)processEditors[(int)ProcessClmn.HeatMeterSensors]).Items.Add(path.Name); -#endif - - ((ComboBox)processEditors[(int)ProcessClmn.TrnStart]).Items.Add("---"); - ((ComboBox)processEditors[(int)ProcessClmn.TrnBetween]).Items.Add("---"); - ((ComboBox)processEditors[(int)ProcessClmn.TrnStop]).Items.Add("---"); - foreach (var trans in transitionSequences) - { - ((ComboBox)processEditors[(int)ProcessClmn.TrnStart]).Items.Add(trans.Name); - ((ComboBox)processEditors[(int)ProcessClmn.TrnBetween]).Items.Add(trans.Name); - ((ComboBox)processEditors[(int)ProcessClmn.TrnStop]).Items.Add(trans.Name); - } - - foreach (var ctrl in processEditors) - { - processTabPage.Controls.Add(ctrl); - } - } - - void RefreshProcessTab() - { - processListViewEx.Items.Clear(); - foreach (var test in LoadedProcedure.Tests) AddToProcessTab(test); - - if (0 <= SelectedTestIx && SelectedTestIx < processListViewEx.Items.Count) - { - processListViewEx.Items[SelectedTestIx].Selected = true; - } - } - - void AddToProcessTab(Test test) - { - ITestMethod tm = TBF.BenchControl.TbfComponents.FindComponent(test.Method, TbfComponents) as ITestMethod; - - /// - /// Process item with subitems - /// - ListViewItem lvi = new ListViewItem(test.Name); /// Name - lvi.Tag = test; - lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part - - if (tm != null && tm.DoTransitions()) - { - lvi.SubItems.Add(test.DoDraining ? Strings.yes : Strings.no); /// Draining before test - lvi.SubItems.Add(test.DoDrainingAfter ? Strings.yes : Strings.no); /// Draining after test - lvi.SubItems.Add(test.FeedingPath); - lvi.SubItems.Add(test.BenchPath); - lvi.SubItems.Add(test.OutputPath); -#if HEAT_METERS - lvi.SubItems.Add(test.HeatMetersPath); -#endif - lvi.SubItems.Add(test.MetersPath); - lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBefore) ? "---" : test.RelTransBefore); - lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBetween) ? "---" : test.RelTransBetween); - lvi.SubItems.Add(string.IsNullOrEmpty(test.TransitionAfter) ? "---" : test.TransitionAfter); - } - else - { - lvi.SubItems.Add(string.Empty); /// Draining before test N/A - lvi.SubItems.Add(string.Empty); /// Draining after test N/A - lvi.SubItems.Add(string.Empty); /// FeedingPath N/A - lvi.SubItems.Add(string.Empty); /// BenchPath N/A - lvi.SubItems.Add(string.Empty); /// OutputPath N/A -#if HEAT_METERS - lvi.SubItems.Add(test.HeatMetersPath); -#endif - lvi.SubItems.Add(test.MetersPath); - lvi.SubItems.Add(string.Empty); /// RelTransBefore N/A - lvi.SubItems.Add(string.Empty); /// RelTransBetween N/A - lvi.SubItems.Add(string.Empty); /// TransitionAfter N/A - } - - processListViewEx.Items.Add(lvi); - } - - void UpdateFromProcessTab() - { - for (int i = 0; i < processListViewEx.Items.Count; i++) - { - ListViewItem lvi = processListViewEx.Items[i]; - Test entity = (Test)lvi.Tag; - - entity.Name = lvi.Text; - entity.ItemNr = i; - - int part = entity.Part; - if (lvi.SubItems[(int)ProcessClmn.Part].Text.Equals("-")) - { - entity.Part = 0; - } - else if (int.TryParse(lvi.SubItems[(int)ProcessClmn.Part].Text, out part)) - { - entity.Part = part; - } - - entity.DoDraining = lvi.SubItems[(int)ProcessClmn.DrainingBefore].Text.Equals(Strings.yes); - entity.DoDrainingAfter = lvi.SubItems[(int)ProcessClmn.DrainingAfter].Text.Equals(Strings.yes); - - int column = (int)ProcessClmn.Feeding; - string subItemText = lvi.SubItems[column].Text; - if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText)) - { - entity.FeedingPath = subItemText; - } - - column = (int)ProcessClmn.Bench; - subItemText = lvi.SubItems[column].Text; - if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText)) - { - entity.BenchPath = subItemText; - } - - column = (int)ProcessClmn.Output; - subItemText = lvi.SubItems[column].Text; - if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText)) - { - entity.OutputPath = subItemText; - } - - column = (int)ProcessClmn.Sensor; - subItemText = lvi.SubItems[column].Text; - if ((processEditors[column] as ComboBox).Items.Contains(subItemText)) - { - entity.MetersPath = subItemText; - } -#if HEAT_METERS - if ((processEditors[(int)ProcessClmn.HeatMeterSensors] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.HeatMeterSensors].Text)) - { - entity.HeatMetersPath = lvi.SubItems[(int)ProcessClmn.HeatMeterSensors].Text; - } -#endif - column = (int)ProcessClmn.TrnStart; - subItemText = lvi.SubItems[column].Text; - if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText)) - { - entity.RelTransBefore = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText; - } - - column = (int)ProcessClmn.TrnBetween; - subItemText = lvi.SubItems[column].Text; - if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText)) - { - entity.RelTransBetween = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText; - } - - column = (int)ProcessClmn.TrnStop; - subItemText = lvi.SubItems[column].Text; - if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText)) - { - entity.TransitionAfter = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText; - } - } - } - - private void processListViewEx_SubItemClicked(object sender, SubItemEventArgs e) - { - if (!unlocked || e.SubItem >= (int)ProcessClmn.ColumnsCount) - { - return; - } - - ITestMethod tm = TBF.BenchControl.TbfComponents.FindComponent((e.Item.Tag as Test).Method, TbfComponents) as ITestMethod; - - if (tm != null && (tm.DoTransitions() == false) && ((e.SubItem == (int)ProcessClmn.DrainingBefore) || - (e.SubItem == (int)ProcessClmn.DrainingAfter) || - (e.SubItem == (int)ProcessClmn.Feeding) || - (e.SubItem == (int)ProcessClmn.Bench) || - (e.SubItem == (int)ProcessClmn.Output) || - (e.SubItem == (int)ProcessClmn.TrnStart) || - (e.SubItem == (int)ProcessClmn.TrnBetween) || - (e.SubItem == (int)ProcessClmn.TrnStop))) - { - return; - } - - processListViewEx.StartEditing(processEditors[e.SubItem], e.Item, e.SubItem); - } - - void processListViewEx_SubItemRightClicked(object sender, SubItemEventArgs e) - { - if (!unlocked || e.SubItem >= (int)ProcessClmn.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 processListViewEx.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 processListViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e) - { - if (e.SubItem == (int)ProcessClmn.Name) - { - if (!Utils.IsGoodFName(e.DisplayText)) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - return; /// NOK - } - } - - int dummy; - if (e.SubItem == (int)ProcessClmn.Part) - { - if (e.DisplayText.Equals("-")) return; /// OK - if (!int.TryParse(e.DisplayText, out dummy) || !Test.IsGoodPartNr(dummy)) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - return; /// NOK - } - } - - if ((e.SubItem == (int)ProcessClmn.DrainingBefore) && !(processEditors[(int)ProcessClmn.DrainingBefore] as ComboBox).Items.Contains(e.DisplayText)) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - return; /// NOK - } - - if ((e.SubItem == (int)ProcessClmn.DrainingAfter) && !(processEditors[(int)ProcessClmn.DrainingAfter] as ComboBox).Items.Contains(e.DisplayText)) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - return; /// NOK - } - - if (((e.SubItem == (int)ProcessClmn.Feeding) && !(processEditors[(int)ProcessClmn.Feeding] as ComboBox).Items.Contains(e.DisplayText)) || - ((e.SubItem == (int)ProcessClmn.Bench) && !(processEditors[(int)ProcessClmn.Bench] as ComboBox).Items.Contains(e.DisplayText)) || - ((e.SubItem == (int)ProcessClmn.Output) && !(processEditors[(int)ProcessClmn.Output] as ComboBox).Items.Contains(e.DisplayText)) || - ((e.SubItem == (int)ProcessClmn.Sensor) && !(processEditors[(int)ProcessClmn.Sensor] as ComboBox).Items.Contains(e.DisplayText)) || - ((e.SubItem == (int)ProcessClmn.TrnStart) && !(processEditors[(int)ProcessClmn.TrnStart] as ComboBox).Items.Contains(e.DisplayText)) || - ((e.SubItem == (int)ProcessClmn.TrnBetween) && !(processEditors[(int)ProcessClmn.TrnBetween] as ComboBox).Items.Contains(e.DisplayText)) || - ((e.SubItem == (int)ProcessClmn.TrnStop) && !(processEditors[(int)ProcessClmn.TrnStop] as ComboBox).Items.Contains(e.DisplayText))) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - } - } - - #endregion - - #region Parameters - - public enum ParametersClmn + void PrepareErrorFlags() { - Name, - Part, - PumpPower, - MassRepeats, -#if STABLE_MASS_EXTRAS - MassSpread, - MassMethod, -#endif - Time_Pump2StartV, - Time_BeforeFlow, - Time_Flow2Mass, - Time_Stop2Mass, - ColumnsCount - } + ListViewEx lv = errorFlagsListViewEx; + errorFlagsEditors = new Control[(int)ErrorFlagsClmn.ColumnsCount]; + int ix = 0; - Control[] parametersEditors; - - void PrepareParameters() - { - ListViewEx lv = parametersListViewEx; 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 = Strings.Pump_power_pct, Width = 90 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.Mass_repeats, Width = 90 }); -#if STABLE_MASS_EXTRAS - lv.Columns.Add(new ColumnHeader { Text = Strings.Mass_spread_kg, Width = 110 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.Mass_method, Width = 90 }); -#endif - lv.Columns.Add(new ColumnHeader { Text = Strings.TimePump2StartV_chdr, Width = 70 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.TimeBeforeSettingFlow, Width = 70 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.TimeFlow2Start_chdr, Width = 70 }); - lv.Columns.Add(new ColumnHeader { Text = Strings.Time2MassMsrmt_chdr, Width = 70 }); + errorFlagsEditors[ix++] = new TextBox(); /// Name - parametersEditors = new Control[] - { - new TextBox(), /// Name - new TextBox(), /// Part - new ComboBox(), /// PumpPower - new TextBox(), /// MassRepeats -#if STABLE_MASS_EXTRAS - new TextBox(), /// MassSpread - new ComboBox(), /// MassMethod -#endif - new TextBox(), /// Time_Pump2StartV - new TextBox(), /// Time_BeforeFlow - new TextBox(), /// Time_Flow2Mass - new TextBox(), /// Time_Stop2Mass - }; + string[] ecka = new string[] { "E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8", "E9", "E10", "E11", "E12", "E13", "E14", "E15", "E16", "E21" }; + for (var e = ErrorFlagsClmn.E1; e <= ErrorFlagsClmn.E21; e++) + { + /// Column header + lv.Columns.Add(new ColumnHeader { Text = e.ToString(), Width = 50 }); - ((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("0"); - ((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("30"); - ((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("40"); - ((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("50"); - ((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("60"); - ((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("70"); - ((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("75"); - ((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("80"); - ((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("85"); - ((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("90"); - ((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("92"); - ((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("94"); - ((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("96"); - ((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("98"); - ((ComboBox)parametersEditors[(int)ParametersClmn.PumpPower]).Items.Add("100"); -#if STABLE_MASS_EXTRAS - for (MassMethod mm = 0; mm < MassMethod.Count; mm++) - { - ((ComboBox)parametersEditors[(int)ParametersClmn.MassMethod]).Items.Add(mm.ToDescription()); - } -#endif - foreach (var ctrl in parametersEditors) - { - parametersTabPage.Controls.Add(ctrl); - } + /// Edit control + ComboBox cb = new ComboBox(); + for (ErrorFlagsMode efm = 0; efm < ErrorFlagsMode.Count; efm++) cb.Items.Add(efm.ToDescription()); + errorFlagsEditors[ix++] = cb; + } + + //lv.Columns.Add(new ColumnHeader { Text = Strings.Mass_repeats, Width = 90 }); + //lv.Columns.Add(new ColumnHeader { Text = Strings.Mass_spread_kg, Width = 110 }); + //lv.Columns.Add(new ColumnHeader { Text = Strings.Mass_method, Width = 90 }); + //lv.Columns.Add(new ColumnHeader { Text = Strings.TimePump2StartV_chdr, Width = 70 }); + //lv.Columns.Add(new ColumnHeader { Text = Strings.TimeBeforeSettingFlow, Width = 70 }); + //lv.Columns.Add(new ColumnHeader { Text = Strings.TimeFlow2Start_chdr, Width = 70 }); + //lv.Columns.Add(new ColumnHeader { Text = Strings.Time2MassMsrmt_chdr, Width = 70 }); + + foreach (var ctrl in errorFlagsEditors) parametersTabPage.Controls.Add(ctrl); } - void RefreshParametersTab() + void RefreshErrorFlagsTab() { - parametersListViewEx.Items.Clear(); - foreach (var test in LoadedProcedure.Tests) AddToParametersTab(test); + errorFlagsListViewEx.Items.Clear(); + foreach (var test in LoadedProfile.Tests) AddToErrorFlagsTab(test); - if (0 <= SelectedTestIx && SelectedTestIx < parametersListViewEx.Items.Count) + if (0 <= SelectedTestIx && SelectedTestIx < errorFlagsListViewEx.Items.Count) { - parametersListViewEx.Items[SelectedTestIx].Selected = true; + errorFlagsListViewEx.Items[SelectedTestIx].Selected = true; } } - void AddToParametersTab(Test test) + void AddToErrorFlagsTab(PTest test) { /// /// Parameters item with subitems /// ListViewItem lvi = new ListViewItem(test.Name); /// Name lvi.Tag = test; - lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// - lvi.SubItems.Add(test.PumpPower.ToString("F1")); - lvi.SubItems.Add((test.MassRepeats < 4 ? 5 : test.MassRepeats).ToString()); -#if STABLE_MASS_EXTRAS - lvi.SubItems.Add(test.MassSpread.ToString("F4")); - lvi.SubItems.Add(test.MassMethod.ToDescription()); -#endif - lvi.SubItems.Add(test.TimePump2StartV.ToString()); - lvi.SubItems.Add(test.TimeBeforeFlow.ToString()); - lvi.SubItems.Add(test.TimeFlow2Mass.ToString()); - lvi.SubItems.Add(test.TimeStop2Mass.ToString()); + lvi.SubItems.Add(SByte2String(test.E1)); + lvi.SubItems.Add(SByte2String(test.E2)); + lvi.SubItems.Add(SByte2String(test.E3)); + lvi.SubItems.Add(SByte2String(test.E4)); + lvi.SubItems.Add(SByte2String(test.E5)); + lvi.SubItems.Add(SByte2String(test.E6)); + lvi.SubItems.Add(SByte2String(test.E7)); + lvi.SubItems.Add(SByte2String(test.E8)); + lvi.SubItems.Add(SByte2String(test.E9)); + lvi.SubItems.Add(SByte2String(test.E10)); + lvi.SubItems.Add(SByte2String(test.E11)); + lvi.SubItems.Add(SByte2String(test.E12)); + lvi.SubItems.Add(SByte2String(test.E13)); + lvi.SubItems.Add(SByte2String(test.E14)); + lvi.SubItems.Add(SByte2String(test.E15)); + lvi.SubItems.Add(SByte2String(test.E16)); + lvi.SubItems.Add(SByte2String(test.E21)); - parametersListViewEx.Items.Add(lvi); + //lvi.SubItems.Add(test.PumpPower.ToString("F1")); + //lvi.SubItems.Add((test.MassRepeats < 4 ? 5 : test.MassRepeats).ToString()); + //lvi.SubItems.Add(test.MassSpread.ToString("F4")); + //lvi.SubItems.Add(test.MassMethod.ToDescription()); + //lvi.SubItems.Add(test.TimePump2StartV.ToString()); + //lvi.SubItems.Add(test.TimeBeforeFlow.ToString()); + //lvi.SubItems.Add(test.TimeFlow2Mass.ToString()); + //lvi.SubItems.Add(test.TimeStop2Mass.ToString()); + + errorFlagsListViewEx.Items.Add(lvi); } - void UpdateFromParametersTab() + void UpdateFromErrorFlagsTab() { - for (int i = 0; i < parametersListViewEx.Items.Count; i++) + for (int i = 0; i < errorFlagsListViewEx.Items.Count; i++) { - ListViewItem lvi = parametersListViewEx.Items[i]; - Test entity = (Test)lvi.Tag; + ListViewItem lvi = errorFlagsListViewEx.Items[i]; + PTest entity = (PTest)lvi.Tag; entity.Name = lvi.Text; entity.ItemNr = i; - int part = entity.Part; - if (lvi.SubItems[(int)ParametersClmn.Part].Text.Equals("-")) - { - entity.Part = 0; - } - else if (int.TryParse(lvi.SubItems[(int)ParametersClmn.Part].Text, out part)) - { - entity.Part = part; - } - - float powerPct; - if (Utils.TryParseUFloat(lvi.SubItems[(int)ParametersClmn.PumpPower].Text, out powerPct) && powerPct >= 0 && powerPct <= 100.0f) - { - entity.PumpPower = powerPct; - } - - entity.MassRepeats = int.Parse(lvi.SubItems[(int)ParametersClmn.MassRepeats].Text); - -#if STABLE_MASS_EXTRAS - float massSpread; - if (Utils.TryParseUFloat(lvi.SubItems[(int)ParametersClmn.MassSpread].Text, out massSpread) && massSpread >= 0) - { - entity.MassSpread = massSpread; - } - - for (MassMethod mm = 0; mm < MassMethod.Count; mm++) - { - if (mm.ToDescription().Equals(lvi.SubItems[(int)ParametersClmn.MassMethod].Text)) entity.MassMethod = mm; - } -#endif - int itmp; - if (int.TryParse(lvi.SubItems[(int)ParametersClmn.Time_Pump2StartV].Text, out itmp)) entity.TimePump2StartV = itmp; - if (int.TryParse(lvi.SubItems[(int)ParametersClmn.Time_BeforeFlow].Text, out itmp)) entity.TimeBeforeFlow = itmp; - if (int.TryParse(lvi.SubItems[(int)ParametersClmn.Time_Flow2Mass].Text, out itmp)) entity.TimeFlow2Mass = itmp; - if (int.TryParse(lvi.SubItems[(int)ParametersClmn.Time_Stop2Mass].Text, out itmp)) entity.TimeStop2Mass = itmp; + entity.E1 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E1].Text); + entity.E2 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E2].Text); + entity.E3 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E3].Text); + entity.E4 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E4].Text); + entity.E5 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E5].Text); + entity.E6 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E6].Text); + entity.E7 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E7].Text); + entity.E8 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E8].Text); + entity.E9 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E9].Text); + entity.E10 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E10].Text); + entity.E11 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E11].Text); + entity.E12 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E12].Text); + entity.E13 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E13].Text); + entity.E14 = String2SByte(lvi.SubItems[(int)ErrorFlagsClmn.E14].Text); + 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 parametersListViewEx_SubItemClicked(object sender, SubItemEventArgs e) + private void errorFlagsListViewEx_SubItemClicked(object sender, SubItemEventArgs e) { - if (!unlocked || e.SubItem >= (int)ParametersClmn.ColumnsCount) + if (!unlocked || e.SubItem >= (int)ErrorFlagsClmn.ColumnsCount) { return; } - parametersListViewEx.StartEditing(parametersEditors[e.SubItem], e.Item, e.SubItem); + errorFlagsListViewEx.StartEditing(errorFlagsEditors[e.SubItem], e.Item, e.SubItem); } - void parametersListViewEx_SubItemRightClicked(object sender, SubItemEventArgs e) + void errorFlagsListViewEx_SubItemRightClicked(object sender, SubItemEventArgs e) { - if (!unlocked || e.SubItem >= (int)ParametersClmn.ColumnsCount) + if (!unlocked || e.SubItem >= (int)ErrorFlagsClmn.ColumnsCount) { return; } @@ -1543,7 +500,7 @@ namespace TBF.UI.Bench.TestProfiles int columnNr = e.SubItem; string value = null; System.Drawing.Color backColor = System.Drawing.Color.White; - foreach (ListViewItem item in parametersListViewEx.Items) + foreach (ListViewItem item in errorFlagsListViewEx.Items) { if (value != null && item.SubItems.Count > columnNr) { @@ -1559,9 +516,9 @@ namespace TBF.UI.Bench.TestProfiles } } - private void parametersListViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e) + private void errorFlagsListViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e) { - if (e.SubItem == (int)ParametersClmn.Name) + if (e.SubItem == (int)ErrorFlagsClmn.Name) { if (!Utils.IsGoodFName(e.DisplayText)) { @@ -1571,100 +528,22 @@ namespace TBF.UI.Bench.TestProfiles } } - int dummy; - if (e.SubItem == (int)ParametersClmn.Part) - { - if (e.DisplayText.Equals("-")) return; /// OK - if (!int.TryParse(e.DisplayText, out dummy) || !Test.IsGoodPartNr(dummy)) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - return; /// NOK - } - } - - float powerPct; - if ((e.SubItem == (int)ParametersClmn.PumpPower) && - (!Utils.TryParseUFloat(e.DisplayText, out powerPct) || powerPct < 0 || powerPct > 100.0f)) + sbyte dummy; + if ((e.SubItem >= (int)ErrorFlagsClmn.E1) && (e.SubItem <= (int)ErrorFlagsClmn.E21) && !IsValidEFlagsMode(e.DisplayText, out dummy)) { e.DisplayText = e.Item.SubItems[e.SubItem].Text; e.Cancel = true; + return; /// NOK } - - int itmp; - if ((e.SubItem == (int)ParametersClmn.Time_Pump2StartV) && - (!int.TryParse(e.DisplayText, out itmp) || itmp < 0 || itmp > 300)) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - } - if ((e.SubItem == (int)ParametersClmn.Time_BeforeFlow) && - (!int.TryParse(e.DisplayText, out itmp) || itmp < 0 || itmp > 300)) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - } - if ((e.SubItem == (int)ParametersClmn.Time_Flow2Mass) && - (!int.TryParse(e.DisplayText, out itmp) || itmp < 0 || itmp > 300)) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - } - if ((e.SubItem == (int)ParametersClmn.Time_Stop2Mass) && - (!int.TryParse(e.DisplayText, out itmp) || itmp < 0 || itmp > 300)) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - } - if ((e.SubItem == (int)ParametersClmn.MassRepeats) && - (!int.TryParse(e.DisplayText, out itmp) || itmp < 4 || itmp > 100)) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - } - -#if STABLE_MASS_EXTRAS - if ((e.SubItem == (int)ParametersClmn.MassSpread) && !Utils.TryParseUFloat(e.DisplayText, out powerPct)) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - } - - if (e.SubItem == (int)ParametersClmn.MassMethod) - { - bool mmIsOk = false; - for (MassMethod mm = 0; mm < MassMethod.Count; mm++) - { - if (mm.ToDescription().Equals(e.DisplayText)) - { - mmIsOk = true; - break; - } - } - if (!mmIsOk) - { - e.DisplayText = e.Item.SubItems[e.SubItem].Text; - e.Cancel = true; - } - } -#endif } #endregion - void RefreshMetrology12AndProcessTabs() + void RefreshMetrologyAndErrorFlagsTabs() { - RefreshMetrology1Tab(); - RefreshMetrology2Tab(); - RefreshProcessTab(); - RefreshParametersTab(); - } - - void RefreshOtherTabs() - { - //foreach (var ctrl in testParamsCtrls) ctrl.RedrawAll(); - //foreach (var ctrl in procedureParamsCtrls) ctrl.RedrawAll(); + RefreshMetrologyTab(); + RefreshErrorFlagsTab(); } @@ -1676,49 +555,20 @@ namespace TBF.UI.Bench.TestProfiles procNameTextBox.Enabled = true; descriptionTextBox.Enabled = true; - watermetersTextBox.Enabled = true; - protectedCheckBox.Enabled = Users.GlobalData.CurrentUser.IsMemberOf(Users.Grp.GID.Metrologists); - mustBeCompleteCheckBox.Enabled = true; - manualControlDisabledCheckBox.Enabled = true; - dataEntryComboBox.Enabled = true; - metersKindRadioButton1.Enabled = true; - metersKindRadioButton2.Enabled = true; - altProcNameTextBox.Enabled = true; - altProcPeriodTextBox.Enabled = true; + profileTypeRadioButton1.Enabled = true; + profileTypeRadioButton2.Enabled = true; #if HEAT_METERS metersKindRadioButton3.Enabled = true; #endif - printer1ComboBox.Enabled = true; - printer2ComboBox.Enabled = true; - fileWriter1ComboBox.Enabled = true; - fileWriter2ComboBox.Enabled = true; - fileWriter3ComboBox.Enabled = true; - fileWriter4ComboBox.Enabled = true; - transitionStartComboBox.Enabled = true; - transitionEndComboBox.Enabled = true; - notesTextBox.Enabled = true; - - ListViewEx listViewEx; + ListViewEx listViewEx = null; switch (selectedTab) { - case ProcedureTabs.Metrology1: - listViewEx = metrology1ListViewEx; - break; - case ProcedureTabs.Metrology2: - listViewEx = metrology2ListViewEx; - break; - case ProcedureTabs.Process: - listViewEx = processListViewEx; - break; - case ProcedureTabs.Parameters: - listViewEx = parametersListViewEx; - break; - default: - return; + case TestProfileTabs.Metrology: listViewEx = metrologyListViewEx; break; + case TestProfileTabs.ErrorFlags: listViewEx = errorFlagsListViewEx; break; } - if (listViewEx.SelectedItems.Count == 1) + if ((listViewEx != null) && (listViewEx.SelectedItems.Count == 1)) { int ix = listViewEx.SelectedIndices[0]; listViewEx.Focus(); @@ -1731,19 +581,17 @@ namespace TBF.UI.Bench.TestProfiles { switch (selectedTab) { - case ProcedureTabs.General: UpdateFromGeneralTab(); break; - case ProcedureTabs.Metrology1: UpdateFromMetrology1Tab(); break; - case ProcedureTabs.Metrology2: UpdateFromMetrology2Tab(); break; - case ProcedureTabs.Process: UpdateFromProcessTab(); break; - case ProcedureTabs.Parameters: UpdateFromParametersTab(); break; + case TestProfileTabs.General: UpdateFromGeneralTab(); break; + case TestProfileTabs.Metrology: UpdateFromMetrologyTab(); break; + case TestProfileTabs.ErrorFlags: UpdateFromErrorFlagsTab(); 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(LoadedProcedure.Name)) + if (usedNames != null && usedNames.Contains(LoadedProfile.Name)) { - MessageBox.Show(string.Format("There is already a procedure named '{0}'.{1}Choose another name please.", LoadedProcedure.Name, Environment.NewLine), + 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); @@ -1803,46 +651,35 @@ namespace TBF.UI.Bench.TestProfiles #region Tab switching - enum ProcedureTabs + enum TestProfileTabs { General, - History, - Metrology1, - Metrology2, - Process, - Parameters, + Metrology, + ErrorFlags, } - ProcedureTabs selectedTab = ProcedureTabs.General; + TestProfileTabs selectedTab = TestProfileTabs.General; private void tabControl_SelectedIndexChanged(object sender, EventArgs e) { switch (selectedTab) { - case ProcedureTabs.General: + case TestProfileTabs.General: UpdateFromGeneralTab(); break; - case ProcedureTabs.Metrology1: - UpdateFromMetrology1Tab(); + case TestProfileTabs.Metrology: + UpdateFromMetrologyTab(); break; - case ProcedureTabs.Metrology2: - UpdateFromMetrology2Tab(); - break; - case ProcedureTabs.Process: - UpdateFromProcessTab(); - break; - case ProcedureTabs.Parameters: - UpdateFromParametersTab(); + case TestProfileTabs.ErrorFlags: + UpdateFromErrorFlagsTab(); break; } - selectedTab = (ProcedureTabs)tabControl.SelectedIndex; - bool isMetr12ProcOrParams = selectedTab == ProcedureTabs.Metrology1 || - selectedTab == ProcedureTabs.Metrology2 || - selectedTab == ProcedureTabs.Process || - selectedTab == ProcedureTabs.Parameters; + selectedTab = (TestProfileTabs)tabControl.SelectedIndex; + bool isMetrologyOrErrorFlags = selectedTab == TestProfileTabs.Metrology || + selectedTab == TestProfileTabs.ErrorFlags; - if (isMetr12ProcOrParams) + if (isMetrologyOrErrorFlags) { sharedButtons.EnableButtons(SharedButtons.Buttons.Add); } @@ -1851,9 +688,7 @@ namespace TBF.UI.Bench.TestProfiles sharedButtons.DisableButtons(SharedButtons.Buttons.Add); } - //bool removeBtnEnabled = (selectedTab != ProcedureTabs.General && - // selectedTab != ProcedureTabs.History && - // selectedTab != ProcedureTabs.Calibration); + //bool removeBtnEnabled = (selectedTab != TestProfileTabs.General); sharedButtons.DisableButtons(SharedButtons.Buttons.Remove); @@ -1861,28 +696,18 @@ namespace TBF.UI.Bench.TestProfiles /// switch (selectedTab) { - case ProcedureTabs.General: + case TestProfileTabs.General: RefreshGeneralTab(); break; - case ProcedureTabs.Metrology1: - RefreshMetrology1Tab(); - lv = metrology1ListViewEx; /// ListVIewEx for test selection + case TestProfileTabs.Metrology: + RefreshMetrologyTab(); + lv = metrologyListViewEx; /// ListVIewEx for test selection break; - case ProcedureTabs.Metrology2: - RefreshMetrology2Tab(); - lv = metrology2ListViewEx; /// ListVIewEx for test selection - break; - - case ProcedureTabs.Process: - RefreshProcessTab(); - lv = processListViewEx; /// ListVIewEx for test selection - break; - - case ProcedureTabs.Parameters: - RefreshParametersTab(); - lv = parametersListViewEx; /// ListVIewEx for test selection + case TestProfileTabs.ErrorFlags: + RefreshErrorFlagsTab(); + lv = errorFlagsListViewEx; /// ListVIewEx for test selection break; default: @@ -1893,7 +718,7 @@ namespace TBF.UI.Bench.TestProfiles /// /// Highlight the selected test /// - if (lv != null && 0 <= SelectedTestIx && SelectedTestIx < lv.Items.Count) + if ((lv != null) && (0 <= SelectedTestIx) && (SelectedTestIx < lv.Items.Count)) { lv.Focus(); lv.Items[SelectedTestIx].Selected = true; @@ -1915,39 +740,30 @@ namespace TBF.UI.Bench.TestProfiles switch (selectedTab) { - case ProcedureTabs.Metrology1: - UpdateFromMetrology1Tab(); - listViewEx = metrology1ListViewEx; + case TestProfileTabs.Metrology: + UpdateFromMetrologyTab(); + listViewEx = metrologyListViewEx; break; - case ProcedureTabs.Metrology2: - UpdateFromMetrology2Tab(); - listViewEx = metrology2ListViewEx; - break; - - case ProcedureTabs.Process: - UpdateFromProcessTab(); - listViewEx = processListViewEx; - break; - - case ProcedureTabs.Parameters: - UpdateFromParametersTab(); - listViewEx = parametersListViewEx; + case TestProfileTabs.ErrorFlags: + UpdateFromErrorFlagsTab(); + listViewEx = errorFlagsListViewEx; break; default: return; } /// Check the selected index validity - if (listViewEx.SelectedItems.Count != 1) return; + if (listViewEx.SelectedItems.Count != 1) return; + int removeItemNr = listViewEx.SelectedIndices[0]; /// Remove the selected test - Test toBeDeleted = LoadedProcedure.Tests[removeItemNr]; - LoadedProcedure.Tests.Remove(toBeDeleted); - for (int i = removeItemNr; i < LoadedProcedure.Tests.Count; i++) LoadedProcedure.Tests[i].ItemNr--; + PTest toBeDeleted = LoadedProfile.Tests[removeItemNr]; + LoadedProfile.Tests.Remove(toBeDeleted); + for (int i = removeItemNr; i < LoadedProfile.Tests.Count; i++) LoadedProfile.Tests[i].ItemNr--; - RefreshMetrology12AndProcessTabs(); + RefreshMetrologyAndErrorFlagsTabs(); if (removeItemNr < listViewEx.Items.Count) { @@ -1967,24 +783,14 @@ namespace TBF.UI.Bench.TestProfiles switch (selectedTab) { - case ProcedureTabs.Metrology1: - UpdateFromMetrology1Tab(); - listViewEx = metrology1ListViewEx; + case TestProfileTabs.Metrology: + UpdateFromMetrologyTab(); + listViewEx = metrologyListViewEx; break; - case ProcedureTabs.Metrology2: - UpdateFromMetrology2Tab(); - listViewEx = metrology2ListViewEx; - break; - - case ProcedureTabs.Process: - UpdateFromProcessTab(); - listViewEx = processListViewEx; - break; - - case ProcedureTabs.Parameters: - UpdateFromParametersTab(); - listViewEx = parametersListViewEx; + case TestProfileTabs.ErrorFlags: + UpdateFromErrorFlagsTab(); + listViewEx = errorFlagsListViewEx; break; default: return; @@ -1992,20 +798,21 @@ namespace TBF.UI.Bench.TestProfiles /// 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) - Test test1 = LoadedProcedure.Tests[ix - 1]; - Test test2 = LoadedProcedure.Tests[ix]; + PTest test1 = LoadedProfile.Tests[ix - 1]; + PTest test2 = LoadedProfile.Tests[ix]; test1.ItemNr++; test2.ItemNr--; - LoadedProcedure.Tests.RemoveAt(ix); - LoadedProcedure.Tests.Insert(ix - 1, test2); + LoadedProfile.Tests.RemoveAt(ix); + LoadedProfile.Tests.Insert(ix - 1, test2); if (SelectedTestIx >= 1) SelectedTestIx--; - RefreshMetrology12AndProcessTabs(); + RefreshMetrologyAndErrorFlagsTabs(); listViewEx.Focus(); listViewEx.Items[ix - 1].Selected = true; @@ -2018,45 +825,36 @@ namespace TBF.UI.Bench.TestProfiles switch (selectedTab) { - case ProcedureTabs.Metrology1: - UpdateFromMetrology1Tab(); - listViewEx = metrology1ListViewEx; + case TestProfileTabs.Metrology: + UpdateFromMetrologyTab(); + listViewEx = metrologyListViewEx; break; - case ProcedureTabs.Metrology2: - UpdateFromMetrology2Tab(); - listViewEx = metrology2ListViewEx; - break; - - case ProcedureTabs.Process: - UpdateFromProcessTab(); - listViewEx = processListViewEx; - break; - - case ProcedureTabs.Parameters: - UpdateFromParametersTab(); - listViewEx = parametersListViewEx; + case TestProfileTabs.ErrorFlags: + UpdateFromErrorFlagsTab(); + listViewEx = errorFlagsListViewEx; break; default: return; } - /// Check the selected index validity - if (listViewEx.SelectedItems.Count != 1) 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) - Test test1 = LoadedProcedure.Tests[ix]; - Test test2 = LoadedProcedure.Tests[ix + 1]; + PTest test1 = LoadedProfile.Tests[ix]; + PTest test2 = LoadedProfile.Tests[ix + 1]; test1.ItemNr++; test2.ItemNr--; - LoadedProcedure.Tests.RemoveAt(ix + 1); - LoadedProcedure.Tests.Insert(ix, test2); + LoadedProfile.Tests.RemoveAt(ix + 1); + LoadedProfile.Tests.Insert(ix, test2); if ((SelectedTestIx >= 0) && (SelectedTestIx < listViewEx.Items.Count - 1)) SelectedTestIx++; - RefreshMetrology12AndProcessTabs(); + RefreshMetrologyAndErrorFlagsTabs(); listViewEx.Focus(); listViewEx.Items[ix + 1].Selected = true; @@ -2066,8 +864,6 @@ namespace TBF.UI.Bench.TestProfiles #endregion private void metrology1ListViewEx_SelectedIndexChanged(object sender, EventArgs e) { SelectedIndexChanged(sender, e); } - private void metrology2ListViewEx_SelectedIndexChanged(object sender, EventArgs e) { SelectedIndexChanged(sender, e); } - private void processListViewEx_SelectedIndexChanged(object sender, EventArgs e) { SelectedIndexChanged(sender, e); } private void parametersListViewEx_SelectedIndexChanged(object sender, EventArgs e) { SelectedIndexChanged(sender, e); } /// @@ -2076,7 +872,7 @@ namespace TBF.UI.Bench.TestProfiles void SelectedIndexChanged(object sender, EventArgs e) { ListViewEx listViewEx = sender as ListViewEx; - if (listViewEx.SelectedItems.Count != 1) + if ((listViewEx == null) || (listViewEx.SelectedItems.Count != 1)) { UpdateButtonStates(SharedButtons.SelectedItemPos.None); SelectedTestIx = -1; @@ -2129,5 +925,54 @@ namespace TBF.UI.Bench.TestProfiles sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up | SharedButtons.Buttons.Down); } } - } + + + /// + /// ErrorFlagsMode related conversions + /// + + string SByte2String(SByte e) + { + return ((ErrorFlagsMode) e).ToDescription(); + } + + bool IsValidEFlagsMode(string str, out sbyte eflags) + { + for (ErrorFlagsMode e = 0; e < ErrorFlagsMode.Count; e++) + { + if (e.ToDescription() == str) + { + eflags = (sbyte)e; + return true; + } + } + + eflags = 0; + 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++) + { + if (e.ToDescription() == str) return (sbyte)e; + } + return 0; + } + } } diff --git a/TBF/UI/Bench/TestProfiles/TestProfileDlg.designer.cs b/TBF/UI/Bench/TestProfiles/TestProfileDlg.designer.cs index bd516cba4..c058dd9dc 100644 --- a/TBF/UI/Bench/TestProfiles/TestProfileDlg.designer.cs +++ b/TBF/UI/Bench/TestProfiles/TestProfileDlg.designer.cs @@ -35,34 +35,9 @@ namespace TBF.UI.Bench.TestProfiles this.mainSplitContainer = new System.Windows.Forms.SplitContainer(); this.tabControl = new System.Windows.Forms.TabControl(); this.generalTabPage = new System.Windows.Forms.TabPage(); - this.altProcPeriodTextBox = new System.Windows.Forms.TextBox(); - this.altProcPeriodLabel = new System.Windows.Forms.Label(); - this.altProcNameTextBox = new System.Windows.Forms.TextBox(); - this.altProcNameLabel = new System.Windows.Forms.Label(); - this.manualControlDisabledCheckBox = new System.Windows.Forms.CheckBox(); - this.mustBeCompleteCheckBox = new System.Windows.Forms.CheckBox(); - this.protectedCheckBox = new System.Windows.Forms.CheckBox(); - this.metersKindRadioButton3 = new System.Windows.Forms.RadioButton(); - this.fileWriter4ComboBox = new System.Windows.Forms.ComboBox(); - this.fileWriter3ComboBox = new System.Windows.Forms.ComboBox(); - this.printer2ComboBox = new System.Windows.Forms.ComboBox(); - this.fileWriter2ComboBox = new System.Windows.Forms.ComboBox(); - this.metersKindRadioButton2 = new System.Windows.Forms.RadioButton(); - this.metersKindRadioButton1 = new System.Windows.Forms.RadioButton(); - this.transitionEndComboBox = new System.Windows.Forms.ComboBox(); - this.transitionEndLabel = new System.Windows.Forms.Label(); - this.transitionStartComboBox = new System.Windows.Forms.ComboBox(); - this.transitionStartLabel = new System.Windows.Forms.Label(); - this.fileWriter1ComboBox = new System.Windows.Forms.ComboBox(); - this.printer1ComboBox = new System.Windows.Forms.ComboBox(); - this.dataEntryComboBox = new System.Windows.Forms.ComboBox(); - this.resultsWriterLabel = new System.Windows.Forms.Label(); - this.resultsPrinterLabel = new System.Windows.Forms.Label(); - this.dataEntryLabel = new System.Windows.Forms.Label(); - this.notesTextBox = new System.Windows.Forms.TextBox(); - this.label18 = new System.Windows.Forms.Label(); - this.watermetersTextBox = new System.Windows.Forms.TextBox(); - this.watermetersLabel = new System.Windows.Forms.Label(); + 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(); @@ -75,28 +50,27 @@ namespace TBF.UI.Bench.TestProfiles this.label12 = new System.Windows.Forms.Label(); this.procNameTextBox = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); - this.historyTabPage = new System.Windows.Forms.TabPage(); - this.historyListViewEx = new global::Results.Forms.ListViewEx(); this.metrology1TabPage = new System.Windows.Forms.TabPage(); - this.metrology1ListViewEx = new global::Results.Forms.ListViewEx(); - this.metrology2TabPage = new System.Windows.Forms.TabPage(); - this.metrology2ListViewEx = new global::Results.Forms.ListViewEx(); - this.processTabPage = new System.Windows.Forms.TabPage(); - this.processListViewEx = new global::Results.Forms.ListViewEx(); + this.metrologyListViewEx = new global::Results.Forms.ListViewEx(); this.parametersTabPage = new System.Windows.Forms.TabPage(); - this.parametersListViewEx = new global::Results.Forms.ListViewEx(); + this.errorFlagsListViewEx = new global::Results.Forms.ListViewEx(); this.sharedButtons = new TBF.UI.Shared.SharedButtons(); + this.profileTypeRadioButton4 = new System.Windows.Forms.RadioButton(); + this.profileTypeRadioButton5 = new System.Windows.Forms.RadioButton(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.errorCalculationRadioButton1 = new System.Windows.Forms.RadioButton(); + this.errorCalculationRadioButton2 = new System.Windows.Forms.RadioButton(); ((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).BeginInit(); this.mainSplitContainer.Panel1.SuspendLayout(); this.mainSplitContainer.Panel2.SuspendLayout(); this.mainSplitContainer.SuspendLayout(); this.tabControl.SuspendLayout(); this.generalTabPage.SuspendLayout(); - this.historyTabPage.SuspendLayout(); this.metrology1TabPage.SuspendLayout(); - this.metrology2TabPage.SuspendLayout(); - this.processTabPage.SuspendLayout(); this.parametersTabPage.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // mainSplitContainer @@ -116,10 +90,7 @@ namespace TBF.UI.Bench.TestProfiles // tabControl // this.tabControl.Controls.Add(this.generalTabPage); - this.tabControl.Controls.Add(this.historyTabPage); this.tabControl.Controls.Add(this.metrology1TabPage); - this.tabControl.Controls.Add(this.metrology2TabPage); - this.tabControl.Controls.Add(this.processTabPage); this.tabControl.Controls.Add(this.parametersTabPage); resources.ApplyResources(this.tabControl, "tabControl"); this.tabControl.Name = "tabControl"; @@ -128,34 +99,8 @@ namespace TBF.UI.Bench.TestProfiles // // generalTabPage // - this.generalTabPage.Controls.Add(this.altProcPeriodTextBox); - this.generalTabPage.Controls.Add(this.altProcPeriodLabel); - this.generalTabPage.Controls.Add(this.altProcNameTextBox); - this.generalTabPage.Controls.Add(this.altProcNameLabel); - this.generalTabPage.Controls.Add(this.manualControlDisabledCheckBox); - this.generalTabPage.Controls.Add(this.mustBeCompleteCheckBox); - this.generalTabPage.Controls.Add(this.protectedCheckBox); - this.generalTabPage.Controls.Add(this.metersKindRadioButton3); - this.generalTabPage.Controls.Add(this.fileWriter4ComboBox); - this.generalTabPage.Controls.Add(this.fileWriter3ComboBox); - this.generalTabPage.Controls.Add(this.printer2ComboBox); - this.generalTabPage.Controls.Add(this.fileWriter2ComboBox); - this.generalTabPage.Controls.Add(this.metersKindRadioButton2); - this.generalTabPage.Controls.Add(this.metersKindRadioButton1); - this.generalTabPage.Controls.Add(this.transitionEndComboBox); - this.generalTabPage.Controls.Add(this.transitionEndLabel); - this.generalTabPage.Controls.Add(this.transitionStartComboBox); - this.generalTabPage.Controls.Add(this.transitionStartLabel); - this.generalTabPage.Controls.Add(this.fileWriter1ComboBox); - this.generalTabPage.Controls.Add(this.printer1ComboBox); - this.generalTabPage.Controls.Add(this.dataEntryComboBox); - this.generalTabPage.Controls.Add(this.resultsWriterLabel); - this.generalTabPage.Controls.Add(this.resultsPrinterLabel); - this.generalTabPage.Controls.Add(this.dataEntryLabel); - this.generalTabPage.Controls.Add(this.notesTextBox); - this.generalTabPage.Controls.Add(this.label18); - this.generalTabPage.Controls.Add(this.watermetersTextBox); - this.generalTabPage.Controls.Add(this.watermetersLabel); + this.generalTabPage.Controls.Add(this.groupBox2); + this.generalTabPage.Controls.Add(this.groupBox1); this.generalTabPage.Controls.Add(this.lastChangedOnTextBox); this.generalTabPage.Controls.Add(this.label15); this.generalTabPage.Controls.Add(this.lastChangedByTextBox); @@ -172,163 +117,26 @@ namespace TBF.UI.Bench.TestProfiles this.generalTabPage.Name = "generalTabPage"; this.generalTabPage.UseVisualStyleBackColor = true; // - // altProcPeriodTextBox + // profileTypeRadioButton3 // - resources.ApplyResources(this.altProcPeriodTextBox, "altProcPeriodTextBox"); - this.altProcPeriodTextBox.Name = "altProcPeriodTextBox"; + resources.ApplyResources(this.profileTypeRadioButton3, "profileTypeRadioButton3"); + this.profileTypeRadioButton3.Name = "profileTypeRadioButton3"; + this.profileTypeRadioButton3.TabStop = true; + this.profileTypeRadioButton3.UseVisualStyleBackColor = true; // - // altProcPeriodLabel + // profileTypeRadioButton2 // - resources.ApplyResources(this.altProcPeriodLabel, "altProcPeriodLabel"); - this.altProcPeriodLabel.Name = "altProcPeriodLabel"; + resources.ApplyResources(this.profileTypeRadioButton2, "profileTypeRadioButton2"); + this.profileTypeRadioButton2.Name = "profileTypeRadioButton2"; + this.profileTypeRadioButton2.TabStop = true; + this.profileTypeRadioButton2.UseVisualStyleBackColor = true; // - // altProcNameTextBox + // profileTypeRadioButton1 // - resources.ApplyResources(this.altProcNameTextBox, "altProcNameTextBox"); - this.altProcNameTextBox.Name = "altProcNameTextBox"; - // - // altProcNameLabel - // - resources.ApplyResources(this.altProcNameLabel, "altProcNameLabel"); - this.altProcNameLabel.Name = "altProcNameLabel"; - // - // manualControlDisabledCheckBox - // - resources.ApplyResources(this.manualControlDisabledCheckBox, "manualControlDisabledCheckBox"); - this.manualControlDisabledCheckBox.Name = "manualControlDisabledCheckBox"; - this.manualControlDisabledCheckBox.UseVisualStyleBackColor = true; - // - // mustBeCompleteCheckBox - // - resources.ApplyResources(this.mustBeCompleteCheckBox, "mustBeCompleteCheckBox"); - this.mustBeCompleteCheckBox.Name = "mustBeCompleteCheckBox"; - this.mustBeCompleteCheckBox.UseVisualStyleBackColor = true; - // - // protectedCheckBox - // - resources.ApplyResources(this.protectedCheckBox, "protectedCheckBox"); - this.protectedCheckBox.Name = "protectedCheckBox"; - this.protectedCheckBox.UseVisualStyleBackColor = true; - // - // metersKindRadioButton3 - // - resources.ApplyResources(this.metersKindRadioButton3, "metersKindRadioButton3"); - this.metersKindRadioButton3.Name = "metersKindRadioButton3"; - this.metersKindRadioButton3.TabStop = true; - this.metersKindRadioButton3.UseVisualStyleBackColor = true; - // - // fileWriter4ComboBox - // - this.fileWriter4ComboBox.FormattingEnabled = true; - resources.ApplyResources(this.fileWriter4ComboBox, "fileWriter4ComboBox"); - this.fileWriter4ComboBox.Name = "fileWriter4ComboBox"; - // - // fileWriter3ComboBox - // - this.fileWriter3ComboBox.FormattingEnabled = true; - resources.ApplyResources(this.fileWriter3ComboBox, "fileWriter3ComboBox"); - this.fileWriter3ComboBox.Name = "fileWriter3ComboBox"; - // - // printer2ComboBox - // - this.printer2ComboBox.FormattingEnabled = true; - resources.ApplyResources(this.printer2ComboBox, "printer2ComboBox"); - this.printer2ComboBox.Name = "printer2ComboBox"; - // - // fileWriter2ComboBox - // - this.fileWriter2ComboBox.FormattingEnabled = true; - resources.ApplyResources(this.fileWriter2ComboBox, "fileWriter2ComboBox"); - this.fileWriter2ComboBox.Name = "fileWriter2ComboBox"; - // - // metersKindRadioButton2 - // - resources.ApplyResources(this.metersKindRadioButton2, "metersKindRadioButton2"); - this.metersKindRadioButton2.Name = "metersKindRadioButton2"; - this.metersKindRadioButton2.TabStop = true; - this.metersKindRadioButton2.UseVisualStyleBackColor = true; - // - // metersKindRadioButton1 - // - resources.ApplyResources(this.metersKindRadioButton1, "metersKindRadioButton1"); - this.metersKindRadioButton1.Name = "metersKindRadioButton1"; - this.metersKindRadioButton1.TabStop = true; - this.metersKindRadioButton1.UseVisualStyleBackColor = true; - // - // transitionEndComboBox - // - this.transitionEndComboBox.FormattingEnabled = true; - resources.ApplyResources(this.transitionEndComboBox, "transitionEndComboBox"); - this.transitionEndComboBox.Name = "transitionEndComboBox"; - // - // transitionEndLabel - // - resources.ApplyResources(this.transitionEndLabel, "transitionEndLabel"); - this.transitionEndLabel.Name = "transitionEndLabel"; - // - // transitionStartComboBox - // - this.transitionStartComboBox.FormattingEnabled = true; - resources.ApplyResources(this.transitionStartComboBox, "transitionStartComboBox"); - this.transitionStartComboBox.Name = "transitionStartComboBox"; - // - // transitionStartLabel - // - resources.ApplyResources(this.transitionStartLabel, "transitionStartLabel"); - this.transitionStartLabel.Name = "transitionStartLabel"; - // - // fileWriter1ComboBox - // - this.fileWriter1ComboBox.FormattingEnabled = true; - resources.ApplyResources(this.fileWriter1ComboBox, "fileWriter1ComboBox"); - this.fileWriter1ComboBox.Name = "fileWriter1ComboBox"; - // - // printer1ComboBox - // - this.printer1ComboBox.FormattingEnabled = true; - resources.ApplyResources(this.printer1ComboBox, "printer1ComboBox"); - this.printer1ComboBox.Name = "printer1ComboBox"; - // - // dataEntryComboBox - // - this.dataEntryComboBox.FormattingEnabled = true; - resources.ApplyResources(this.dataEntryComboBox, "dataEntryComboBox"); - this.dataEntryComboBox.Name = "dataEntryComboBox"; - // - // resultsWriterLabel - // - resources.ApplyResources(this.resultsWriterLabel, "resultsWriterLabel"); - this.resultsWriterLabel.Name = "resultsWriterLabel"; - // - // resultsPrinterLabel - // - resources.ApplyResources(this.resultsPrinterLabel, "resultsPrinterLabel"); - this.resultsPrinterLabel.Name = "resultsPrinterLabel"; - // - // dataEntryLabel - // - resources.ApplyResources(this.dataEntryLabel, "dataEntryLabel"); - this.dataEntryLabel.Name = "dataEntryLabel"; - // - // notesTextBox - // - resources.ApplyResources(this.notesTextBox, "notesTextBox"); - this.notesTextBox.Name = "notesTextBox"; - // - // label18 - // - resources.ApplyResources(this.label18, "label18"); - this.label18.Name = "label18"; - // - // watermetersTextBox - // - resources.ApplyResources(this.watermetersTextBox, "watermetersTextBox"); - this.watermetersTextBox.Name = "watermetersTextBox"; - // - // watermetersLabel - // - resources.ApplyResources(this.watermetersLabel, "watermetersLabel"); - this.watermetersLabel.Name = "watermetersLabel"; + resources.ApplyResources(this.profileTypeRadioButton1, "profileTypeRadioButton1"); + this.profileTypeRadioButton1.Name = "profileTypeRadioButton1"; + this.profileTypeRadioButton1.TabStop = true; + this.profileTypeRadioButton1.UseVisualStyleBackColor = true; // // lastChangedOnTextBox // @@ -390,111 +198,102 @@ namespace TBF.UI.Bench.TestProfiles resources.ApplyResources(this.label1, "label1"); this.label1.Name = "label1"; // - // historyTabPage - // - this.historyTabPage.Controls.Add(this.historyListViewEx); - resources.ApplyResources(this.historyTabPage, "historyTabPage"); - this.historyTabPage.Name = "historyTabPage"; - this.historyTabPage.UseVisualStyleBackColor = true; - // - // historyListViewEx - // - this.historyListViewEx.AllowColumnReorder = true; - resources.ApplyResources(this.historyListViewEx, "historyListViewEx"); - this.historyListViewEx.DoubleClickActivation = false; - this.historyListViewEx.FullRowSelect = true; - this.historyListViewEx.GridLines = true; - this.historyListViewEx.Name = "historyListViewEx"; - this.historyListViewEx.UseCompatibleStateImageBehavior = false; - this.historyListViewEx.View = System.Windows.Forms.View.Details; - // // metrology1TabPage // - this.metrology1TabPage.Controls.Add(this.metrology1ListViewEx); + this.metrology1TabPage.Controls.Add(this.metrologyListViewEx); resources.ApplyResources(this.metrology1TabPage, "metrology1TabPage"); this.metrology1TabPage.Name = "metrology1TabPage"; this.metrology1TabPage.UseVisualStyleBackColor = true; // - // metrology1ListViewEx + // metrologyListViewEx // - this.metrology1ListViewEx.AllowColumnReorder = true; - resources.ApplyResources(this.metrology1ListViewEx, "metrology1ListViewEx"); - this.metrology1ListViewEx.DoubleClickActivation = false; - this.metrology1ListViewEx.FullRowSelect = true; - this.metrology1ListViewEx.GridLines = true; - this.metrology1ListViewEx.Name = "metrology1ListViewEx"; - this.metrology1ListViewEx.UseCompatibleStateImageBehavior = false; - this.metrology1ListViewEx.View = System.Windows.Forms.View.Details; - this.metrology1ListViewEx.SelectedIndexChanged += new System.EventHandler(this.metrology1ListViewEx_SelectedIndexChanged); - // - // metrology2TabPage - // - this.metrology2TabPage.Controls.Add(this.metrology2ListViewEx); - resources.ApplyResources(this.metrology2TabPage, "metrology2TabPage"); - this.metrology2TabPage.Name = "metrology2TabPage"; - this.metrology2TabPage.UseVisualStyleBackColor = true; - // - // metrology2ListViewEx - // - this.metrology2ListViewEx.AllowColumnReorder = true; - resources.ApplyResources(this.metrology2ListViewEx, "metrology2ListViewEx"); - this.metrology2ListViewEx.DoubleClickActivation = false; - this.metrology2ListViewEx.FullRowSelect = true; - this.metrology2ListViewEx.GridLines = true; - this.metrology2ListViewEx.Name = "metrology2ListViewEx"; - this.metrology2ListViewEx.UseCompatibleStateImageBehavior = false; - this.metrology2ListViewEx.View = System.Windows.Forms.View.Details; - this.metrology2ListViewEx.SelectedIndexChanged += new System.EventHandler(this.metrology2ListViewEx_SelectedIndexChanged); - // - // processTabPage - // - this.processTabPage.Controls.Add(this.processListViewEx); - resources.ApplyResources(this.processTabPage, "processTabPage"); - this.processTabPage.Name = "processTabPage"; - this.processTabPage.UseVisualStyleBackColor = true; - // - // processListViewEx - // - this.processListViewEx.AllowColumnReorder = true; - resources.ApplyResources(this.processListViewEx, "processListViewEx"); - this.processListViewEx.DoubleClickActivation = false; - this.processListViewEx.FullRowSelect = true; - this.processListViewEx.GridLines = true; - this.processListViewEx.Name = "processListViewEx"; - this.processListViewEx.UseCompatibleStateImageBehavior = false; - this.processListViewEx.View = System.Windows.Forms.View.Details; - this.processListViewEx.SelectedIndexChanged += new System.EventHandler(this.processListViewEx_SelectedIndexChanged); + this.metrologyListViewEx.AllowColumnReorder = true; + resources.ApplyResources(this.metrologyListViewEx, "metrologyListViewEx"); + this.metrologyListViewEx.DoubleClickActivation = false; + this.metrologyListViewEx.FullRowSelect = true; + this.metrologyListViewEx.GridLines = true; + this.metrologyListViewEx.Name = "metrologyListViewEx"; + this.metrologyListViewEx.UseCompatibleStateImageBehavior = false; + this.metrologyListViewEx.View = System.Windows.Forms.View.Details; + this.metrologyListViewEx.SelectedIndexChanged += new System.EventHandler(this.metrology1ListViewEx_SelectedIndexChanged); // // parametersTabPage // - this.parametersTabPage.Controls.Add(this.parametersListViewEx); + this.parametersTabPage.Controls.Add(this.errorFlagsListViewEx); resources.ApplyResources(this.parametersTabPage, "parametersTabPage"); this.parametersTabPage.Name = "parametersTabPage"; this.parametersTabPage.UseVisualStyleBackColor = true; // - // parametersListViewEx + // errorFlagsListViewEx // - this.parametersListViewEx.AllowColumnReorder = true; - resources.ApplyResources(this.parametersListViewEx, "parametersListViewEx"); - this.parametersListViewEx.DoubleClickActivation = false; - this.parametersListViewEx.FullRowSelect = true; - this.parametersListViewEx.GridLines = true; - this.parametersListViewEx.Name = "parametersListViewEx"; - this.parametersListViewEx.UseCompatibleStateImageBehavior = false; - this.parametersListViewEx.View = System.Windows.Forms.View.Details; - this.parametersListViewEx.SelectedIndexChanged += new System.EventHandler(this.parametersListViewEx_SelectedIndexChanged); + this.errorFlagsListViewEx.AllowColumnReorder = true; + resources.ApplyResources(this.errorFlagsListViewEx, "errorFlagsListViewEx"); + this.errorFlagsListViewEx.DoubleClickActivation = false; + this.errorFlagsListViewEx.FullRowSelect = true; + this.errorFlagsListViewEx.GridLines = true; + this.errorFlagsListViewEx.Name = "errorFlagsListViewEx"; + this.errorFlagsListViewEx.UseCompatibleStateImageBehavior = false; + this.errorFlagsListViewEx.View = System.Windows.Forms.View.Details; + this.errorFlagsListViewEx.SelectedIndexChanged += new System.EventHandler(this.parametersListViewEx_SelectedIndexChanged); // // sharedButtons // resources.ApplyResources(this.sharedButtons, "sharedButtons"); this.sharedButtons.Name = "sharedButtons"; // - // ProcedureDlg + // profileTypeRadioButton4 + // + resources.ApplyResources(this.profileTypeRadioButton4, "profileTypeRadioButton4"); + this.profileTypeRadioButton4.Name = "profileTypeRadioButton4"; + this.profileTypeRadioButton4.TabStop = true; + this.profileTypeRadioButton4.UseVisualStyleBackColor = true; + // + // profileTypeRadioButton5 + // + resources.ApplyResources(this.profileTypeRadioButton5, "profileTypeRadioButton5"); + this.profileTypeRadioButton5.Name = "profileTypeRadioButton5"; + this.profileTypeRadioButton5.TabStop = true; + this.profileTypeRadioButton5.UseVisualStyleBackColor = true; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.profileTypeRadioButton1); + this.groupBox1.Controls.Add(this.profileTypeRadioButton5); + this.groupBox1.Controls.Add(this.profileTypeRadioButton2); + this.groupBox1.Controls.Add(this.profileTypeRadioButton4); + this.groupBox1.Controls.Add(this.profileTypeRadioButton3); + resources.ApplyResources(this.groupBox1, "groupBox1"); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.TabStop = false; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.errorCalculationRadioButton2); + this.groupBox2.Controls.Add(this.errorCalculationRadioButton1); + resources.ApplyResources(this.groupBox2, "groupBox2"); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.TabStop = false; + // + // errorCalculationRadioButton1 + // + resources.ApplyResources(this.errorCalculationRadioButton1, "errorCalculationRadioButton1"); + this.errorCalculationRadioButton1.Name = "errorCalculationRadioButton1"; + this.errorCalculationRadioButton1.TabStop = true; + this.errorCalculationRadioButton1.UseVisualStyleBackColor = true; + // + // errorCalculationRadioButton2 + // + resources.ApplyResources(this.errorCalculationRadioButton2, "errorCalculationRadioButton2"); + this.errorCalculationRadioButton2.Name = "errorCalculationRadioButton2"; + this.errorCalculationRadioButton2.TabStop = true; + this.errorCalculationRadioButton2.UseVisualStyleBackColor = true; + // + // TestProfileDlg // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.mainSplitContainer); - this.Name = "ProcedureDlg"; + this.Name = "TestProfileDlg"; this.Load += new System.EventHandler(this.ProcedureDlg_Load); this.mainSplitContainer.Panel1.ResumeLayout(false); this.mainSplitContainer.Panel2.ResumeLayout(false); @@ -503,11 +302,12 @@ namespace TBF.UI.Bench.TestProfiles this.tabControl.ResumeLayout(false); this.generalTabPage.ResumeLayout(false); this.generalTabPage.PerformLayout(); - this.historyTabPage.ResumeLayout(false); this.metrology1TabPage.ResumeLayout(false); - this.metrology2TabPage.ResumeLayout(false); - this.processTabPage.ResumeLayout(false); this.parametersTabPage.ResumeLayout(false); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); this.ResumeLayout(false); } @@ -515,27 +315,11 @@ namespace TBF.UI.Bench.TestProfiles #endregion private System.Windows.Forms.SplitContainer mainSplitContainer; - private System.Windows.Forms.TabControl tabControl; - private System.Windows.Forms.TabPage historyTabPage; - private global::Results.Forms.ListViewEx historyListViewEx; + private System.Windows.Forms.TabControl tabControl; private System.Windows.Forms.TabPage metrology1TabPage; - private global::Results.Forms.ListViewEx metrology1ListViewEx; - private System.Windows.Forms.TabPage metrology2TabPage; - private global::Results.Forms.ListViewEx metrology2ListViewEx; - private System.Windows.Forms.TabPage processTabPage; - private global::Results.Forms.ListViewEx processListViewEx; + private global::Results.Forms.ListViewEx metrologyListViewEx; private TBF.UI.Shared.SharedButtons sharedButtons; - private System.Windows.Forms.TabPage generalTabPage; - private System.Windows.Forms.ComboBox fileWriter1ComboBox; - private System.Windows.Forms.ComboBox printer1ComboBox; - private System.Windows.Forms.ComboBox dataEntryComboBox; - private System.Windows.Forms.Label resultsWriterLabel; - private System.Windows.Forms.Label resultsPrinterLabel; - private System.Windows.Forms.Label dataEntryLabel; - private System.Windows.Forms.TextBox notesTextBox; - private System.Windows.Forms.Label label18; - private System.Windows.Forms.TextBox watermetersTextBox; - private System.Windows.Forms.Label watermetersLabel; + private System.Windows.Forms.TabPage generalTabPage; private System.Windows.Forms.TextBox lastChangedOnTextBox; private System.Windows.Forms.Label label15; private System.Windows.Forms.TextBox lastChangedByTextBox; @@ -547,26 +331,17 @@ namespace TBF.UI.Bench.TestProfiles private System.Windows.Forms.TextBox descriptionTextBox; private System.Windows.Forms.Label label12; private System.Windows.Forms.TextBox procNameTextBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ComboBox transitionEndComboBox; - private System.Windows.Forms.Label transitionEndLabel; - private System.Windows.Forms.ComboBox transitionStartComboBox; - private System.Windows.Forms.Label transitionStartLabel; - private System.Windows.Forms.RadioButton metersKindRadioButton2; - private System.Windows.Forms.RadioButton metersKindRadioButton1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.RadioButton profileTypeRadioButton2; + private System.Windows.Forms.RadioButton profileTypeRadioButton1; private System.Windows.Forms.TabPage parametersTabPage; - private global::Results.Forms.ListViewEx parametersListViewEx; - private System.Windows.Forms.ComboBox fileWriter2ComboBox; - private System.Windows.Forms.ComboBox fileWriter3ComboBox; - private System.Windows.Forms.ComboBox printer2ComboBox; - private System.Windows.Forms.ComboBox fileWriter4ComboBox; - private System.Windows.Forms.RadioButton metersKindRadioButton3; - private System.Windows.Forms.CheckBox mustBeCompleteCheckBox; - private System.Windows.Forms.CheckBox protectedCheckBox; - private System.Windows.Forms.CheckBox manualControlDisabledCheckBox; - private System.Windows.Forms.TextBox altProcNameTextBox; - private System.Windows.Forms.Label altProcNameLabel; - private System.Windows.Forms.TextBox altProcPeriodTextBox; - private System.Windows.Forms.Label altProcPeriodLabel; + private global::Results.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 profileTypeRadioButton4; } } \ No newline at end of file diff --git a/TBF/UI/Bench/TestProfiles/TestProfileDlg.resx b/TBF/UI/Bench/TestProfiles/TestProfileDlg.resx index 5b88076a0..2fa8d520b 100644 --- a/TBF/UI/Bench/TestProfiles/TestProfileDlg.resx +++ b/TBF/UI/Bench/TestProfiles/TestProfileDlg.resx @@ -129,743 +129,263 @@ 0, 0 - - 676, 128 - - - 34, 20 - - - 19 - - - False - - - altProcPeriodTextBox - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 0 - - + True - + NoControl - - 542, 131 + + 22, 41 - - 116, 13 + + 88, 17 - - 18 - - - Alternative proc. period - - - False - - - altProcPeriodLabel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 1 - - - 188, 128 - - - 217, 20 - - - 17 - - - False - - - altProcNameTextBox - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 2 - - - True - - - NoControl - - - 20, 131 - - - 113, 13 - - - 16 - - - Alternative proc. name - - - False - - - altProcNameLabel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 3 - - - True - - - NoControl - - - 545, 197 - - - 138, 17 - - - 39 - - - Manual control disabled - - - manualControlDisabledCheckBox - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 4 - - - True - - - NoControl - - - 545, 176 - - - 152, 17 - - - 38 - - - All tests must be competed - - - mustBeCompleteCheckBox - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 5 - - - True - - - NoControl - - - 545, 155 - - - 123, 17 - - - 37 - - - Protected procedure - - - protectedCheckBox - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 6 - - - True - - - NoControl - - - 396, 196 - - - 77, 17 - - + 36 - - Heat meter + + Qp and Class - - metersKindRadioButton3 + + errorCalculationRadioButton2 - + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - generalTabPage + + groupBox2 - - 7 + + 0 - - 188, 336 - - - 121, 21 - - - 33 - - - fileWriter4ComboBox - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 8 - - - 188, 312 - - - 121, 21 - - - 32 - - - fileWriter3ComboBox - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 9 - - - 188, 243 - - - 121, 21 - - - 28 - - - printer2ComboBox - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 10 - - - 188, 289 - - - 121, 21 - - - 31 - - - fileWriter2ComboBox - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 11 - - + True - + NoControl - - 396, 175 + + 22, 19 - - 72, 17 + + 151, 17 - + 35 - - Combined + + Entering numbers manually - - metersKindRadioButton2 + + errorCalculationRadioButton1 - + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - generalTabPage + + groupBox2 - - 12 + + 1 - - True + + 402, 125 - - NoControl + + 308, 70 - - 396, 154 - - - 54, 17 - - - 34 - - - Single - - - metersKindRadioButton1 - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 13 - - - 188, 197 - - - 121, 21 - - - 25 - - - transitionEndComboBox - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 14 - - - True - - - NoControl - - - 20, 202 - - - 63, 13 - - - 24 - - - Purge - End - - - transitionEndLabel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 15 - - - 188, 174 - - - 121, 21 - - - 23 - - - transitionStartComboBox - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 16 - - - True - - - NoControl - - - 20, 177 - - - 71, 13 - - - 22 - - - Purge - Begin - - - transitionStartLabel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 17 - - - 188, 266 - - - 121, 21 - - - 30 - - - fileWriter1ComboBox - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 18 - - - 188, 220 - - - 121, 21 - - - 27 - - - printer1ComboBox - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 19 - - - 188, 151 - - - 121, 21 - - - 21 - - - dataEntryComboBox - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 20 - - - True - - - NoControl - - - 20, 271 - - - 70, 13 - - - 29 - - - Results writer - - - resultsWriterLabel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 21 - - - True - - - NoControl - - - 20, 225 - - - 42, 13 - - - 26 - - - Printers - - - resultsPrinterLabel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 22 - - - True - - - NoControl - - - 21, 154 - - - 57, 13 - - - 20 - - - Data Entry - - - dataEntryLabel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 23 - - - 393, 243 - - - True - - - 317, 113 - - - 41 - - - notesTextBox - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 24 - - - True - - - NoControl - - - 331, 243 - - - 35, 13 - - + 40 - - Notes + + Error bounds calculation - - label18 + + groupBox2 - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + generalTabPage - - 25 + + 0 - - 188, 105 - - - 522, 20 - - - 13 - - - watermetersTextBox - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - generalTabPage - - - 26 - - + True - + NoControl - - 20, 108 + + 28, 21 - - 94, 13 + + 71, 17 - - 12 + + 34 - - Meter types tested + + Q3 and R - - watermetersLabel + + profileTypeRadioButton1 - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + groupBox1 + + + 0 + + + True + + + NoControl + + + 28, 107 + + + 234, 17 + + + 38 + + + Entering numbers and designations manually + + + profileTypeRadioButton5 + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 1 + + + True + + + NoControl + + + 28, 42 + + + 169, 17 + + + 35 + + + Qn and Class (Qn <= 15 m3/h) + + + profileTypeRadioButton2 + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 2 + + + True + + + NoControl + + + 28, 85 + + + 73, 17 + + + 37 + + + Qp and Qi + + + profileTypeRadioButton4 + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 3 + + + True + + + NoControl + + + 28, 63 + + + 163, 17 + + + 36 + + + Qn and Class (Qn > 15 m3/h) + + + profileTypeRadioButton3 + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 4 + + + 23, 123 + + + 366, 137 + + + 39 + + + Flow calculation and designation + + + groupBox1 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + generalTabPage - - 27 + + 1 402, 82 @@ -886,7 +406,7 @@ generalTabPage - 28 + 2 True @@ -916,7 +436,7 @@ generalTabPage - 29 + 3 188, 82 @@ -937,7 +457,7 @@ generalTabPage - 30 + 4 True @@ -967,7 +487,7 @@ generalTabPage - 31 + 5 402, 59 @@ -988,7 +508,7 @@ generalTabPage - 32 + 6 True @@ -1018,7 +538,7 @@ generalTabPage - 33 + 7 188, 59 @@ -1039,7 +559,7 @@ generalTabPage - 34 + 8 True @@ -1069,7 +589,7 @@ generalTabPage - 35 + 9 188, 36 @@ -1090,7 +610,7 @@ generalTabPage - 36 + 10 True @@ -1120,7 +640,7 @@ generalTabPage - 37 + 11 188, 13 @@ -1141,7 +661,7 @@ generalTabPage - 38 + 12 True @@ -1171,7 +691,7 @@ generalTabPage - 39 + 13 4, 34 @@ -1200,79 +720,28 @@ 0 - + Fill - + 3, 3 - + 917, 360 - + 0 - - historyListViewEx + + metrologyListViewEx - - Results.Forms.ListViewEx, Results, Version=2.18.893.0, Culture=neutral, PublicKeyToken=null + + Results.Forms.ListViewEx, Results, Version=2.24.1315.0, Culture=neutral, PublicKeyToken=null - - historyTabPage - - - 0 - - - 4, 34 - - - 3, 3, 3, 3 - - - 923, 366 - - - 1 - - - History of Changes - - - historyTabPage - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabControl - - - 1 - - - Fill - - - 3, 3 - - - 917, 360 - - - 0 - - - metrology1ListViewEx - - - Results.Forms.ListViewEx, Results, Version=2.18.893.0, Culture=neutral, PublicKeyToken=null - - + metrology1TabPage - + 0 @@ -1300,132 +769,30 @@ tabControl - 2 + 1 - + Fill - - 3, 3 - - - 917, 360 - - - 0 - - - metrology2ListViewEx - - - Results.Forms.ListViewEx, Results, Version=2.18.893.0, Culture=neutral, PublicKeyToken=null - - - metrology2TabPage - - - 0 - - - 4, 34 - - - 3, 3, 3, 3 - - - 923, 366 - - - 3 - - - Metrology II. - - - metrology2TabPage - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabControl - - - 3 - - - Fill - - - 3, 3 - - - 917, 360 - - - 0 - - - processListViewEx - - - Results.Forms.ListViewEx, Results, Version=2.18.893.0, Culture=neutral, PublicKeyToken=null - - - processTabPage - - - 0 - - - 4, 34 - - - 3, 3, 3, 3 - - - 923, 366 - - - 4 - - - Process - - - processTabPage - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabControl - - - 4 - - - Fill - - + 0, 0 - + 923, 366 - + 0 - - parametersListViewEx + + errorFlagsListViewEx - - Results.Forms.ListViewEx, Results, Version=2.18.893.0, Culture=neutral, PublicKeyToken=null + + Results.Forms.ListViewEx, Results, Version=2.24.1315.0, Culture=neutral, PublicKeyToken=null - + parametersTabPage - + 0 @@ -1450,7 +817,7 @@ tabControl - 5 + 2 Fill @@ -1504,7 +871,7 @@ sharedButtons - TBF.UiControls.SharedButtons, TBF, Version=2.18.901.0, Culture=neutral, PublicKeyToken=null + TBF.UI.Shared.SharedButtons, TBF, Version=2.24.1320.0, Culture=neutral, PublicKeyToken=null mainSplitContainer.Panel2 @@ -1561,7 +928,7 @@ Procedure - ProcedureDlg + TestProfileDlg System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 diff --git a/TBF/UI/Bench/TestProfiles/TestProfilesCtrl.cs b/TBF/UI/Bench/TestProfiles/TestProfilesCtrl.cs index c69c58f62..a478a81f1 100644 --- a/TBF/UI/Bench/TestProfiles/TestProfilesCtrl.cs +++ b/TBF/UI/Bench/TestProfiles/TestProfilesCtrl.cs @@ -18,7 +18,7 @@ using TBF.UI.Shared; namespace TBF.UI.Bench.TestProfiles { - public class TestProfilesCtrl : BaseWithListViewEx, ITabWithListViewEx + public class TestProfilesCtrl : BaseWithListViewEx, ITabWithListViewEx { static readonly ILog log = LogManager.GetLogger(typeof(TestProfilesCtrl)); @@ -57,10 +57,10 @@ namespace TBF.UI.Bench.TestProfiles /// ListViewEx columns TBF.LocalSettings ls = Program.LocalSettings; - Columns.Add(Strings.Nr, (ls.ProceduresColumnCount > 0) ? ls.ProceduresColumnWidths[0] : (30 * parent.Dpi / Constants.Dpi100pct)); - Columns.Add(Strings.Name, (ls.ProceduresColumnCount > 1) ? ls.ProceduresColumnWidths[1] : (100 * parent.Dpi / Constants.Dpi100pct)); - Columns.Add(Strings.DescriptionColHdr, (ls.ProceduresColumnCount > 2) ? ls.ProceduresColumnWidths[2] : (300 * parent.Dpi / Constants.Dpi100pct)); - Columns.Add(Strings.More, (ls.ProceduresColumnCount > 3) ? ls.ProceduresColumnWidths[3] : (300 * parent.Dpi / Constants.Dpi100pct)); + Columns.Add(Strings.Nr, (ls.ProfilesColumnCount > 0) ? ls.ProfilesColumnWidths[0] : ( 30 * parent.Dpi / Constants.Dpi100pct)); + Columns.Add(Strings.Name, (ls.ProfilesColumnCount > 1) ? ls.ProfilesColumnWidths[1] : (100 * parent.Dpi / Constants.Dpi100pct)); + Columns.Add(Strings.DescriptionColHdr, (ls.ProfilesColumnCount > 2) ? ls.ProfilesColumnWidths[2] : (300 * parent.Dpi / Constants.Dpi100pct)); + Columns.Add(Strings.More, (ls.ProfilesColumnCount > 3) ? ls.ProfilesColumnWidths[3] : (300 * parent.Dpi / Constants.Dpi100pct)); editors = new Control[columnsCount]; /// @@ -86,8 +86,7 @@ namespace TBF.UI.Bench.TestProfiles /// Load the procedures if (session == null) session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config); - MyItems = session.QueryOver() - .Where(x => (x.ProcedureState == ProcedureState.Active)) + MyItems = session.QueryOver() .OrderBy(x => x.ItemNr).Asc .List(); @@ -104,7 +103,7 @@ namespace TBF.UI.Bench.TestProfiles public override void DrawOne(object myItem) { - Procedure entity = (Procedure)myItem; + Profile entity = (Profile)myItem; StringBuilder tests = new StringBuilder(); foreach (var test in entity.Tests) @@ -139,7 +138,7 @@ namespace TBF.UI.Bench.TestProfiles int itemNr = 0; foreach (var entity in MyItems) { - (entity as Procedure).ItemNr = itemNr++; + (entity as Profile).ItemNr = itemNr++; session.SaveOrUpdate(entity); } @@ -165,7 +164,7 @@ namespace TBF.UI.Bench.TestProfiles /// Compare list view column widths with the saved ones bool anyColumnDiffers = false; - if (Columns.Count != ls.ProceduresColumnCount) + if (Columns.Count != ls.ProfilesColumnCount) { anyColumnDiffers = true; } @@ -173,17 +172,17 @@ namespace TBF.UI.Bench.TestProfiles { for (int i = 0; i < Columns.Count; i++) { - if (Columns[i].Width != ls.ProceduresColumnWidths[i]) { anyColumnDiffers = true; break; } + if (Columns[i].Width != ls.ProfilesColumnWidths[i]) { anyColumnDiffers = true; break; } } } if (anyColumnDiffers) { /// Update column widths - ls.ProceduresColumnWidths = new int[Columns.Count]; + ls.ProfilesColumnWidths = new int[Columns.Count]; for (int i = 0; i < Columns.Count; i++) { - ls.ProceduresColumnWidths[i] = Columns[i].Width; + ls.ProfilesColumnWidths[i] = Columns[i].Width; } ls.Save(); @@ -196,21 +195,17 @@ namespace TBF.UI.Bench.TestProfiles string newName; for (int nameId = 1; true; nameId++) { - newName = Strings.New_procedure_name + nameId.ToString(); + newName = Strings.New_profile_name + nameId.ToString(); bool notUsed = true; foreach (var t in MyItems) if (t.Name.Equals(newName)) notUsed = false; if (notUsed) break; } - Procedure newProcedure = new Procedure(newName, MyItems.Count); - newProcedure.ProcedureState = ProcedureState.Active; - newProcedure.Revision = 1; - newProcedure.PredecessorId = 0; - newProcedure.ObtainedByCopy = false; - newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName; - newProcedure.CreationTime = DateTime.Now; + Profile newProfile = new Profile(newName, MyItems.Count); + newProfile.CreationUser = Users.GlobalData.CurrentUser.UserName; + newProfile.CreationTime = DateTime.Now; - if (new TestProfileDlg(newProcedure, GetUsedNames(), true).ShowDialog() == DialogResult.OK) + if (new TestProfileDlg(newProfile, GetUsedNames(), true).ShowDialog() == DialogResult.OK) { /// TODO: Make name uniqueness test parent.Unlock(); @@ -219,14 +214,14 @@ namespace TBF.UI.Bench.TestProfiles { try { - newProcedure.LastChgUser = Users.GlobalData.CurrentUser.UserName; - newProcedure.LastChgTime = DateTime.Now; + newProfile.LastChgUser = Users.GlobalData.CurrentUser.UserName; + newProfile.LastChgTime = DateTime.Now; - base.AddOne(newProcedure); - session.SaveOrUpdate(newProcedure); + base.AddOne(newProfile); + session.SaveOrUpdate(newProfile); transaction.Commit(); - MessageBox.Show(string.Format(Strings.Procedure_0_added, newProcedure.Name), + MessageBox.Show(string.Format(Strings.Profile_0_added, newProfile.Name), Strings.Confirmation, MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -234,7 +229,7 @@ namespace TBF.UI.Bench.TestProfiles catch (Exception exc) { transaction.Rollback(); - log.ErrorFormat("Exception when saving Procedure '{0}' : {1}", newProcedure.Name, exc.Message); + log.ErrorFormat("Exception when saving Profile '{0}' : {1}", newProfile.Name, exc.Message); } } } @@ -263,7 +258,7 @@ namespace TBF.UI.Bench.TestProfiles int itemNr = 0; foreach (var entity in MyItems) { - (entity as Procedure).ItemNr = itemNr++; + (entity as Profile).ItemNr = itemNr++; session.SaveOrUpdate(entity); } @@ -284,16 +279,12 @@ namespace TBF.UI.Bench.TestProfiles { if (SelectedItems.Count != 1) return; - Procedure originalProcedure = SelectedItems[0].Tag as Procedure; - Procedure modifiedProcedure = originalProcedure.Clone(); - - modifiedProcedure.Revision = originalProcedure.Revision + 1; - modifiedProcedure.ObtainedByCopy = false; + Profile editedProfile = SelectedItems[0].Tag as Profile; IList usedNames = GetUsedNames(); - usedNames.Remove(originalProcedure.Name); /// Allow original procedure name + usedNames.Remove(editedProfile.Name); /// Allow original procedure name /// - if (new TestProfileDlg(modifiedProcedure, usedNames).ShowDialog() == DialogResult.OK) + if (new TestProfileDlg(editedProfile, usedNames).ShowDialog() == DialogResult.OK) { parent.Unlock(); @@ -301,23 +292,20 @@ namespace TBF.UI.Bench.TestProfiles { try { - originalProcedure.ProcedureState = ProcedureState.History; - modifiedProcedure.LastChgUser = Users.GlobalData.CurrentUser.UserName; - modifiedProcedure.LastChgTime = DateTime.Now; + editedProfile.LastChgUser = Users.GlobalData.CurrentUser.UserName; + editedProfile.LastChgTime = DateTime.Now; - session.SaveOrUpdate(originalProcedure); - session.SaveOrUpdate(modifiedProcedure); + session.SaveOrUpdate(editedProfile); transaction.Commit(); - SelectedItems[0].Tag = modifiedProcedure; - MessageBox.Show(string.Format(Strings.Procedure_0_modified, string.Format(" {0} '{1}' ", modifiedProcedure.ItemNr + 1, modifiedProcedure.Name)), + MessageBox.Show(string.Format(Strings.Profile_0_modified, string.Format(" {0} '{1}' ", editedProfile.ItemNr + 1, editedProfile.Name)), Strings.Confirmation, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception exc) { - log.ErrorFormat("Exception when saving Procedure '{0}' : {1}", modifiedProcedure.Name, exc.Message); + log.ErrorFormat("Exception when saving Profile '{0}' : {1}", editedProfile.Name, exc.Message); transaction.Rollback(); } } @@ -331,36 +319,31 @@ namespace TBF.UI.Bench.TestProfiles { if (SelectedItems.Count != 1) return; - Procedure selectedProcedure = (Procedure)SelectedItems[0].Tag; + Profile selectedProfile = (Profile)SelectedItems[0].Tag; /// Make a copy of the selected procedure - Procedure newProcedure = selectedProcedure.Clone(); + Profile newProfile = selectedProfile.Clone(); - newProcedure.Name = selectedProcedure.Name + Strings.New_name_copy; - newProcedure.ItemNr = MyItems.Count; - newProcedure.ProcedureState = ProcedureState.Active; - newProcedure.Revision = 1; - newProcedure.PredecessorId = selectedProcedure.Id; - newProcedure.ObtainedByCopy = true; - newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName; - newProcedure.CreationTime = DateTime.Now; - newProcedure.Protected = false; + newProfile.Name = selectedProfile.Name + Strings.New_name_copy; + newProfile.ItemNr = MyItems.Count; + newProfile.CreationUser = Users.GlobalData.CurrentUser.UserName; + newProfile.CreationTime = DateTime.Now; - if ((new TestProfileDlg(newProcedure, GetUsedNames(), true)).ShowDialog() == DialogResult.OK) + if ((new TestProfileDlg(newProfile, GetUsedNames(), true)).ShowDialog() == DialogResult.OK) { /// TODO: Make name uniqueness test parent.Unlock(); using (var transaction = session.BeginTransaction()) { - newProcedure.LastChgUser = Users.GlobalData.CurrentUser.UserName; - newProcedure.LastChgTime = DateTime.Now; + newProfile.LastChgUser = Users.GlobalData.CurrentUser.UserName; + newProfile.LastChgTime = DateTime.Now; - base.AddOne(newProcedure); - session.SaveOrUpdate(newProcedure); + base.AddOne(newProfile); + session.SaveOrUpdate(newProfile); transaction.Commit(); - MessageBox.Show(string.Format(Strings.Procedure_0_added, newProcedure.Name), + MessageBox.Show(string.Format(Strings.Procedure_0_added, newProfile.Name), Strings.Confirmation, MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -372,12 +355,12 @@ namespace TBF.UI.Bench.TestProfiles { if (SelectedItems.Count != 1) return; - Procedure selectedProcedure = (Procedure)SelectedItems[0].Tag; + Profile selectedProfile = (Profile)SelectedItems[0].Tag; SaveFileDialog dlg = new SaveFileDialog(); if (dlg.ShowDialog() == DialogResult.OK) { - selectedProcedure.Export(new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8)); + selectedProfile.Export(new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8)); } } @@ -388,32 +371,28 @@ namespace TBF.UI.Bench.TestProfiles if (dlg.ShowDialog() != DialogResult.OK) return; /// Import a procedure from a file - Procedure newProcedure = Procedure.Import(new StreamReader(dlg.FileName, System.Text.Encoding.UTF8)); + Profile newProfile = Profile.Import(new StreamReader(dlg.FileName, System.Text.Encoding.UTF8)); - newProcedure.Name = newProcedure.Name + " imported"; - newProcedure.ItemNr = MyItems.Count; - newProcedure.ProcedureState = ProcedureState.Active; - newProcedure.Revision = 1; - newProcedure.PredecessorId = 0; - newProcedure.ObtainedByCopy = false; - newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName; - newProcedure.CreationTime = DateTime.Now; + newProfile.Name = newProfile.Name + " imported"; + newProfile.ItemNr = MyItems.Count; + newProfile.CreationUser = Users.GlobalData.CurrentUser.UserName; + newProfile.CreationTime = DateTime.Now; - if ((new TestProfileDlg(newProcedure, GetUsedNames(), true)).ShowDialog() == DialogResult.OK) + if ((new TestProfileDlg(newProfile, GetUsedNames(), true)).ShowDialog() == DialogResult.OK) { /// TODO: Make name uniqueness test parent.Unlock(); using (var transaction = session.BeginTransaction()) { - newProcedure.LastChgUser = Users.GlobalData.CurrentUser.UserName; - newProcedure.LastChgTime = DateTime.Now; + newProfile.LastChgUser = Users.GlobalData.CurrentUser.UserName; + newProfile.LastChgTime = DateTime.Now; - base.AddOne(newProcedure); - session.SaveOrUpdate(newProcedure); + base.AddOne(newProfile); + session.SaveOrUpdate(newProfile); transaction.Commit(); - MessageBox.Show(string.Format(Strings.Procedure_0_added, newProcedure.Name), + MessageBox.Show(string.Format(Strings.Procedure_0_added, newProfile.Name), Strings.Confirmation, MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -425,12 +404,12 @@ namespace TBF.UI.Bench.TestProfiles { if (SelectedItems.Count != 1) return; - Procedure selectedProcedure = (Procedure)SelectedItems[0].Tag; + Profile selectedProfile = (Profile)SelectedItems[0].Tag; OpenFileDialog dlg = new OpenFileDialog(); if (dlg.ShowDialog() == DialogResult.OK) { - string diff = selectedProcedure.Compare(new StreamReader(dlg.FileName, System.Text.Encoding.UTF8)); + string diff = selectedProfile.Compare(new StreamReader(dlg.FileName, System.Text.Encoding.UTF8)); if (!string.IsNullOrEmpty(diff)) { MessageBox.Show(diff, "Differences", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); diff --git a/TBF/UI/Procedures/ProcedureDlg.cs b/TBF/UI/Procedures/ProcedureDlg.cs index 96a3df081..c524b54e1 100644 --- a/TBF/UI/Procedures/ProcedureDlg.cs +++ b/TBF/UI/Procedures/ProcedureDlg.cs @@ -2381,8 +2381,8 @@ namespace TBF.UI.Procedures void SelectedIndexChanged(object sender, EventArgs e) { ListViewEx listViewEx = sender as ListViewEx; - if (listViewEx.SelectedItems.Count != 1) - { + if ((listViewEx == null) || (listViewEx.SelectedItems.Count != 1)) + { UpdateButtonStates(SharedButtons.SelectedItemPos.None); SelectedTestIx = -1; return;