diff --git a/Results/Entities/Batch.cs b/Results/Entities/Batch.cs index b77d535b1..afdc9a3a8 100644 --- a/Results/Entities/Batch.cs +++ b/Results/Entities/Batch.cs @@ -29,7 +29,17 @@ namespace Results.Entities public virtual float DensityCorr { get; set; } /// Density correction in [kg/m3] public virtual float Custom2 { get; set; } public virtual float Custom3 { get; set; } - public virtual DateTime StartTime { get; set; } + public virtual int Counter1 { get; set; } + public virtual int Counter2 { get; set; } + public virtual int Counter3 { get; set; } + public virtual int Counter4 { get; set; } + public virtual int Counter5 { get; set; } + public virtual int Counter6 { get; set; } + public virtual int Counter7 { get; set; } + public virtual int Counter8 { get; set; } + public virtual int Counter9 { get; set; } + public virtual int Counter10 { get; set; } + public virtual DateTime StartTime { get; set; } public virtual DateTime EndTime { get; set; } public virtual bool Dirty { get; set; } public virtual bool RsltsSent { get; set; } @@ -38,7 +48,7 @@ namespace Results.Entities public virtual IList WaterMeters { get; set; } public virtual IList TestRslts { get; set; } public virtual bool Compound { get; set; } /// Not mapped to DB now - public virtual bool HeatMeter { get; set; } /// Not mapped to DB now + public virtual bool HeatMeter { get; set; } /// Not mapped to DB now /// public Batch() { diff --git a/Results/ItemID.cs b/Results/ItemID.cs index 61b76c265..025a5e3a5 100644 --- a/Results/ItemID.cs +++ b/Results/ItemID.cs @@ -303,6 +303,17 @@ namespace Results RefFlowmeter, /// 257 Test_Method_Elde, /// 258 + Counter1, /// 259 counterIdx0 = 0 + Counter2, /// 260 counterIdx0 = 1 + Counter3, /// 261 counterIdx0 = 2 + Counter4, /// 262 counterIdx0 = 3 + Counter5, /// 263 counterIdx0 = 4 + Counter6, /// 264 counterIdx0 = 5 + Counter7, /// 265 counterIdx0 = 6 + Counter8, /// 266 counterIdx0 = 7 + Counter9, /// 267 counterIdx0 = 8 + Counter10, /// 268 counterIdx0 = 9 + Count, } } diff --git a/Results/Properties/AssemblyInfo.cs b/Results/Properties/AssemblyInfo.cs index 30a3a0285..91e3f123c 100644 --- a/Results/Properties/AssemblyInfo.cs +++ b/Results/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.18.1209.0")] -[assembly: AssemblyFileVersion("2.18.1209.0")] +[assembly: AssemblyVersion("2.18.1213.0")] +[assembly: AssemblyFileVersion("2.18.1213.0")] diff --git a/Results/Resources/Strings.Designer.cs b/Results/Resources/Strings.Designer.cs index 5efbb5155..260ef23e7 100644 --- a/Results/Resources/Strings.Designer.cs +++ b/Results/Resources/Strings.Designer.cs @@ -204,6 +204,15 @@ namespace Results.Resources { } } + /// + /// Looks up a localized string similar to Counter {0}. + /// + internal static string Counter_0 { + get { + return ResourceManager.GetString("Counter_0", resourceCulture); + } + } + /// /// Looks up a localized string similar to Density. /// diff --git a/Results/Resources/Strings.resx b/Results/Resources/Strings.resx index 087105b98..11c20851a 100644 --- a/Results/Resources/Strings.resx +++ b/Results/Resources/Strings.resx @@ -765,4 +765,7 @@ Test in progress + + Counter {0} + \ No newline at end of file diff --git a/Results/Utils.cs b/Results/Utils.cs index b771c3281..1a5a40c9c 100644 --- a/Results/Utils.cs +++ b/Results/Utils.cs @@ -82,5 +82,23 @@ namespace Results return (useRedGreenColor) ? (passed ? "OK|Green" : "NOK|Red") : (passed ? "OK|White" : "NOK|White"); #endif } + + + public static void GetCounterStates(Results.Entities.Batch batch, int[] counters) + { + if (batch != null) + { + batch.Counter1 = ((counters != null) && (counters.Length >= 1)) ? counters[0] : 0; + batch.Counter2 = ((counters != null) && (counters.Length >= 2)) ? counters[1] : 0; + batch.Counter3 = ((counters != null) && (counters.Length >= 3)) ? counters[2] : 0; + batch.Counter4 = ((counters != null) && (counters.Length >= 4)) ? counters[3] : 0; + batch.Counter5 = ((counters != null) && (counters.Length >= 5)) ? counters[4] : 0; + batch.Counter6 = ((counters != null) && (counters.Length >= 6)) ? counters[5] : 0; + batch.Counter7 = ((counters != null) && (counters.Length >= 7)) ? counters[6] : 0; + batch.Counter8 = ((counters != null) && (counters.Length >= 8)) ? counters[7] : 0; + batch.Counter9 = ((counters != null) && (counters.Length >= 9)) ? counters[8] : 0; + batch.Counter10 = ((counters != null) && (counters.Length >= 10)) ? counters[9] : 0; + } + } } } diff --git a/Results/WMeterRsltItemSpec.cs b/Results/WMeterRsltItemSpec.cs index 43c83d6cd..e7403428c 100644 --- a/Results/WMeterRsltItemSpec.cs +++ b/Results/WMeterRsltItemSpec.cs @@ -480,7 +480,18 @@ namespace Results AllItems.Add(new WMeterRsltItemSpec(ItemID.Table_row_nr, "Table row #", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? TableRowNr.ToString() : string.Format(f, TableRowNr))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Table_column_nr, "Table column #", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? TableColumnNr.ToString() : string.Format(f, TableColumnNr))); AllItems.Add(new WMeterRsltItemSpec(ItemID.WMRemark, string.Format("{0} {1}", Strings.Water_Meter, Strings.Remark), Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.Remark))); - } + + AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter1, string.Format(Strings.Counter_0, 1), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter1))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter2, string.Format(Strings.Counter_0, 2), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter2))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter3, string.Format(Strings.Counter_0, 3), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter3))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter4, string.Format(Strings.Counter_0, 4), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter4))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter5, string.Format(Strings.Counter_0, 5), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter5))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter6, string.Format(Strings.Counter_0, 6), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter6))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter7, string.Format(Strings.Counter_0, 7), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter7))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter8, string.Format(Strings.Counter_0, 8), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter8))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter9, string.Format(Strings.Counter_0, 9), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter9))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter10, string.Format(Strings.Counter_0, 10), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter10))); + } /// To be updated by Output.FileWriter or Output.Printer public static int TableRowNr; diff --git a/TBF/BenchControl/Sequences/MainSeq.cs b/TBF/BenchControl/Sequences/MainSeq.cs index ff29fe1e0..88487a560 100644 --- a/TBF/BenchControl/Sequences/MainSeq.cs +++ b/TBF/BenchControl/Sequences/MainSeq.cs @@ -1187,8 +1187,13 @@ namespace TBF.BenchControl.Sequences dataEntryCmpnt.UpdateTestResults(BatchRslts); } - ProcessData.BatchRslts.Batch.EndTime = DateTime.Now; - ProcessData.BatchRslts.AddWaterMetersToBatch(); + if (TBF.BenchControl.Sequences.ProcessData.BatchRslts != null && Program.LocalSettings != null) + { + Results.Utils.GetCounterStates(ProcessData.BatchRslts.Batch, Program.LocalSettings.Counters); + } + + ProcessData.BatchRslts.Batch.EndTime = DateTime.Now; + ProcessData.BatchRslts.AddWaterMetersToBatch(); //------------------------------------------------------ Bridge.OnActivity(this, Strings.Saving_and_printing_results); diff --git a/TBF/BenchControl/TestMethods/Counter/CounterSeq.cs b/TBF/BenchControl/TestMethods/Counter/CounterSeq.cs index 3ce57aa35..d56ac6d04 100644 --- a/TBF/BenchControl/TestMethods/Counter/CounterSeq.cs +++ b/TBF/BenchControl/TestMethods/Counter/CounterSeq.cs @@ -19,9 +19,21 @@ namespace TBF.BenchControl.TestMethods.Counter /// /// Event.Done . . . . . . . OK /// - public IList Execute(Test test, int repetitionNr, bool isLastRepetition, DebugMode mode) + public IList Execute(Test test, int counterIdx0, int repetitionNr, bool isLastRepetition, DebugMode mode) { + if (Program.LocalSettings.Counters == null || Program.LocalSettings.Counters.Length < counterIdx0 + 1) + { + int[] oriCounters = Program.LocalSettings.Counters; + Program.LocalSettings.Counters = new int[counterIdx0 + 1]; + if (oriCounters != null) + { + for (int i = 0; i < oriCounters.Length; i++) Program.LocalSettings.Counters[i] = oriCounters[i]; + } + } + Program.LocalSettings.Counters[counterIdx0] = Program.LocalSettings.Counters[counterIdx0] + 1; + + TBF.UiBridge.Bridge.OnSaveSettings(this, null); return new List { Event.Done }; } diff --git a/TBF/BenchControl/TestMethods/Counter/TestMethod.cs b/TBF/BenchControl/TestMethods/Counter/TestMethod.cs index f3690c540..7e6171be7 100644 --- a/TBF/BenchControl/TestMethods/Counter/TestMethod.cs +++ b/TBF/BenchControl/TestMethods/Counter/TestMethod.cs @@ -17,6 +17,21 @@ namespace TBF.BenchControl.TestMethods.Counter public bool CanTest(MetersKind meters) { return true; } public bool DoTransitions() { return false; } + + /// + /// Enumeration of counters via static fields and methods + /// + static int nextCounterIdx = 0; + public static new void ResetStaticProperties() + { + nextCounterIdx = 0; + } + public static int CountersCount { get { return nextCounterIdx; } } + public static TestMethod[] Counters; + /// + private int counterIdx0; /// 0-based index of this counter + + public TestMethod() { } @@ -24,12 +39,22 @@ namespace TBF.BenchControl.TestMethods.Counter public TestMethod(Generic.IComponentCfg cfg) : base(cfg) { - log.Debug(this.ToString()); + counterIdx0 = nextCounterIdx++; + /// + if (Counters == null || Counters.Length < nextCounterIdx) + { + TestMethod[] contersSoFar = Counters; + Counters = new TestMethod[nextCounterIdx]; + if (contersSoFar != null) for (int i = 0; i < contersSoFar.Length; i++) Counters[i] = contersSoFar[i]; + Counters[nextCounterIdx - 1] = this; + } + + log.Debug(this.ToString()); } public IList Execute(Test test, int repetNr, bool isLastRepetition) { - return (new CounterSeq()).Execute(test, repetNr, isLastRepetition, DebugLevel); + return (new CounterSeq()).Execute(test, counterIdx0, repetNr, isLastRepetition, DebugLevel); } } } diff --git a/TBF/LocalSettings.cs b/TBF/LocalSettings.cs index ac7413c3e..767b1fcb9 100644 --- a/TBF/LocalSettings.cs +++ b/TBF/LocalSettings.cs @@ -80,7 +80,9 @@ namespace TBF public int PopupResultsHeight; public Config.Entities.CameraDisplayResolution Resolution; - + + [XmlArrayAttribute("Counters")] + public int[] Counters; [XmlArrayAttribute("ComponentsColumnWidths")] public int[] ComponentsColumnWidths; diff --git a/TBF/MainWnd.Designer.cs b/TBF/MainWnd.Designer.cs index 9652b9a46..9f1dcff23 100644 --- a/TBF/MainWnd.Designer.cs +++ b/TBF/MainWnd.Designer.cs @@ -54,7 +54,7 @@ namespace TBF this.horizontalSplitContainer = new System.Windows.Forms.SplitContainer(); this.mainTabControl = new System.Windows.Forms.TabControl(); this.homeTabPage = new System.Windows.Forms.TabPage(); - this.ctrlBrdComponent = new ControlComponent3Munich.UserControl1(); + this.ctrlBrdComponent = new ControlComponent3Munich.UserControl1(); this.processTabPage = new System.Windows.Forms.TabPage(); this.processTabPageCtrl = new TBF.Screens.ProcessTabPageCtrl6(); this.insertTabPage = new System.Windows.Forms.TabPage(); @@ -91,6 +91,7 @@ namespace TBF this.databaseSettingsTSMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.passwortToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.upgradeTSMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.iPerlHeadsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpTSMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutTSMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.mainMenuStrip = new System.Windows.Forms.MenuStrip(); @@ -98,7 +99,7 @@ namespace TBF this.processToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.resultsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.graphsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.iPerlHeadsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.clearCountersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)(this.topVerticalSplitContainer)).BeginInit(); this.topVerticalSplitContainer.Panel1.SuspendLayout(); this.topVerticalSplitContainer.Panel2.SuspendLayout(); @@ -496,7 +497,8 @@ namespace TBF this.databaseSettingsTSMenuItem, this.passwortToolStripMenuItem, this.upgradeTSMenuItem, - this.iPerlHeadsToolStripMenuItem}); + this.iPerlHeadsToolStripMenuItem, + this.clearCountersToolStripMenuItem}); this.editTSMenuItem.Name = "editTSMenuItem"; resources.ApplyResources(this.editTSMenuItem, "editTSMenuItem"); // @@ -529,6 +531,12 @@ namespace TBF resources.ApplyResources(this.upgradeTSMenuItem, "upgradeTSMenuItem"); this.upgradeTSMenuItem.Click += new System.EventHandler(this.upgradeTSMenuItem_Click); // + // iPerlHeadsToolStripMenuItem + // + this.iPerlHeadsToolStripMenuItem.Name = "iPerlHeadsToolStripMenuItem"; + resources.ApplyResources(this.iPerlHeadsToolStripMenuItem, "iPerlHeadsToolStripMenuItem"); + this.iPerlHeadsToolStripMenuItem.Click += new System.EventHandler(this.iPerlHeadsToolStripMenuItem_Click); + // // helpTSMenuItem // this.helpTSMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -581,11 +589,11 @@ namespace TBF resources.ApplyResources(this.graphsToolStripMenuItem, "graphsToolStripMenuItem"); this.graphsToolStripMenuItem.Click += new System.EventHandler(this.graphsToolStripMenuItem_Click); // - // iPerlHeadsToolStripMenuItem + // clearCountersToolStripMenuItem // - this.iPerlHeadsToolStripMenuItem.Name = "iPerlHeadsToolStripMenuItem"; - resources.ApplyResources(this.iPerlHeadsToolStripMenuItem, "iPerlHeadsToolStripMenuItem"); - this.iPerlHeadsToolStripMenuItem.Click += new System.EventHandler(this.iPerlHeadsToolStripMenuItem_Click); + this.clearCountersToolStripMenuItem.Name = "clearCountersToolStripMenuItem"; + resources.ApplyResources(this.clearCountersToolStripMenuItem, "clearCountersToolStripMenuItem"); + this.clearCountersToolStripMenuItem.Click += new System.EventHandler(this.clearCountersToolStripMenuItem_Click); // // MainWnd // @@ -735,6 +743,7 @@ namespace TBF private System.Windows.Forms.TabPage graphsTabPage; private Screens.GraphsTabPageCtrl graphsTabPageCtrl; private System.Windows.Forms.ToolStripMenuItem iPerlHeadsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem clearCountersToolStripMenuItem; } } diff --git a/TBF/MainWnd.cs b/TBF/MainWnd.cs index 3ef4ef9be..f8e5623aa 100644 --- a/TBF/MainWnd.cs +++ b/TBF/MainWnd.cs @@ -266,6 +266,12 @@ namespace TBF if (InvokeRequired) { Invoke(new EventHandler(OnProcedureSelected), sndr, args); } else OnProcedureSelected(sndr, args); }; + + Bridge.SaveSettingsHandler += delegate(object sndr, UiBridge.SaveSettingsEventArgs args) + { + if (InvokeRequired) { Invoke(new EventHandler(OnSaveSettings), sndr, args); } + else OnSaveSettings(sndr, args); + }; } catch (Exception exc) { @@ -448,6 +454,11 @@ namespace TBF IsShutdownDisabled = ((args.Flags & ButtonsEtc.ProcedureCmbBoxEn) == 0); } + void OnSaveSettings(object sender, SaveSettingsEventArgs args) + { + if (Program.LocalSettings != null) Program.LocalSettings.Save(); + } + public void UpdateUser() { userInfoStatusLabel.Text = string.Format("{0}: {1}{2}, ", Strings.User, Users.GlobalData.CurrentUser.UserName, @@ -792,5 +803,27 @@ namespace TBF UpdateUser(); } } + + private void clearCountersToolStripMenuItem_Click(object sender, EventArgs e) + { + Users.Grp.GID[] reqGrpMembership = new Users.Grp.GID[] + { + Users.Grp.GID.TestingSpecialists, + Users.Grp.GID.Metrologists, + Users.Grp.GID.HeadOfLab, + Users.Grp.GID.Administrators, + }; + + if (new Users.Forms.LoginDlg(reqGrpMembership).ShowDialog() == DialogResult.OK) + { + if ((Program.LocalSettings != null) && (Program.LocalSettings.Counters != null)) + { + for (int i = 0; i < Program.LocalSettings.Counters.Length; i++) + { + Program.LocalSettings.Counters[i] = 0; + } + } + } + } } } diff --git a/TBF/MainWnd.resx b/TBF/MainWnd.resx index c4903f1e1..32990f739 100644 --- a/TBF/MainWnd.resx +++ b/TBF/MainWnd.resx @@ -598,7 +598,7 @@ ctrlBrdComponent - ControlComponent_Torino2015.UserControl1, ControlComponent3U, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + ControlComponent3Munich.UserControl1, ControlComponent3Munich, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null homeTabPage @@ -652,7 +652,7 @@ processTabPageCtrl - TBF.Screens.ProcessTabPageCtrl48, TBF, Version=2.18.933.0, Culture=neutral, PublicKeyToken=null + TBF.Screens.ProcessTabPageCtrl6, TBF, Version=2.18.1211.0, Culture=neutral, PublicKeyToken=null processTabPage @@ -730,7 +730,7 @@ resultsTabPageCtrl - TBF.Screens.ResultsTabPageCtrl, TBF, Version=2.18.933.0, Culture=neutral, PublicKeyToken=null + TBF.Screens.ResultsTabPageCtrl, TBF, Version=2.18.1211.0, Culture=neutral, PublicKeyToken=null resultsTabPage @@ -781,7 +781,7 @@ graphsTabPageCtrl - TBF.Screens.GraphsTabPageCtrl, TBF, Version=2.18.933.0, Culture=neutral, PublicKeyToken=null + TBF.Screens.GraphsTabPageCtrl, TBF, Version=2.18.1211.0, Culture=neutral, PublicKeyToken=null graphsTabPage @@ -835,7 +835,7 @@ logsTabPageCtrl - TBF.Screens.LogsTabPageCtrl, TBF, Version=2.18.933.0, Culture=neutral, PublicKeyToken=null + TBF.Screens.LogsTabPageCtrl, TBF, Version=2.18.1211.0, Culture=neutral, PublicKeyToken=null logsTabPage @@ -886,7 +886,7 @@ picturesTabPageCtrl - TBF.Screens.PicturesTabPageCtrl, TBF, Version=2.18.933.0, Culture=neutral, PublicKeyToken=null + TBF.Screens.PicturesTabPageCtrl, TBF, Version=2.18.1211.0, Culture=neutral, PublicKeyToken=null picturesTabPage @@ -1132,7 +1132,7 @@ MeasurementTabPageCtrl - TBF.Screens.MeasurementTabPageCtrl, TBF, Version=2.18.933.0, Culture=neutral, PublicKeyToken=null + TBF.Screens.MeasurementTabPageCtrl, TBF, Version=2.18.1211.0, Culture=neutral, PublicKeyToken=null measurementTabPage @@ -1198,34 +1198,34 @@ 1 - 143, 22 + 152, 22 Components - 143, 22 + 152, 22 Paths - 143, 22 + 152, 22 Transitions - 143, 22 + 152, 22 Metrology - 140, 6 + 149, 6 - 143, 22 + 152, 22 Exit @@ -1255,41 +1255,47 @@ Logs - 133, 22 + 152, 22 Users - 133, 22 + 152, 22 Language - 133, 22 + 152, 22 Database - 133, 22 + 152, 22 Password - 133, 22 + 152, 22 Upgrade - 133, 22 + 152, 22 iPerl Heads + + 152, 22 + + + Clear Counters + 61, 20 @@ -1297,7 +1303,7 @@ Settings - 107, 22 + 152, 22 About @@ -1536,6 +1542,12 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + clearCountersToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + MainWnd diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index 040827be2..b17253647 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.18.1211.0")] -[assembly: AssemblyFileVersion("2.18.1211.0")] +[assembly: AssemblyVersion("2.18.1213.0")] +[assembly: AssemblyFileVersion("2.18.1213.0")] diff --git a/TBF/Screens/ResultsTabPageCtrl.cs b/TBF/Screens/ResultsTabPageCtrl.cs index 9cc4e55fc..71df44af5 100644 --- a/TBF/Screens/ResultsTabPageCtrl.cs +++ b/TBF/Screens/ResultsTabPageCtrl.cs @@ -92,12 +92,20 @@ namespace TBF.Screens void OnProcedureSelected(object sender, ProcedureSelectedEventArgs args) { - RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts); + if ((TBF.BenchControl.Sequences.ProcessData.BatchRslts != null) && (Program.LocalSettings != null)) + { + Results.Utils.GetCounterStates(TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch, Program.LocalSettings.Counters); + } + RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts); } void OnTestCompleted(object sender, TestCompletedEventArgs args) { - RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts); + if ((TBF.BenchControl.Sequences.ProcessData.BatchRslts != null) && (Program.LocalSettings != null)) + { + Results.Utils.GetCounterStates(TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch, Program.LocalSettings.Counters); + } + RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts); } void OnButtonsEtc(object sender, UiBridge.ButtonsEtcEventArgs args) @@ -140,7 +148,10 @@ namespace TBF.Screens label5.Text = "Vrátiť na predch. krok"; label5.Visible = true; #endif - + if ((TBF.BenchControl.Sequences.ProcessData.BatchRslts != null) && (Program.LocalSettings != null)) + { + Results.Utils.GetCounterStates(TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch, Program.LocalSettings.Counters); + } RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts); } @@ -209,7 +220,11 @@ namespace TBF.Screens Program.LocalSettings.Save(); } - RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts); + if ((TBF.BenchControl.Sequences.ProcessData.BatchRslts != null) && (Program.LocalSettings != null)) + { + Results.Utils.GetCounterStates(TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch, Program.LocalSettings.Counters); + } + RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts); } /// @@ -573,7 +588,11 @@ namespace TBF.Screens } Program.LocalSettings.Save(); - RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts); + if ((TBF.BenchControl.Sequences.ProcessData.BatchRslts != null) && (Program.LocalSettings != null)) + { + Results.Utils.GetCounterStates(TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch, Program.LocalSettings.Counters); + } + RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts); } } } diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj index c7bd31327..e74cd1db3 100644 --- a/TBF/TBF.csproj +++ b/TBF/TBF.csproj @@ -2179,6 +2179,7 @@ + diff --git a/TBF/UiBridge/Bridge.cs b/TBF/UiBridge/Bridge.cs index 336717c41..bb5e959a5 100644 --- a/TBF/UiBridge/Bridge.cs +++ b/TBF/UiBridge/Bridge.cs @@ -253,5 +253,16 @@ namespace TBF.UiBridge catch (Exception e) { log.Error("ImageHandler(...) failed", e); } } public static event EventHandler ImageHandler; + + /// + /// Called from TestMethods.Counter component when counters in LocalSettings should be saved. + /// + public static void OnSaveSettings(object sender, SaveSettingsEventArgs data) + { + if (SaveSettingsHandler == null) return; + try { SaveSettingsHandler(sender, data); } + catch (Exception e) { log.Error("SaveSettingsHandler(...) failed", e); } + } + public static event EventHandler SaveSettingsHandler; } } diff --git a/TBF/UiBridge/SaveSettingsEventArgs.cs b/TBF/UiBridge/SaveSettingsEventArgs.cs new file mode 100644 index 000000000..fcdbe69dd --- /dev/null +++ b/TBF/UiBridge/SaveSettingsEventArgs.cs @@ -0,0 +1,14 @@ +/// +/// Copyright (c) 2019 Sensus Slovensko a.s. +/// +using System; + +namespace TBF.UiBridge +{ + public class SaveSettingsEventArgs : EventArgs + { + public SaveSettingsEventArgs() + { + } + } +}