ResultsBrowser : Any IResultsPrinter component from TBF can be used to print results, ver. 2.18.851
This commit is contained in:
parent
9931138e5d
commit
1593dc3070
@ -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.847.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.847.0")]
|
||||
[assembly: AssemblyVersion("2.18.851.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.851.0")]
|
||||
|
||||
@ -813,4 +813,13 @@
|
||||
<data name="Configure_printer" xml:space="preserve">
|
||||
<value>Configure printer</value>
|
||||
</data>
|
||||
<data name="No_printer_defined" xml:space="preserve">
|
||||
<value>No printer defined</value>
|
||||
</data>
|
||||
<data name="Printing_failed" xml:space="preserve">
|
||||
<value>Printing failed</value>
|
||||
</data>
|
||||
<data name="Printing_completed" xml:space="preserve">
|
||||
<value>Printing completed</value>
|
||||
</data>
|
||||
</root>
|
||||
27
ResultsBrowser/Resources/Strings1.Designer.cs
generated
27
ResultsBrowser/Resources/Strings1.Designer.cs
generated
@ -1644,6 +1644,15 @@ namespace ResultsBrowser.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to No printer defined.
|
||||
/// </summary>
|
||||
internal static string No_printer_defined {
|
||||
get {
|
||||
return ResourceManager.GetString("No_printer_defined", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to No program settings found. .
|
||||
/// </summary>
|
||||
@ -1770,6 +1779,24 @@ namespace ResultsBrowser.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Printing completed.
|
||||
/// </summary>
|
||||
internal static string Printing_completed {
|
||||
get {
|
||||
return ResourceManager.GetString("Printing_completed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Printing failed.
|
||||
/// </summary>
|
||||
internal static string Printing_failed {
|
||||
get {
|
||||
return ResourceManager.GetString("Printing_failed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Procedure.
|
||||
/// </summary>
|
||||
|
||||
@ -6,6 +6,7 @@ using NHibernate;
|
||||
using Results.Entities;
|
||||
using TBF.BenchControl;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using ResultsBrowser.Filters;
|
||||
using ResultsBrowser.Resources;
|
||||
|
||||
@ -25,6 +26,9 @@ namespace ResultsBrowser
|
||||
DateTime timePeriodStart;
|
||||
DateTime timePeriodEnd;
|
||||
|
||||
static IList<IComponent> tbfComponents;
|
||||
static IList<IDevice> tbfDevices;
|
||||
|
||||
public ResultsBrowserWnd(string[] args)
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -33,6 +37,9 @@ namespace ResultsBrowser
|
||||
filtersConfig = new FiltersConfig();
|
||||
this.args = args;
|
||||
|
||||
tbfComponents = new List<TBF.BenchControl.Generic.IComponent>();
|
||||
tbfDevices = new List<IDevice>();
|
||||
|
||||
timePeriodStart = new DateTime(0);
|
||||
timePeriodEnd = new DateTime(0);
|
||||
}
|
||||
@ -405,12 +412,63 @@ namespace ResultsBrowser
|
||||
"0111-OOP-C035-13").Print();
|
||||
}
|
||||
#else
|
||||
foreach (var wm in waterMeters)
|
||||
{
|
||||
new Results.Output.Printers.Munich.MunichPrintDocument(string.Format("4/13 - {0}", BenchName()), wm, Config.Entities.PageOrientation.Portrait).Print();
|
||||
}
|
||||
if (string.IsNullOrEmpty(filtersConfig.PrinterClass))
|
||||
{
|
||||
MessageBox.Show(Strings.No_printer_defined);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Config.Entities.Component cmpnt = new Config.Entities.Component();
|
||||
cmpnt.Name = "printer";
|
||||
cmpnt.ClassName = filtersConfig.PrinterClass;
|
||||
cmpnt.Parameters = filtersConfig.PrinterCfg;
|
||||
|
||||
IComponentFactory printerFactory = GetFactory(filtersConfig.PrinterClass);
|
||||
IComponentCfg printerCfg = printerFactory.CmpntCfgFromCmpntEntity(cmpnt);
|
||||
IComponent component = printerFactory.GetComponent(printerCfg, tbfComponents);
|
||||
IResultsPrinter printer = component as IResultsPrinter;
|
||||
|
||||
if (printer== null)
|
||||
{
|
||||
MessageBox.Show(Strings.No_printer_defined);
|
||||
return;
|
||||
}
|
||||
|
||||
tbfComponents.Clear();
|
||||
tbfDevices.Clear();
|
||||
tbfComponents.Add(component);
|
||||
IDevice dev = component as IDevice;
|
||||
if (dev != null)
|
||||
{
|
||||
dev.Initialize();
|
||||
tbfDevices.Add(dev);
|
||||
}
|
||||
|
||||
/// Find batches
|
||||
IList<Results.Entities.Batch> batches = new List<Results.Entities.Batch>();
|
||||
foreach (var wm in waterMeters)
|
||||
{
|
||||
if (!batches.Contains(wm.Batch)) batches.Add(wm.Batch);
|
||||
}
|
||||
|
||||
foreach (var batch in batches)
|
||||
{
|
||||
IOperation printOp = printer.PrintResultsOp(batch);
|
||||
printOp.Start();
|
||||
while (printOp.Run() != Event.ResultsPrinted) { }
|
||||
printOp.Stop();
|
||||
}
|
||||
|
||||
MessageBox.Show(Strings.Printing_completed);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.Show(Strings.Printing_failed);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private void statisticsBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user