diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs
index 871c2e0a8..c52dc4bf5 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.32.2026.0")]
-[assembly: AssemblyFileVersion("2.32.2026.0")]
+[assembly: AssemblyVersion("2.32.2027.0")]
+[assembly: AssemblyFileVersion("2.32.2027.0")]
diff --git a/TBF/Resources/Strings.Designer.cs b/TBF/Resources/Strings.Designer.cs
index 057c2a7e7..060eb17be 100644
--- a/TBF/Resources/Strings.Designer.cs
+++ b/TBF/Resources/Strings.Designer.cs
@@ -3823,11 +3823,11 @@ namespace TBF.Resources {
}
///
- /// Looks up a localized string similar to Print again.
+ /// Looks up a localized string similar to Print.
///
- internal static string Print_again {
+ internal static string Print {
get {
- return ResourceManager.GetString("Print_again", resourceCulture);
+ return ResourceManager.GetString("Print", resourceCulture);
}
}
@@ -3885,6 +3885,15 @@ namespace TBF.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Printer selection.
+ ///
+ internal static string Printer_selection {
+ get {
+ return ResourceManager.GetString("Printer_selection", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Printer.
///
diff --git a/TBF/Resources/Strings.cs.resx b/TBF/Resources/Strings.cs.resx
index c29a998bd..d7624f4f8 100644
--- a/TBF/Resources/Strings.cs.resx
+++ b/TBF/Resources/Strings.cs.resx
@@ -1683,4 +1683,10 @@
Konfigurace testu {0} : chybí {1}
+
+ Vytisknout
+
+
+ Výběr tiskárny
+
\ No newline at end of file
diff --git a/TBF/Resources/Strings.de.resx b/TBF/Resources/Strings.de.resx
index 7f614398a..99a0c7076 100644
--- a/TBF/Resources/Strings.de.resx
+++ b/TBF/Resources/Strings.de.resx
@@ -1278,8 +1278,8 @@
Volumen
-
- Druck wiederholen
+
+ Drucken
Anzeigen
diff --git a/TBF/Resources/Strings.fr.resx b/TBF/Resources/Strings.fr.resx
index 588c98bf0..1c9dd9e44 100644
--- a/TBF/Resources/Strings.fr.resx
+++ b/TBF/Resources/Strings.fr.resx
@@ -2010,4 +2010,7 @@
Inonder
+
+ Imprimer
+
\ No newline at end of file
diff --git a/TBF/Resources/Strings.it.resx b/TBF/Resources/Strings.it.resx
index 0b16b442c..81b8df69d 100644
--- a/TBF/Resources/Strings.it.resx
+++ b/TBF/Resources/Strings.it.resx
@@ -1533,9 +1533,6 @@
P delta
-
- stampa ancora
-
mostrare
@@ -1779,4 +1776,7 @@
Avviare il ciclo
+
+ Stampa
+
\ No newline at end of file
diff --git a/TBF/Resources/Strings.pl.resx b/TBF/Resources/Strings.pl.resx
index 6076c6f70..7c8988afd 100644
--- a/TBF/Resources/Strings.pl.resx
+++ b/TBF/Resources/Strings.pl.resx
@@ -1543,9 +1543,6 @@
P delta
-
- Wydrukuj jeszcze raz
-
Pokaż
@@ -1627,4 +1624,7 @@
Start cyklu
+
+ Wydruk
+
\ No newline at end of file
diff --git a/TBF/Resources/Strings.resx b/TBF/Resources/Strings.resx
index 907be4fd9..8bcef85a0 100644
--- a/TBF/Resources/Strings.resx
+++ b/TBF/Resources/Strings.resx
@@ -1531,8 +1531,8 @@
P delta
-
- Print again
+
+ Print
Show
@@ -2320,4 +2320,7 @@
no profile
+
+ Printer selection
+
\ No newline at end of file
diff --git a/TBF/Resources/Strings.ro.resx b/TBF/Resources/Strings.ro.resx
index 0956d0942..62ae77009 100644
--- a/TBF/Resources/Strings.ro.resx
+++ b/TBF/Resources/Strings.ro.resx
@@ -831,4 +831,7 @@
Evaporare
+
+ Imprimanta
+
\ No newline at end of file
diff --git a/TBF/Resources/Strings.ru.resx b/TBF/Resources/Strings.ru.resx
index ecdfcfb1d..4a955d370 100644
--- a/TBF/Resources/Strings.ru.resx
+++ b/TBF/Resources/Strings.ru.resx
@@ -1518,9 +1518,6 @@
P дельта
-
- Печатать снова
-
Показать
@@ -1599,4 +1596,7 @@
испарение
+
+ Печатать
+
\ No newline at end of file
diff --git a/TBF/Resources/Strings.zh-CN.resx b/TBF/Resources/Strings.zh-CN.resx
index 161d1de39..14131f371 100644
--- a/TBF/Resources/Strings.zh-CN.resx
+++ b/TBF/Resources/Strings.zh-CN.resx
@@ -1191,4 +1191,7 @@
蒸发
+
+ 打印机
+
\ No newline at end of file
diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj
index ccdec60bd..b2769a3af 100644
--- a/TBF/TBF.csproj
+++ b/TBF/TBF.csproj
@@ -2611,6 +2611,12 @@
PreviousResultsDlg.cs
+
+ Form
+
+
+ PrintResultsSelectionDlg.cs
+
Form
@@ -3591,6 +3597,9 @@
PreviousResultsDlg.cs
+
+ PrintResultsSelectionDlg.cs
+
ResultsArrangementDlg.cs
diff --git a/TBF/UI/MainWnd.cs.resx b/TBF/UI/MainWnd.cs.resx
index 1facc4366..6546f7e72 100644
--- a/TBF/UI/MainWnd.cs.resx
+++ b/TBF/UI/MainWnd.cs.resx
@@ -278,7 +278,7 @@
62, 20
- Postupy
+ Procedury
54, 20
diff --git a/TBF/UI/ResultsMI/PreviousResultCtrl.Designer.cs b/TBF/UI/ResultsMI/PreviousResultCtrl.Designer.cs
index 431d7a7b3..01d254fd0 100644
--- a/TBF/UI/ResultsMI/PreviousResultCtrl.Designer.cs
+++ b/TBF/UI/ResultsMI/PreviousResultCtrl.Designer.cs
@@ -62,6 +62,7 @@
this.sentCheckBox.TabIndex = 14;
this.sentCheckBox.Text = "Sent";
this.sentCheckBox.UseVisualStyleBackColor = true;
+ this.sentCheckBox.Visible = false;
//
// failedCountLabel
//
diff --git a/TBF/UI/ResultsMI/PreviousResultCtrl.cs b/TBF/UI/ResultsMI/PreviousResultCtrl.cs
index 478ee18b2..0a19f6195 100644
--- a/TBF/UI/ResultsMI/PreviousResultCtrl.cs
+++ b/TBF/UI/ResultsMI/PreviousResultCtrl.cs
@@ -13,7 +13,8 @@ namespace TBF.UI.ResultsMI
{
readonly PreviousResultsDlg parent;
readonly PreviousResultsMode mode;
-
+ readonly bool sendBtnIsPrint;
+
public int BatchNr;
public DateTime StarTime;
public DateTime EndTime;
@@ -58,27 +59,39 @@ namespace TBF.UI.ResultsMI
passedCountLabel.Text = string.Format("{0}: {1}", Strings.Passed, PassedCount);
failedCountLabel.Text = string.Format("{0}: {1}", Strings.Failed, FailedCount);
- switch (mode)
- {
- case PreviousResultsMode.Show: sendReloadButton.Text = Strings.Save_again; break;
- case PreviousResultsMode.Reload: sendReloadButton.Text = Strings.Restore; break;
- case PreviousResultsMode.Fix: sendReloadButton.Text = Strings.Fix; break;
- }
- showButton.Text = Strings.Show;
-#if MUNICH
- if (mode == PreviousResultsMode.Show) sendReloadButton.Text = Strings.Print_again;
- sentCheckBox.Text = Strings.Printed;
- sentCheckBox.Checked = Sent;
- sendReloadButton.Enabled = true; /// 'Print again' function always available
-#elif ORACLE_DB
+ /// 'Sent' check box
+#if ORACLE_DB
+ sentCheckBox.Visible = (mode == PreviousResultsMode.Show);
sentCheckBox.Text = Strings.Sent;
sentCheckBox.Checked = Sent;
- sendReloadButton.Enabled = (mode != PreviousResultsMode.Show) || !Sent;
-#else
- sentCheckBox.Visible = false;
- sendReloadButton.Enabled = (mode != PreviousResultsMode.Show);
- sendReloadButton.Visible = (mode != PreviousResultsMode.Show);
#endif
+
+ /// 'Send again'/'Print' button
+ sendBtnIsPrint = false;
+ switch (mode)
+ {
+ case PreviousResultsMode.Show:
+#if ORACLE_DB
+ sendReloadButton.Enabled = !Sent;
+ sendReloadButton.Text = Strings.Save_again;
+#else
+ sendReloadButton.Enabled = true; /// 'Print' function always available
+ sendReloadButton.Text = Strings.Print;
+ sendBtnIsPrint = true;
+#endif
+ break;
+ case PreviousResultsMode.Reload:
+ sendReloadButton.Enabled = true;
+ sendReloadButton.Text = Strings.Restore;
+ break;
+ case PreviousResultsMode.Fix:
+ sendReloadButton.Enabled = true;
+ sendReloadButton.Text = Strings.Fix;
+ break;
+ }
+
+ /// 'Show' button
+ showButton.Text = Strings.Show;
}
public void UpdateSentState(bool sent)
@@ -100,7 +113,11 @@ namespace TBF.UI.ResultsMI
private void sendReloadButton_MouseClick(object sender, MouseEventArgs e)
{
- if (mode == PreviousResultsMode.Show)
+ if (sendBtnIsPrint)
+ {
+ parent.OnPrint(this, new PreviousResultIdEventArgs(BatchNr, SerialNrs));
+ }
+ else if (mode == PreviousResultsMode.Show)
{
parent.OnSendAgain(this, new PreviousResultIdEventArgs(BatchNr, SerialNrs));
}
diff --git a/TBF/UI/ResultsMI/PreviousResultsDlg.cs b/TBF/UI/ResultsMI/PreviousResultsDlg.cs
index f78d9fc8f..14f5aa16b 100644
--- a/TBF/UI/ResultsMI/PreviousResultsDlg.cs
+++ b/TBF/UI/ResultsMI/PreviousResultsDlg.cs
@@ -14,6 +14,8 @@ using Oracle.DataAccess.Client;
using Common;
using Results;
using Results.Entities;
+using TBF.Rig.Generic;
+using TBF.Rig.GenericDevices;
using TBF.Rig.Output.DB.SensusOracle;
using TBF.Rig.Sequences;
using TBF.Resources;
@@ -48,6 +50,12 @@ namespace TBF.UI.ResultsMI
this.mode = mode;
currentBatchNr = Program.LocalSettings.BatchNr;
+ PrintHandler += delegate(object sndr, PreviousResultIdEventArgs args)
+ {
+ if (InvokeRequired) { Invoke(new EventHandler(DoPrint), sndr, args); }
+ else DoPrint(sndr, args);
+ };
+
SendAgainHandler += delegate(object sndr, PreviousResultIdEventArgs args)
{
if (InvokeRequired) { Invoke(new EventHandler(DoSendAgain), sndr, args); }
@@ -208,9 +216,52 @@ namespace TBF.UI.ResultsMI
- public event EventHandler SendAgainHandler;
+ public event EventHandler PrintHandler;
- ///
+ ///
+ /// Called from PreviousResultCtrl when 'Print' button pressed.
+ ///
+ public void OnPrint(object sender, PreviousResultIdEventArgs data)
+ {
+ if (PrintHandler == null) return;
+ try
+ {
+ PrintHandler(sender, data);
+ }
+ catch (Exception e)
+ {
+ log.Error("PrintHandler(...) failed", e);
+ }
+ }
+
+ public void DoPrint(object sender, PreviousResultIdEventArgs data)
+ {
+ foreach (var b in batches)
+ {
+ if (b.BatchNr == data.BatchNr)
+ {
+ IList printers = new List();
+ foreach (var c in TBF.Rig.StateMachine.Components)
+ {
+ if (c is IResultsPrinter) printers.Add(c as IResultsPrinter);
+ }
+ var dlg = new PrintResultsSelectionDlg(printers);
+ if (dlg.ShowDialog() != DialogResult.OK) return;
+
+ TBF.Rig.IOperation printResultsOp = dlg.SelectedPrinter.ProcessResultsOp(b);
+ printResultsOp.Start();
+ TBF.Rig.Event e;
+ do { e = printResultsOp.Run(); }
+ while (e != TBF.Rig.Event.ResultsPrinted && e != TBF.Rig.Event.ErrorProcessingResults);
+ printResultsOp.Stop();
+ }
+ }
+ }
+
+
+ public event EventHandler SendAgainHandler;
+
+ ///
/// Called from PreviousResultCtrl when 'Send again' button pressed.
///
public void OnSendAgain(object sender, PreviousResultIdEventArgs data)
diff --git a/TBF/UI/ResultsMI/PrintResultsSelectionDlg.Designer.cs b/TBF/UI/ResultsMI/PrintResultsSelectionDlg.Designer.cs
new file mode 100644
index 000000000..1ed538db9
--- /dev/null
+++ b/TBF/UI/ResultsMI/PrintResultsSelectionDlg.Designer.cs
@@ -0,0 +1,100 @@
+namespace TBF.UI.ResultsMI
+{
+ partial class PrintResultsSelectionDlg
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.printersComboBox = new System.Windows.Forms.ComboBox();
+ this.printerLabel = new System.Windows.Forms.Label();
+ this.okButton = new System.Windows.Forms.Button();
+ this.cancelButton = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // printersComboBox
+ //
+ this.printersComboBox.FormattingEnabled = true;
+ this.printersComboBox.Location = new System.Drawing.Point(121, 27);
+ this.printersComboBox.Name = "printersComboBox";
+ this.printersComboBox.Size = new System.Drawing.Size(392, 21);
+ this.printersComboBox.TabIndex = 0;
+ //
+ // printerLabel
+ //
+ this.printerLabel.AutoSize = true;
+ this.printerLabel.Location = new System.Drawing.Point(36, 30);
+ this.printerLabel.Name = "printerLabel";
+ this.printerLabel.Size = new System.Drawing.Size(37, 13);
+ this.printerLabel.TabIndex = 1;
+ this.printerLabel.Text = "Printer";
+ //
+ // okButton
+ //
+ this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.okButton.Location = new System.Drawing.Point(305, 68);
+ this.okButton.Name = "okButton";
+ this.okButton.Size = new System.Drawing.Size(92, 40);
+ this.okButton.TabIndex = 4;
+ this.okButton.Text = "OK";
+ this.okButton.UseVisualStyleBackColor = true;
+ this.okButton.Click += new System.EventHandler(this.okButton_Click);
+ //
+ // cancelButton
+ //
+ this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.cancelButton.Location = new System.Drawing.Point(421, 68);
+ this.cancelButton.Name = "cancelButton";
+ this.cancelButton.Size = new System.Drawing.Size(92, 40);
+ this.cancelButton.TabIndex = 5;
+ this.cancelButton.Text = "Cancel";
+ this.cancelButton.UseVisualStyleBackColor = true;
+ this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
+ //
+ // PrintResultsSelectionDlg
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(546, 127);
+ this.Controls.Add(this.cancelButton);
+ this.Controls.Add(this.okButton);
+ this.Controls.Add(this.printerLabel);
+ this.Controls.Add(this.printersComboBox);
+ this.Name = "PrintResultsSelectionDlg";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "Database and water meter selection";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ComboBox printersComboBox;
+ private System.Windows.Forms.Label printerLabel;
+ private System.Windows.Forms.Button okButton;
+ private System.Windows.Forms.Button cancelButton;
+ }
+}
\ No newline at end of file
diff --git a/TBF/UI/ResultsMI/PrintResultsSelectionDlg.cs b/TBF/UI/ResultsMI/PrintResultsSelectionDlg.cs
new file mode 100644
index 000000000..01a4cb943
--- /dev/null
+++ b/TBF/UI/ResultsMI/PrintResultsSelectionDlg.cs
@@ -0,0 +1,62 @@
+///
+/// Copyright (c) 2023 Sensus Slovensko a.s.
+///
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using TBF.Resources;
+using TBF.Rig.GenericDevices;
+
+namespace TBF.UI.ResultsMI
+{
+ public partial class PrintResultsSelectionDlg : Form
+ {
+ readonly IList printers;
+ public IResultsPrinter SelectedPrinter;
+
+ public PrintResultsSelectionDlg(IList printers)
+ {
+ this.printers = printers;
+
+ InitializeComponent();
+
+ Localize();
+
+ if (printers != null)
+ foreach (var p in printers)
+ printersComboBox.Items.Add(p.Name);
+ }
+
+ void Localize()
+ {
+ Text = Strings.Printer_selection;
+ printerLabel.Text = Strings.Printer;
+ okButton.Text = Strings.OkBtnText;
+ cancelButton.Text = Strings.CancelBtnText;
+ }
+
+ private void okButton_Click(object sender, EventArgs e)
+ {
+ if (printersComboBox.SelectedItem != null)
+ {
+ SelectedPrinter = printers.FirstOrDefault(x => x.Name == printersComboBox.SelectedItem.ToString());
+ }
+
+ if (SelectedPrinter == null)
+ {
+ MessageBox.Show("Invalid selection");
+ return;
+ }
+
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+
+ private void cancelButton_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+ }
+}
diff --git a/TBF/UI/ResultsMI/PrintResultsSelectionDlg.resx b/TBF/UI/ResultsMI/PrintResultsSelectionDlg.resx
new file mode 100644
index 000000000..1af7de150
--- /dev/null
+++ b/TBF/UI/ResultsMI/PrintResultsSelectionDlg.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file