diff --git a/TestBenchFramework/BenchControl/Cameras/IdcCamera/IdcCameraCfgCtrl.designer.cs b/TestBenchFramework/BenchControl/Cameras/IdcCamera/IdcCameraCfgCtrl.designer.cs index 5e40a189e..e90be6d37 100644 --- a/TestBenchFramework/BenchControl/Cameras/IdcCamera/IdcCameraCfgCtrl.designer.cs +++ b/TestBenchFramework/BenchControl/Cameras/IdcCamera/IdcCameraCfgCtrl.designer.cs @@ -112,6 +112,7 @@ // // baudRateComboBox // + this.baudRateComboBox.Enabled = false; this.baudRateComboBox.FormattingEnabled = true; this.baudRateComboBox.Location = new System.Drawing.Point(139, 99); this.baudRateComboBox.Name = "baudRateComboBox"; diff --git a/TestBenchFramework/BenchControl/ResultsWriters/Basic/Writer.cs b/TestBenchFramework/BenchControl/ResultsWriters/Basic/Writer.cs index 3a985924a..4198b593b 100644 --- a/TestBenchFramework/BenchControl/ResultsWriters/Basic/Writer.cs +++ b/TestBenchFramework/BenchControl/ResultsWriters/Basic/Writer.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using log4net; using TBF.BenchControl; +using TBF.Resources; namespace TBF.BenchControl.ResultsWriters.Basic { @@ -23,7 +24,7 @@ namespace TBF.BenchControl.ResultsWriters.Basic /// Results to print /// IList results; - DateTime now; + DateTime dateTime; StreamWriter writer; public Writer(WriterCfg cfg) @@ -33,6 +34,50 @@ namespace TBF.BenchControl.ResultsWriters.Basic log.Debug(this.ToString()); } + /// + /// Returns a file name derived from a DateTime structure. + /// Creates directories on this path as a side effect. + /// + /// Date and time + /// File name + string GetFilename(DateTime time) + { + Directory.CreateDirectory(writerCfg.DestinationPath); + + string directory = string.Format("{0}{1}\\", writerCfg.DestinationPath, time.Year.ToString()); + Directory.CreateDirectory(directory); + + string monthStr /* = now.Month.ToString("D2")*/; + switch (time.Month) + { + default: + case 1: monthStr = "January"; break; + case 2: monthStr = "February"; break; + case 3: monthStr = "March"; break; + case 4: monthStr = "April"; break; + case 5: monthStr = "May"; break; + case 6: monthStr = "June"; break; + case 7: monthStr = "July"; break; + case 8: monthStr = "August"; break; + case 9: monthStr = "September"; break; + case 10: monthStr = "October"; break; + case 11: monthStr = "November"; break; + case 12: monthStr = "December"; break; + } + + directory = string.Format("{0}{1}\\", directory, monthStr); + Directory.CreateDirectory(directory); + + if (writerCfg.DayFolders) + { + directory = string.Format("{0}{1}\\", directory, time.Day.ToString("D2")); + Directory.CreateDirectory(directory); + } + + return string.Format("{0}{1}{2}{3}-{4}{5}.txt", directory, (time.Year % 100).ToString("D2"), + time.Month.ToString("D2"), time.Day.ToString("D2"), time.Hour.ToString("D2"), time.Minute.ToString("D2")); + } + /// /// Writes the test cycle results into a file, Events: Event.ResultsWritten /// @@ -60,15 +105,10 @@ namespace TBF.BenchControl.ResultsWriters.Basic } this.results = results; - now = DateTime.Now; try { - string dayDirectory = string.Format("{0}Results\\{1}-{2}-{3}", Program.HomeDir, - now.Year, now.Month.ToString("D2"), now.Day.ToString("D2")); - string fileName = string.Format("{0}\\{1}-{2}.txt", dayDirectory, - now.Hour.ToString("D2"), now.Minute.ToString("D2")); - Directory.CreateDirectory(dayDirectory); - writer = new StreamWriter(System.IO.File.Create(fileName)); + dateTime = DateTime.Now; + writer = new StreamWriter(System.IO.File.Create(GetFilename(dateTime))); } catch { @@ -83,54 +123,182 @@ namespace TBF.BenchControl.ResultsWriters.Basic { if (writer == null) return; - writer.WriteLine("Staatlich anerkante Prüfstelle für Meßgeräte für Wasser WB2"); - writer.WriteLine(""); - writer.WriteLine(string.Format(" PROTOKOLL Nummer {0}", 0)); - writer.WriteLine(""); - writer.WriteLine("Ver. 3/13"); - writer.WriteLine(string.Format("Datum / Zeit : {0}.{1}.{2} {3}:{4} Seite : 1/1", - now.Day.ToString("D2"), - now.Month.ToString("D2"), - now.Year.ToString("D4"), - now.Hour.ToString("D2"), - now.Minute.ToString("D2"))); - writer.WriteLine(string.Format("Wasserzähler Type : {0}", results[0].ProcedureName)); - writer.WriteLine("Gerät Nr. : 1"); - writer.WriteLine(string.Format("Benutzer : {0}", Entities.User.CurrentUser.Name)); - writer.Write("Impulsrate : "); - for (int i = 0; i < Program.WMsCount; i++) - { - //writer.Write(results[0]. - } - writer.WriteLine("Bereich : 22,9 °C 947 mbar 43 %"); - writer.WriteLine(""); - - foreach (var item in resultItems) writer.Write(item.ClmnHeaderText); + ///---------- + /// Header + ///---------- + writer.WriteLine(results[0].ProtocolTitle); writer.WriteLine(string.Empty); - writer.WriteLine("---------------------------------------------------------------------------------------------------------------------------------------"); + string[] leftColumn = new string[] + { + "Cycle number: ", + "Date and time: ", + "Procedure:", + Strings.User_, + "Ambient temperature: ", + "Ambient pressure: ", + "Ambient humidity: ", + }; + + string[] rightColumn = new string[] + { + results[0].CycleNr.ToString(), + //dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString(), + string.Format("{0}.{1}.{2} {3}:{4}", dateTime.Year.ToString("D4"), + dateTime.Month.ToString("D2"), + dateTime.Day.ToString("D2"), + dateTime.Hour.ToString("D2"), + dateTime.Minute.ToString("D2")), + results[0].ProcedureName, + Entities.User.CurrentUser.Name, + results[0].AmbientTempAve.ToString("F1") + " °C", + results[0].AmbientPressAve.ToString("F0") + " mbar", + results[0].AmbientHumiAve.ToString("F0") + " %", + }; + + /// Determine max. left column width in characters + int maxLen = 0; + foreach (var s in leftColumn) if (s.Length > maxLen) maxLen = s.Length; + + /// Write aligned columns + for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++) + { + writer.Write(leftColumn[i]); + writer.Write(new string(' ', maxLen - leftColumn[i].Length + 3)); + writer.WriteLine(rightColumn[i]); + } + writer.WriteLine(string.Empty); + writer.WriteLine(string.Empty); + + ///-------- + /// Body + ///-------- + int nrWMs = (combined ? Program.WMsCount / 2 : Program.WMsCount); + if (combined) + { + for (int wmNr = 0; wmNr < Program.WMsCount / 2; wmNr++) WriteCombinedWM(wmNr); + } + else + { + for (int wmNr = 0; wmNr < Program.WMsCount; wmNr++) WriteSingleWM(wmNr); + } + } + + /// + /// Write one water meter results + /// + /// Water meter number + void WriteSingleWM(int wmNr) + { + /// Determin column widths + int[] columnWidths = new int[resultItems.Count]; + int totalWidth = 0; + for (int i = 0; i < resultItems.Count; i++) + { + columnWidths[i] = resultItems[i].ClmnHeaderText.Length; + foreach (var tr in results) + { + int len = resultItems[i].Print(tr.Meters[wmNr]).Length; + if (len > columnWidths[i]) columnWidths[i] = len; + } + totalWidth += columnWidths[i]; + } + totalWidth += 3 * (resultItems.Count - 1); + + writer.WriteLine(string.Format("Water meter {0}, s/n: {1}", wmNr + 1, results[0].Meters[wmNr].SerialNr)); + + writer.WriteLine(new String('-', totalWidth)); + + for (int i = 0; i < resultItems.Count; i++) + { + writer.Write(resultItems[i].ClmnHeaderText); + + if (i < resultItems.Count - 1) + writer.Write(new string(' ', columnWidths[i] - resultItems[i].ClmnHeaderText.Length + 3)); + else + writer.WriteLine(string.Empty); + } + + writer.WriteLine(new String('-', totalWidth)); + + foreach (var tr in results) + { + for (int i = 0; i < resultItems.Count; i++) + { + string text = resultItems[i].Print(tr.Meters[wmNr]); + writer.Write(text); + + if (i < resultItems.Count - 1) + writer.Write(new string(' ', columnWidths[i] - text.Length + 3)); + else + writer.WriteLine(string.Empty); + } + } + + writer.WriteLine(new String('-', totalWidth)); + writer.WriteLine(string.Empty); + writer.WriteLine(string.Empty); + } + + /// + /// Write one combined water meter results + /// + /// Water meter number + void WriteCombinedWM(int wmNr) + { + /// Determin column widths + int[] columnWidths = new int[resultItems.Count]; + int totalWidth = 0; + for (int i = 0; i < resultItems.Count; i++) + { + columnWidths[i] = resultItems[i].ClmnHeaderText.Length; + foreach (var tr in results) + { + int len = resultItems[i].PrintCombined(tr.Meters[2*wmNr], tr.Meters[2*wmNr+1], tr.CombinedMeters[wmNr]).Length; + if (len > columnWidths[i]) columnWidths[i] = len; + } + totalWidth += columnWidths[i]; + } + totalWidth += 3 * (resultItems.Count - 1); + + writer.WriteLine(string.Format("Water meter {0}, Main s/n: {1}, Aux. s/n:{2}", wmNr + 1, results[0].Meters[2 * wmNr].SerialNr, results[0].Meters[2 * wmNr + 1].SerialNr)); + + writer.WriteLine(new String('-', totalWidth)); + + for (int i = 0; i < resultItems.Count; i++) + { + writer.Write(resultItems[i].ClmnHeaderText); + + if (i < resultItems.Count - 1) + writer.Write(new string(' ', columnWidths[i] - resultItems[i].ClmnHeaderText.Length + 3)); + else + writer.WriteLine(string.Empty); + } + + writer.WriteLine(new String('-', totalWidth)); foreach (var tr in results) { - foreach (var item in resultItems) - { - if (combined) - { - writer.Write(item.PrintCombined(tr.CombinedMeters[0], tr.Meters[0], tr.Meters[1])); - } - else - { - writer.Write(item.Print(tr.Meters[0])); - } - } + foreach (var item in resultItems) writer.Write(item.PrintCombined(tr.Meters[2 * wmNr], tr.Meters[2 * wmNr + 1], tr.CombinedMeters[wmNr]) + " "); writer.WriteLine(string.Empty); } - - writer.WriteLine("---------------------------------------------------------------------------------------------------------------------------------------"); - writer.WriteLine("No| Zähler Nr| Test. Volume [L] | Zählerabweichung [%] | Messunsicherheit k=2 |Prüfergebnis"); - writer.WriteLine("---------------------------------------------------------------------------------------------------------------------------------------"); - writer.WriteLine(" Qmin Qt Qmax Qmin Qt Qmax Qmin Qt Qmax"); - writer.WriteLine("---------------------------------------------------------------------------------------------------------------------------------------"); + foreach (var tr in results) + { + for (int i = 0; i < resultItems.Count; i++) + { + string text = resultItems[i].PrintCombined(tr.Meters[2 * wmNr], tr.Meters[2 * wmNr + 1], tr.CombinedMeters[wmNr]); + writer.Write(text); + + if (i < resultItems.Count - 1) + writer.Write(new string(' ', columnWidths[i] - text.Length + 3)); + else + writer.WriteLine(string.Empty); + } + } + + writer.WriteLine(new String('-', totalWidth)); + writer.WriteLine(string.Empty); + writer.WriteLine(string.Empty); } /// Run this operation @@ -143,19 +311,6 @@ namespace TBF.BenchControl.ResultsWriters.Basic /// Stop this operation public void Stop() { - if (writer == null) return; - - writer.WriteLine("---------------------------------------------------------------------------------------------------------------------------------------"); - writer.WriteLine(""); - writer.WriteLine("Hersteller : Bemerkung : M - Prüfung gegen Waage"); - writer.WriteLine(" V - Prüfung gegen MID"); - writer.WriteLine(" P - Start / Stopp"); - writer.WriteLine(" F - Fliegender Start"); - writer.WriteLine(" S - Impulskompensation"); - writer.WriteLine(" C - Impulszählung"); - writer.WriteLine(""); - writer.WriteLine("---------------------------------------------------------------------------------------------------------------------------------------"); - if (writer != null) writer.Close(); writer = null; } diff --git a/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfg.cs b/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfg.cs index 474ccaa32..2d5ab6e6e 100644 --- a/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfg.cs +++ b/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfg.cs @@ -11,11 +11,18 @@ namespace TBF.BenchControl.ResultsWriters.Basic public IComponent GetComponent(IList components) { return new Writer(this); } public IComponentCfgCtrl GetControl() { return new WriterCfgCtrl(); } + + public string DestinationPath; /// Directory path into which the results will be saved + public bool DayFolders; + + /// Private parameterless constructor invoked by all other (public) constructors WriterCfg() { Name = "BasicResultsWriter"; ParentName = string.Empty; + + DestinationPath = Program.HomeDir + "Results\\"; } public WriterCfg(IComponentFactory factory) diff --git a/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfgCtrl.cs b/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfgCtrl.cs index 9ab7ed75e..67bade0fb 100644 --- a/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfgCtrl.cs +++ b/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfgCtrl.cs @@ -41,11 +41,16 @@ namespace TBF.BenchControl.ResultsWriters.Basic if (config == null) return; /// Control was not loaded, settings were not changed classNameLabel.Text = config.Factory.ClassName; nameTextBox.Text = config.Name; + destinationTextBox.Text = config.DestinationPath; + dayFoldersCheckBox.Checked = config.DayFolders; } public void Unlock() { nameTextBox.Enabled = true; + destinationTextBox.Enabled = true; + destinationButton.Enabled = true; + dayFoldersCheckBox.Enabled = true; } public CfgUpdateFlags VerifyCfg(ref string message) @@ -56,13 +61,31 @@ namespace TBF.BenchControl.ResultsWriters.Basic public CfgUpdateFlags UpdateCfg() { - CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd; + CfgUpdateFlags flags = CfgUpdateFlags.None; if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed - config.Name = nameTextBox.Text; + if (config.Name != nameTextBox.Text) { config.Name = nameTextBox.Text; flags = CfgUpdateFlags.RestartRqrd; } + + if (config.DestinationPath != destinationTextBox.Text) + { + config.DestinationPath = destinationTextBox.Text; + if (!config.DestinationPath.EndsWith("\\")) config.DestinationPath += "\\"; + flags = CfgUpdateFlags.RestartRqrd; + } + + if (dayFoldersCheckBox.Checked != config.DayFolders) + { + config.DayFolders = dayFoldersCheckBox.Checked; + flags = CfgUpdateFlags.RestartRqrd; + } return flags; } + + private void destinationButton_Click(object sender, EventArgs e) + { + + } } } diff --git a/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfgCtrl.designer.cs b/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfgCtrl.designer.cs index a4907d37d..f80ace079 100644 --- a/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfgCtrl.designer.cs +++ b/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfgCtrl.designer.cs @@ -31,20 +31,24 @@ this.nameTextBox = new System.Windows.Forms.TextBox(); this.nameLabel = new System.Windows.Forms.Label(); this.classNameLabel = new System.Windows.Forms.Label(); + this.destinationTextBox = new System.Windows.Forms.TextBox(); + this.destinationLabel = new System.Windows.Forms.Label(); + this.dayFoldersCheckBox = new System.Windows.Forms.CheckBox(); + this.destinationButton = new System.Windows.Forms.Button(); this.SuspendLayout(); // // nameTextBox // this.nameTextBox.Enabled = false; - this.nameTextBox.Location = new System.Drawing.Point(137, 57); + this.nameTextBox.Location = new System.Drawing.Point(110, 57); this.nameTextBox.Name = "nameTextBox"; - this.nameTextBox.Size = new System.Drawing.Size(130, 20); + this.nameTextBox.Size = new System.Drawing.Size(146, 20); this.nameTextBox.TabIndex = 5; // // nameLabel // this.nameLabel.AutoSize = true; - this.nameLabel.Location = new System.Drawing.Point(27, 60); + this.nameLabel.Location = new System.Drawing.Point(19, 60); this.nameLabel.Name = "nameLabel"; this.nameLabel.Size = new System.Drawing.Size(35, 13); this.nameLabel.TabIndex = 4; @@ -53,20 +57,63 @@ // classNameLabel // this.classNameLabel.AutoSize = true; - this.classNameLabel.Location = new System.Drawing.Point(134, 33); + this.classNameLabel.Location = new System.Drawing.Point(107, 33); this.classNameLabel.Name = "classNameLabel"; this.classNameLabel.Size = new System.Drawing.Size(83, 13); this.classNameLabel.TabIndex = 3; this.classNameLabel.Text = "ComonentName"; // - // BasicPrinterCfgCtrl + // destinationTextBox + // + this.destinationTextBox.Enabled = false; + this.destinationTextBox.Location = new System.Drawing.Point(110, 83); + this.destinationTextBox.Name = "destinationTextBox"; + this.destinationTextBox.Size = new System.Drawing.Size(146, 20); + this.destinationTextBox.TabIndex = 7; + // + // destinationLabel + // + this.destinationLabel.AutoSize = true; + this.destinationLabel.Location = new System.Drawing.Point(19, 86); + this.destinationLabel.Name = "destinationLabel"; + this.destinationLabel.Size = new System.Drawing.Size(60, 13); + this.destinationLabel.TabIndex = 6; + this.destinationLabel.Text = "Destination"; + // + // dayFoldersCheckBox + // + this.dayFoldersCheckBox.AutoSize = true; + this.dayFoldersCheckBox.Enabled = false; + this.dayFoldersCheckBox.Location = new System.Drawing.Point(110, 109); + this.dayFoldersCheckBox.Name = "dayFoldersCheckBox"; + this.dayFoldersCheckBox.Size = new System.Drawing.Size(160, 17); + this.dayFoldersCheckBox.TabIndex = 15; + this.dayFoldersCheckBox.Text = "Separate folder for each day"; + this.dayFoldersCheckBox.UseVisualStyleBackColor = true; + // + // destinationButton + // + this.destinationButton.Enabled = false; + this.destinationButton.Location = new System.Drawing.Point(261, 83); + this.destinationButton.Name = "destinationButton"; + this.destinationButton.Size = new System.Drawing.Size(30, 20); + this.destinationButton.TabIndex = 16; + this.destinationButton.Text = "..."; + this.destinationButton.UseVisualStyleBackColor = true; + this.destinationButton.Click += new System.EventHandler(this.destinationButton_Click); + // + // WriterCfgCtrl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.destinationButton); + this.Controls.Add(this.dayFoldersCheckBox); + this.Controls.Add(this.destinationTextBox); + this.Controls.Add(this.destinationLabel); this.Controls.Add(this.nameTextBox); this.Controls.Add(this.nameLabel); this.Controls.Add(this.classNameLabel); - this.Name = "BasicPrinterCfgCtrl"; + this.Name = "WriterCfgCtrl"; this.Size = new System.Drawing.Size(300, 200); this.Load += new System.EventHandler(this.WriterCfgCtrl_Load); this.ResumeLayout(false); @@ -79,5 +126,9 @@ private System.Windows.Forms.TextBox nameTextBox; private System.Windows.Forms.Label nameLabel; private System.Windows.Forms.Label classNameLabel; + private System.Windows.Forms.TextBox destinationTextBox; + private System.Windows.Forms.Label destinationLabel; + private System.Windows.Forms.CheckBox dayFoldersCheckBox; + private System.Windows.Forms.Button destinationButton; } } diff --git a/TestBenchFramework/Entities/Procedure.cs b/TestBenchFramework/Entities/Procedure.cs index 128b8e93f..69136c618 100644 --- a/TestBenchFramework/Entities/Procedure.cs +++ b/TestBenchFramework/Entities/Procedure.cs @@ -20,6 +20,7 @@ namespace TBF.Entities public virtual DateTime LastChgTime { get; set; } /// Date and time of the creation or change public virtual string LongDescription { get; set; } /// Long description (notes) public virtual string Watermeters { get; set; } /// Water meter name or Id + public virtual string ProtocolTitle { get; set; } /// Title of the printed and saved protocol public virtual string DataEntry { get; set; } /// Component to use for data entry public virtual string ResultsPrinter { get; set; } /// Component to use for printing the results diff --git a/TestBenchFramework/Entities/TestResult.cs b/TestBenchFramework/Entities/TestResult.cs index 1c895a520..d22b2a2b4 100644 --- a/TestBenchFramework/Entities/TestResult.cs +++ b/TestBenchFramework/Entities/TestResult.cs @@ -14,6 +14,8 @@ namespace TBF.Entities /// Value copied from the procedure (Entities.Procedure) public virtual string ProcedureName { get; set; } + public virtual string ProtocolTitle { get; set; } + /// Values copied from the test (Entities.Test) public virtual int TestId { get; set; } /// Test entity ID to distinguish between tests with the same name public virtual string TestName { get; set; } @@ -131,6 +133,7 @@ namespace TBF.Entities /// Copy test parameters from Entities.Procedure object ProcedureName = test.Procedure.Name; + ProtocolTitle = test.Procedure.ProtocolTitle; /// Copy test parameters from Entities.Test object TestId = test.Id; diff --git a/TestBenchFramework/Forms/ResultItemSpec.cs b/TestBenchFramework/Forms/ResultItemSpec.cs index 14de032d9..75913e2bb 100644 --- a/TestBenchFramework/Forms/ResultItemSpec.cs +++ b/TestBenchFramework/Forms/ResultItemSpec.cs @@ -44,7 +44,7 @@ namespace TBF.Forms AllItems = new List(); /// Common - AllItems.Add(new ResultItemSpec("Test name", Strings.Name, x => x.TestResult.TestName, + AllItems.Add(new ResultItemSpec("Test name", "Test", x => x.TestResult.TestName, (x, y, z) => x.TestResult.TestName)); AllItems.Add(new ResultItemSpec("Procedure name", Strings.Procedure, x => x.TestResult.ProcedureName, (x, y, z) => x.TestResult.ProcedureName)); @@ -56,11 +56,11 @@ namespace TBF.Forms (x, y, z) => x.TestResult.Qfrom.ToString("F3"))); AllItems.Add(new ResultItemSpec("Q to", Strings.Q_to_m3h, x => x.TestResult.Qto.ToString("F3"), (x, y, z) => x.TestResult.Qto.ToString("F3"))); - AllItems.Add(new ResultItemSpec("Test volume", "Volume [l]", x => x.TestResult.Volume.ToString("F1"), + AllItems.Add(new ResultItemSpec("Test volume", "Test vol. [l]", x => x.TestResult.Volume.ToString("F1"), (x, y, z) => x.TestResult.Volume.ToString("F1"))); - AllItems.Add(new ResultItemSpec("Error limit Lo", "ErrLimLo [%]", x => x.TestResult.ErrLimLo.ToString("F1"), + AllItems.Add(new ResultItemSpec("Error limit Lo", "Err.Lim.Lo [%]", x => x.TestResult.ErrLimLo.ToString("F1"), (x, y, z) => x.TestResult.ErrLimLo.ToString("F1"))); - AllItems.Add(new ResultItemSpec("Error limit Hi", "ErrLimHi [%]", x => x.TestResult.ErrLimHi.ToString("F1"), + AllItems.Add(new ResultItemSpec("Error limit Hi", "Err.Lim.Hi [%]", x => x.TestResult.ErrLimHi.ToString("F1"), (x, y, z) => x.TestResult.ErrLimHi.ToString("F1"))); /// Test results @@ -82,7 +82,7 @@ namespace TBF.Forms (x, y, z) => z.TestResult.PressInAvrg.ToString("F3"))); AllItems.Add(new ResultItemSpec("P out", Strings.P_out, x => x.TestResult.PressOutAvrg.ToString("F3"), (x, y, z) => z.TestResult.PressOutAvrg.ToString("F3"))); - AllItems.Add(new ResultItemSpec("Reference error", "E r [%]", x => x.TestResult.ErrorMaster.ToString("F3"), + AllItems.Add(new ResultItemSpec("Reference error", "Err.ref. [%]", x => x.TestResult.ErrorMaster.ToString("F3"), (x, y, z) => z.TestResult.ErrorMaster.ToString("F3"))); AllItems.Add(new ResultItemSpec("Ambient temperature", "T amb", x => x.TestResult.AmbientTempAve.ToString("F1"), (x, y, z) => z.TestResult.AmbientTempAve.ToString("F1"))); @@ -92,9 +92,9 @@ namespace TBF.Forms (x, y, z) => z.TestResult.AmbientHumiAve.ToString("F1"))); /// Single and combined meter results - AllItems.Add(new ResultItemSpec("Volume", "V [l]", x => x.VolumeMeter.ToString("F3"), + AllItems.Add(new ResultItemSpec("Volume", "Volume [l]", x => x.VolumeMeter.ToString("F3"), (x, y, z) => z.VolumeMeter.ToString("F3"))); - AllItems.Add(new ResultItemSpec("Reference volume", "V ref [l]", x => x.VolumeRef.ToString("F3"), + AllItems.Add(new ResultItemSpec("Reference volume", "Vol.ref. [l]", x => x.VolumeRef.ToString("F3"), (x, y, z) => z.VolumeRef.ToString("F3"))); AllItems.Add(new ResultItemSpec("Error", "Error [%]", x => x.VolumeErrorPct.ToString("F2"), (x, y, z) => z.VolumeErrorPct.ToString("F2"))); diff --git a/TestBenchFramework/Mappings/ProcedureMap.cs b/TestBenchFramework/Mappings/ProcedureMap.cs index 0092f4488..c057e5d75 100644 --- a/TestBenchFramework/Mappings/ProcedureMap.cs +++ b/TestBenchFramework/Mappings/ProcedureMap.cs @@ -18,6 +18,7 @@ namespace TBF.Mappings Map(x => x.LastChgTime); Map(x => x.LongDescription); Map(x => x.Watermeters); + Map(x => x.ProtocolTitle); Map(x => x.DataEntry); Map(x => x.ResultsPrinter); Map(x => x.ResultsWriter); diff --git a/TestBenchFramework/Mappings/TestResultMap.cs b/TestBenchFramework/Mappings/TestResultMap.cs index 959aa5014..a50ff77ab 100644 --- a/TestBenchFramework/Mappings/TestResultMap.cs +++ b/TestBenchFramework/Mappings/TestResultMap.cs @@ -17,6 +17,7 @@ namespace TBF.Mappings .Cascade.All(); Map(x => x.ProcedureName); + Map(x => x.ProtocolTitle); Map(x => x.TestId); Map(x => x.TestName); diff --git a/TestBenchFramework/ProcedureDlg.Designer.cs b/TestBenchFramework/ProcedureDlg.Designer.cs index 1962be26f..42a1206b2 100644 --- a/TestBenchFramework/ProcedureDlg.Designer.cs +++ b/TestBenchFramework/ProcedureDlg.Designer.cs @@ -71,9 +71,11 @@ this.metrology2ListViewEx = new TBF.UiControls.ListViewEx(); this.processTabPage = new System.Windows.Forms.TabPage(); this.processListViewEx = new TBF.UiControls.ListViewEx(); - this.sharedButtons = new TBF.UiControls.SharedButtons(); this.parametersTabPage = new System.Windows.Forms.TabPage(); this.parametersListViewEx = new TBF.UiControls.ListViewEx(); + this.sharedButtons = new TBF.UiControls.SharedButtons(); + this.protocolTitleTextBox = new System.Windows.Forms.TextBox(); + this.protocolTitleLabel = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).BeginInit(); this.mainSplitContainer.Panel1.SuspendLayout(); this.mainSplitContainer.Panel2.SuspendLayout(); @@ -116,6 +118,8 @@ // // generalTabPage // + this.generalTabPage.Controls.Add(this.protocolTitleTextBox); + this.generalTabPage.Controls.Add(this.protocolTitleLabel); this.generalTabPage.Controls.Add(this.metersKindRadioButton2); this.generalTabPage.Controls.Add(this.metersKindRadioButton1); this.generalTabPage.Controls.Add(this.transitionEndComboBox); @@ -406,11 +410,6 @@ this.processListViewEx.View = System.Windows.Forms.View.Details; this.processListViewEx.SelectedIndexChanged += new System.EventHandler(this.processListViewEx_SelectedIndexChanged); // - // sharedButtons - // - resources.ApplyResources(this.sharedButtons, "sharedButtons"); - this.sharedButtons.Name = "sharedButtons"; - // // parametersTabPage // this.parametersTabPage.Controls.Add(this.parametersListViewEx); @@ -428,6 +427,22 @@ this.parametersListViewEx.UseCompatibleStateImageBehavior = false; this.parametersListViewEx.View = System.Windows.Forms.View.Details; // + // sharedButtons + // + resources.ApplyResources(this.sharedButtons, "sharedButtons"); + this.sharedButtons.Name = "sharedButtons"; + // + // protocolTitleTextBox + // + resources.ApplyResources(this.protocolTitleTextBox, "protocolTitleTextBox"); + this.protocolTitleTextBox.Name = "protocolTitleTextBox"; + // + // protocolTitleLabel + // + resources.ApplyResources(this.protocolTitleLabel, "protocolTitleLabel"); + this.protocolTitleLabel.ImageKey = global::TBF.Resources.Strings.String1; + this.protocolTitleLabel.Name = "protocolTitleLabel"; + // // ProcedureDlg // resources.ApplyResources(this, "$this"); @@ -498,6 +513,8 @@ private System.Windows.Forms.RadioButton metersKindRadioButton1; private System.Windows.Forms.TabPage parametersTabPage; private UiControls.ListViewEx parametersListViewEx; + private System.Windows.Forms.TextBox protocolTitleTextBox; + private System.Windows.Forms.Label protocolTitleLabel; } } \ No newline at end of file diff --git a/TestBenchFramework/ProcedureDlg.cs b/TestBenchFramework/ProcedureDlg.cs index a8bed1845..ce95ec6e2 100644 --- a/TestBenchFramework/ProcedureDlg.cs +++ b/TestBenchFramework/ProcedureDlg.cs @@ -236,6 +236,7 @@ namespace TBF procNameTextBox.Enabled = false; descriptionTextBox.Enabled = false; watermetersTextBox.Enabled = false; + protocolTitleTextBox.Enabled = false; dataEntryComboBox.Enabled = false; metersKindRadioButton1.Enabled = false; metersKindRadioButton2.Enabled = false; @@ -285,6 +286,8 @@ namespace TBF { lastChangedOnTextBox.Text = LoadedProcedure.LastChgTime.ToShortDateString(); } + watermetersTextBox.Text = LoadedProcedure.Watermeters; + protocolTitleTextBox.Text = LoadedProcedure.ProtocolTitle; metersKindRadioButton1.Checked = (LoadedProcedure.MetersKind == MetersKind.Single); metersKindRadioButton2.Checked = (LoadedProcedure.MetersKind == MetersKind.Combined); notesTextBox.Text = LoadedProcedure.LongDescription; @@ -305,6 +308,8 @@ namespace TBF LoadedProcedure.LastChgTime = DateTime.Now; LoadedProcedure.LongDescription = notesTextBox.Text; LoadedProcedure.Watermeters = watermetersTextBox.Text; + LoadedProcedure.ProtocolTitle = protocolTitleTextBox.Text; + LoadedProcedure.MetersKind = (metersKindRadioButton1.Checked ? MetersKind.Single : MetersKind.Combined); if (dataEntryComboBox.Items.Contains(dataEntryComboBox.Text)) @@ -977,6 +982,7 @@ namespace TBF procNameTextBox.Enabled = true; descriptionTextBox.Enabled = true; watermetersTextBox.Enabled = true; + protocolTitleTextBox.Enabled = true; dataEntryComboBox.Enabled = true; metersKindRadioButton1.Enabled = true; metersKindRadioButton2.Enabled = true; diff --git a/TestBenchFramework/ProcedureDlg.resx b/TestBenchFramework/ProcedureDlg.resx index 11e79888b..21280e561 100644 --- a/TestBenchFramework/ProcedureDlg.resx +++ b/TestBenchFramework/ProcedureDlg.resx @@ -129,6 +129,57 @@ 0, 0 + + 139, 156 + + + 522, 20 + + + 33 + + + protocolTitleTextBox + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + generalTabPage + + + 0 + + + True + + + NoControl + + + 24, 159 + + + 65, 13 + + + 32 + + + Protocol title + + + protocolTitleLabel + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + generalTabPage + + + 1 + True @@ -136,7 +187,7 @@ NoControl - 27, 178 + 98, 184 72, 17 @@ -157,13 +208,13 @@ generalTabPage - 0 + 2 True - 27, 160 + 27, 184 54, 17 @@ -184,10 +235,10 @@ generalTabPage - 1 + 3 - 139, 313 + 139, 318 121, 21 @@ -205,7 +256,7 @@ generalTabPage - 2 + 4 True @@ -214,7 +265,7 @@ NoControl - 24, 318 + 24, 323 63, 13 @@ -235,10 +286,10 @@ generalTabPage - 3 + 5 - 139, 286 + 139, 291 121, 21 @@ -256,7 +307,7 @@ generalTabPage - 4 + 6 True @@ -265,7 +316,7 @@ NoControl - 27, 289 + 27, 294 71, 13 @@ -286,10 +337,10 @@ generalTabPage - 5 + 7 - 139, 259 + 139, 264 121, 21 @@ -307,10 +358,10 @@ generalTabPage - 6 + 8 - 139, 231 + 139, 236 121, 21 @@ -328,10 +379,10 @@ generalTabPage - 7 + 9 - 139, 203 + 139, 208 121, 21 @@ -349,7 +400,7 @@ generalTabPage - 8 + 10 True @@ -358,7 +409,7 @@ NoControl - 24, 264 + 24, 269 70, 13 @@ -379,7 +430,7 @@ generalTabPage - 9 + 11 True @@ -388,7 +439,7 @@ NoControl - 24, 236 + 24, 241 74, 13 @@ -409,7 +460,7 @@ generalTabPage - 10 + 12 True @@ -418,7 +469,7 @@ NoControl - 25, 206 + 25, 211 57, 13 @@ -439,10 +490,10 @@ generalTabPage - 11 + 13 - 344, 199 + 344, 204 True @@ -463,7 +514,7 @@ generalTabPage - 12 + 14 True @@ -472,7 +523,7 @@ NoControl - 291, 202 + 291, 207 35, 13 @@ -493,10 +544,10 @@ generalTabPage - 13 + 15 - 139, 135 + 139, 127 522, 20 @@ -514,7 +565,7 @@ generalTabPage - 14 + 16 True @@ -523,7 +574,7 @@ NoControl - 24, 138 + 24, 130 94, 13 @@ -544,10 +595,10 @@ generalTabPage - 15 + 17 - 344, 106 + 344, 98 97, 20 @@ -565,7 +616,7 @@ generalTabPage - 16 + 18 True @@ -574,7 +625,7 @@ NoControl - 291, 109 + 291, 101 30, 13 @@ -595,10 +646,10 @@ generalTabPage - 17 + 19 - 139, 106 + 139, 98 121, 20 @@ -616,7 +667,7 @@ generalTabPage - 18 + 20 True @@ -625,7 +676,7 @@ NoControl - 24, 109 + 24, 101 86, 13 @@ -646,10 +697,10 @@ generalTabPage - 19 + 21 - 344, 78 + 344, 70 97, 20 @@ -667,7 +718,7 @@ generalTabPage - 20 + 22 True @@ -676,7 +727,7 @@ NoControl - 291, 81 + 291, 73 30, 13 @@ -697,10 +748,10 @@ generalTabPage - 21 + 23 - 139, 78 + 139, 70 121, 20 @@ -718,7 +769,7 @@ generalTabPage - 22 + 24 True @@ -727,7 +778,7 @@ NoControl - 24, 81 + 24, 73 58, 13 @@ -748,10 +799,10 @@ generalTabPage - 23 + 25 - 139, 49 + 139, 41 522, 20 @@ -769,7 +820,7 @@ generalTabPage - 24 + 26 True @@ -778,7 +829,7 @@ NoControl - 24, 52 + 24, 44 86, 13 @@ -799,10 +850,10 @@ generalTabPage - 25 + 27 - 139, 21 + 139, 13 217, 20 @@ -820,7 +871,7 @@ generalTabPage - 26 + 28 True @@ -829,7 +880,7 @@ NoControl - 24, 24 + 24, 16 85, 13 @@ -850,7 +901,7 @@ generalTabPage - 27 + 29 4, 34