509 lines
38 KiB
C#
509 lines
38 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using System.Drawing.Printing;
|
|
using System.Diagnostics;
|
|
using ZedGraph;
|
|
using PdfSharp;
|
|
using PdfSharp.Drawing;
|
|
using PdfSharp.Pdf.IO;
|
|
using PdfSharp.Pdf;
|
|
using PdfSharp.Drawing.Layout;
|
|
using Microsoft.Office;
|
|
using MigraDoc.DocumentObjectModel.Internals;
|
|
using MigraDoc.DocumentObjectModel;
|
|
using MigraDoc.DocumentObjectModel.Tables;
|
|
using MigraDoc.DocumentObjectModel.IO;
|
|
using MigraDoc.Rendering;
|
|
using MigraDoc.RtfRendering;
|
|
using System.Runtime;
|
|
using System.IO;
|
|
|
|
|
|
|
|
namespace GenesisDisplayTool
|
|
{
|
|
public partial class GENESIS_DISPLAY_TOOL : Form
|
|
{
|
|
private void GeneratePdfReport(CultureInfo culture)
|
|
{
|
|
GCSettings.LatencyMode = GCLatencyMode.LowLatency;
|
|
|
|
#region Prepare data
|
|
#region Definitions and initializations
|
|
Boolean FileDialogOK = false;
|
|
Boolean SavingOK = false;
|
|
#endregion
|
|
#region Wait for background workers
|
|
WaitForBackgroundWorkers();
|
|
#endregion
|
|
#region Parameter definitions
|
|
#region Image parameters
|
|
XImage Logo = pB_Logo.Image;
|
|
#endregion
|
|
#region Text parameters
|
|
Int32 Pagecounter = 0;
|
|
#endregion
|
|
#endregion
|
|
#region Titlepage, path, filenames
|
|
String Introduction = rtB_ReportTitlepageIntro.Text;
|
|
String Fullpath = String.Empty;
|
|
String Itemname = $"_{rTB_ReportEnterOperator.Text}_{rTB_ReportEnterTitle.Text}";
|
|
#endregion
|
|
#region Text definitions
|
|
#region Additional information
|
|
String TextSoftwareVersion = $"{l_About_Version.Text}\n{l_About_Author.Text}\n{l_About_Info.Text}";
|
|
#endregion
|
|
#region Text GP30 settings
|
|
#region Declaration
|
|
String[] SettingsFromGP30Columns = new String[Constants.NumberOfPaths] { String.Empty, String.Empty, String.Empty };
|
|
#endregion
|
|
#region First column
|
|
WaitForBackgroundWorkers();
|
|
SettingsFromGP30Columns[ReportParams.Column1] =
|
|
$"First Hit level up PATH1:\nFirst Hit level up PATH2:\nFirst Hit level up PATH3:\nFirst Hit level down PATH1:\nFirst Hit level down PATH2:\nFirst Hit level up PATH3:\nNumber of bursts:\nStarthit:\nAmplitude peak detect:\nSamplerate:";
|
|
#endregion
|
|
#region Second column
|
|
WaitForBackgroundWorkers();
|
|
SettingsFromGP30Columns[ReportParams.Column2] =
|
|
$"{l_GetFirstLevelUpPath0Meter1.Text}\n{l_GetFirstLevelUpPath1Meter1.Text}\n{l_GetFirstLevelUpPath2Meter1.Text}\n{l_GetFirstLevelDownPath0Meter1.Text}\n{l_GetFirstLevelDownPath1Meter1.Text}\n{l_GetFirstLevelDownPath2Meter1.Text}\n{l_Gp30GetNumberOfPulsesMeter1.Text}\n{l_Gp30GetStartHitMeter1.Text}\n{l_Gp30GetAmplitudeMeter1.Text}\n{l_Gp30GetSamplerateMeter1.Text}";
|
|
#endregion
|
|
#region Third column
|
|
WaitForBackgroundWorkers();
|
|
SettingsFromGP30Columns[ReportParams.Column3] =
|
|
$"({l_GetFirstVoltageUpPath0Meter1.Text})\n({l_GetFirstVoltageUpPath1Meter1.Text})\n({l_GetFirstVoltageUpPath2Meter1.Text})\n({l_GetFirstVoltageDownPath0Meter1.Text})\n({l_GetFirstVoltageDownPath1Meter1.Text})\n({l_GetFirstVoltageDownPath2Meter1.Text})";
|
|
#endregion
|
|
#endregion
|
|
#region Decoded data text
|
|
#region Definitions and initializations
|
|
String[] DecodedDataColumns = new String[4] { String.Empty, String.Empty, String.Empty, String.Empty };
|
|
#endregion
|
|
#region Set data
|
|
#region First Column
|
|
#region Set data
|
|
DecodedDataColumns[ReportParams.Column1] =
|
|
$"{l_HccValPath0.Text}\n{l_HccCorrectionFactorPath0.Text}\n{l_PwUpPath0.Text}\n{l_PwDownPath0.Text}\n{l_AmpUpPath0.Text}\n{l_AmpDownPath0.Text}\n{l_AmpCalHighPath0.Text}\n{l_AmpCalLowPath0.Text}\n{l_TofSumOfAllUpPath0.Text}\n{l_TofSumOfAllDownPath0.Text}\n{l_Tof0UpPath0.Text}\n{l_Tof1UpPath0.Text}\n{l_Tof2UpPath0.Text}\n{l_Tof3UpPath0.Text}\n{l_Tof4UpPath0.Text}\n{l_Tof5UpPath0.Text}\n{l_Tof7UpPath0.Text}\n{l_Tof0DownPath0.Text}\n{l_Tof1DownPath0.Text}\n{l_Tof2DownPath0.Text}\n{l_Tof3DownPath0.Text}\n{l_Tof4DownPath0.Text}\n{l_Tof5DownPath0.Text}\n{l_Tof6DownPath0.Text}\n{l_Tof7DownPath0.Text}\n{l_TemperaturePath0.Text}\n{l_ProtocolVersion.Text}\n\n\nComment:";
|
|
#endregion
|
|
#endregion
|
|
#region PATH0
|
|
#region Set data
|
|
DecodedDataColumns[ReportParams.Column2] =
|
|
$"{l_HccValDispPath0.Text}\n{l_HccCorrectionFactorDispPath0.Text}\n{l_PwUpDispPath0.Text}\n{l_PwDownDispPath0.Text}\n{l_AmpUpDispPath0.Text}\n{l_AmpDownDispPath0}\n{l_AmpCalHighDispPath0.Text}\n{l_AmpCalLowDispPath0.Text}\n{l_TofSumOfAllUpDispPath0.Text}\n{l_TofSumOfAllDownDispPath0.Text}\n{l_Tof0UpDispPath0.Text}\n{l_Tof1UpDispPath0.Text}\n{l_Tof2UpDispPath0.Text}\n{l_Tof3UpDispPath0.Text}\n{l_Tof4UpDispPath0.Text}\n{l_Tof5UpDispPath0.Text}\n{l_Tof6UpDispPath0.Text}\n{l_Tof7UpDispPath0.Text}\n{l_Tof0UpDispPath0.Text}\n{l_Tof1UpDispPath0.Text}\n{l_Tof2UpDispPath0.Text}\n{l_Tof3UpDispPath0.Text}\n{l_Tof4UpDispPath0.Text}\n{l_Tof5UpDispPath0.Text}\n{l_Tof6UpDispPath0.Text}\n{l_Tof7UpDispPath0.Text}\n{l_TemperatureDispPath0.Text}\n{l_DispProtocolVersion}\n\n\n";
|
|
#endregion
|
|
#region Comment field
|
|
if (String.Equals(Decoded[Constants.PATH0].Comment, String.Empty))
|
|
DecodedDataColumns[ReportParams.Column2] = $"{DecodedDataColumns[ReportParams.Column2]}---";
|
|
else
|
|
DecodedDataColumns[ReportParams.Column2] = $"{DecodedDataColumns[ReportParams.Column2]}{Decoded[Constants.PATH0].Comment}";
|
|
#endregion
|
|
#endregion
|
|
#region PATH1
|
|
#region Set data
|
|
DecodedDataColumns[ReportParams.Column3] =
|
|
$"{l_HccValDispPath1.Text}\n{l_HccCorrectionFactorDispPath1.Text}\n{l_PwUpDispPath1.Text}\n{l_PwDownDispPath1.Text}\n{l_AmpUpDispPath1.Text}\n{l_AmpDownDispPath1}\n{l_AmpCalHighDispPath1.Text}\n{l_AmpCalLowDispPath1.Text}\n{l_TofSumOfAllUpDispPath1.Text}\n{l_TofSumOfAllDownDispPath1.Text}\n{l_Tof0UpDispPath1.Text}\n{l_Tof1UpDispPath1.Text}\n{l_Tof2UpDispPath1.Text}\n{l_Tof3UpDispPath1.Text}\n{l_Tof4UpDispPath1.Text}\n{l_Tof5UpDispPath1.Text}\n{l_Tof6UpDispPath1.Text}\n{l_Tof7UpDispPath1.Text}\n{l_Tof0UpDispPath1.Text}\n{l_Tof1UpDispPath1.Text}\n{l_Tof2UpDispPath1.Text}\n{l_Tof3UpDispPath1.Text}\n{l_Tof4UpDispPath1.Text}\n{l_Tof5UpDispPath1.Text}\n{l_Tof6UpDispPath1.Text}\n{l_Tof7UpDispPath1.Text}\n{l_TemperatureDispPath1.Text}\n{l_DispProtocolVersion}\n\n\n";
|
|
#endregion
|
|
#region Comment field
|
|
if (String.Equals(Decoded[Constants.PATH1].Comment, String.Empty))
|
|
DecodedDataColumns[ReportParams.Column3] = $"{DecodedDataColumns[ReportParams.Column3]}---";
|
|
else
|
|
DecodedDataColumns[ReportParams.Column3] = $"{DecodedDataColumns[ReportParams.Column3]}{Decoded[Constants.PATH1].Comment}";
|
|
#endregion
|
|
#endregion
|
|
#region PATH2
|
|
#region Set data
|
|
DecodedDataColumns[ReportParams.Column4] =
|
|
$"{l_HccValDispPath2.Text}\n{l_HccCorrectionFactorDispPath2.Text}\n{l_PwUpDispPath2.Text}\n{l_PwDownDispPath2.Text}\n{l_AmpUpDispPath2.Text}\n{l_AmpDownDispPath2}\n{l_AmpCalHighDispPath2.Text}\n{l_AmpCalLowDispPath2.Text}\n{l_TofSumOfAllUpDispPath2.Text}\n{l_TofSumOfAllDownDispPath2.Text}\n{l_Tof0UpDispPath2.Text}\n{l_Tof1UpDispPath2.Text}\n{l_Tof2UpDispPath2.Text}\n{l_Tof3UpDispPath2.Text}\n{l_Tof4UpDispPath2.Text}\n{l_Tof5UpDispPath2.Text}\n{l_Tof6UpDispPath2.Text}\n{l_Tof7UpDispPath2.Text}\n{l_Tof0UpDispPath2.Text}\n{l_Tof1UpDispPath2.Text}\n{l_Tof2UpDispPath2.Text}\n{l_Tof3UpDispPath2.Text}\n{l_Tof4UpDispPath2.Text}\n{l_Tof5UpDispPath2.Text}\n{l_Tof6UpDispPath2.Text}\n{l_Tof7UpDispPath2.Text}\n{l_TemperatureDispPath2.Text}\n{l_DispProtocolVersion}\n\n\n";
|
|
#endregion
|
|
#region Comment field
|
|
if (String.Equals(Decoded[Constants.PATH2].Comment, String.Empty))
|
|
DecodedDataColumns[ReportParams.Column4] = $"{DecodedDataColumns[ReportParams.Column4]}---";
|
|
else
|
|
DecodedDataColumns[ReportParams.Column4] = $"{DecodedDataColumns[ReportParams.Column4]}{Decoded[Constants.PATH2].Comment}";
|
|
#endregion
|
|
#endregion
|
|
#endregion
|
|
#endregion
|
|
#region Decoded data2 text (I/H-Protocol)
|
|
#region Definitions and initializations
|
|
String[] DecodedData2Columns = new String[4] { String.Empty, String.Empty, String.Empty, String.Empty };
|
|
#endregion
|
|
#region Set data
|
|
#region First Column
|
|
#region Set data
|
|
DecodedData2Columns[ReportParams.Column1] =
|
|
$"{l_Error_HProtPath0.Text}\n{l_TotalTof_HProtPath0.Text}\n{l_DeltaTof_HProtPath0.Text}\n{l_DeltaVol_HProtPath0.Text}\n{l_AccuVol_HProtPath0.Text}\n{l_Temperature_HProt_Path0.Text}\n{l_Time_HProtPath0.Text}\n{l_AmplitudeUp_HProtPath0.Text}\n{l_AmplitudeDown_HProtPath0.Text}\n{l_Valid_IProtPath0.Text}\n{l_TofSumOfAllUp_IProtPath0.Text}\n{l_PulsewidthUp_IProtPath0.Text}\n{l_AmplitudeUp_IProtPath0.Text}\n{l_AmplitudeCalibHigh_IProtPath0.Text}\n{l_TofSumOfAllDown_IProtPath0.Text}\n{l_PulsewidthDown_IProtPath0.Text}\n{l_AmplitudeDown_IProtPath0.Text}\n{l_AmplitudeCalibLow_IProtPath0.Text}\n{l_TofUp0_IProtPath0.Text}\n{l_TofUp1_IProtPath0.Text}\n{l_TofUp2_IProtPath0.Text}\n{l_TofUp3_IProtPath0.Text}\n{l_TofUp4_IProtPath0.Text}\n{l_TofUp5_IProtPath0.Text}\n{l_TofUp6_IProtPath0.Text}\n{l_TofUp7_IProtPath0.Text}\n{l_TofDown0_IProtPath0.Text}\n{l_TofDown1_IProtPath0.Text}\n{l_TofDown2_IProtPath0.Text}\n{l_TofDown3_IProtPath0.Text}\n{l_TofDown4_IProtPath0.Text}\n{l_TofDown5_IProtPath0.Text}\n{l_TofDown6_IProtPath0.Text}\n{l_TofDown7_IProtPath0.Text}\n{lDispVol_FProtPath0.Text}\n\nComment:";
|
|
#endregion
|
|
#endregion
|
|
#region PATH0
|
|
#region Set data
|
|
DecodedData2Columns[ReportParams.Column2] =
|
|
$"{l_ErrorDisp_HProtPath0.Text}\n{l_TofTotalAvg_HProtDispPath0.Text}\n{l_DeltaTof_HProtDispPath0.Text}\n{l_DeltaVol_HProtDispPath0.Text}\n{l_RawAccuVol_HProtDispPath0.Text}\n{l_Temperature_HProtDispPath0.Text}\n{l_Time_HProtDispPath0.Text}\n{l_AmplitudeUp_HProtDispPath0.Text}\n{l_AmplitudeDown_HProtDispPath0.Text}\n{l_Valid_IProtDispPath0.Text}\n{l_TofSumOfAllUp_IProtDispPath0.Text}\n{l_PulsewidthUp_IProtDispPath0.Text}\n{l_AmplitudeUp_IProtDispPath0.Text}\n{l_AmplitudeCalibHigh_IProtDispPath0.Text}\n{l_TofSumOfAllDown_IProtDispPath0.Text}\n{l_PulsewidthDown_IProtDispPath0.Text}\n{l_AmplitudeDown_IProtDispPath0.Text}\n{l_AmplitudeCalibLow_IProtDispPath0.Text}\n{l_TofUp0_IProtDispPath0.Text}\n{l_TofUp1_IProtDispPath0.Text}\n{l_TofUp2_IProtDispPath0.Text}\n{l_TofUp3_IProtDispPath0.Text}\n{l_TofUp4_IProtDispPath0.Text}\n{l_TofUp5_IProtDispPath0.Text}\n{l_TofUp6_IProtDispPath0.Text}\n{l_TofUp7_IProtDispPath0.Text}\n{l_TofDown0_IProtDispPath0.Text}\n{l_TofDown1_IProtDispPath0.Text}\n{l_TofDown2_IProtDispPath0.Text}\n{l_TofDown3_IProtDispPath0.Text}\n{l_TofDown4_IProtDispPath0.Text}\n{l_TofDown5_IProtDispPath0.Text}\n{l_TofDown6_IProtDispPath0.Text}\n{l_TofDown7_IProtDispPath0.Text}\n{lDispVol_DisplayFProtPath0.Text}\n\n\n";
|
|
#endregion
|
|
#region Comment field
|
|
if (String.Equals(Decoded[Constants.PATH0].Comment, String.Empty))
|
|
DecodedData2Columns[ReportParams.Column2] = $"{DecodedData2Columns[ReportParams.Column2]}---";
|
|
else
|
|
DecodedData2Columns[ReportParams.Column2] = $"{DecodedData2Columns[ReportParams.Column2]}{Decoded[Constants.PATH0].Comment}";
|
|
#endregion
|
|
#endregion
|
|
#region PATH1
|
|
#region Set data
|
|
DecodedData2Columns[ReportParams.Column3] =
|
|
$"{l_Error_HProtDispPath1.Text}\n{l_TofTotalAvg_HProtDispPath1.Text}\n{l_DeltaTof_HProtDispPath1.Text}\n{l_DeltaVol_HProtDispPath1.Text}\n{l_AccuVol_HProtDispPath1.Text}\n{l_Temperature_HProtDispPath1.Text}\n{l_Time_HProtDispPath1.Text}\n{l_AmplitudeUp_HProtDispPath1.Text}\n{l_AmplitudeDown_HProtDispPath1.Text}\n{l_Valid_IProtDispPath1.Text}\n{l_TofSumOfAllUp_IProtDispPath1.Text}\n{l_PulsewidthUp_IProtDispPath1.Text}\n{l_AmplitudeUp_IProtDispPath1.Text}\n{l_AmplitudeCalibHigh_IProtDispPath1.Text}\n{l_TofSumOfAllDown_IProtDispPath1.Text}\n{l_PulsewidthDown_IProtDispPath1.Text}\n{l_AmplitudeDown_IProtDispPath1.Text}\n{l_AmplitudeCalibLow_IProtDispPath1.Text}\n{l_TofUp0_IProtDispPath1.Text}\n{l_TofUp1_IProtDispPath1.Text}\n{l_TofUp2_IProtDispPath1.Text}\n{l_TofUp3_IProtDispPath1.Text}\n{l_TofUp4_IProtDispPath1.Text}\n{l_TofUp5_IProtDispPath1.Text}\n{l_TofUp6_IProtDispPath1.Text}\n{l_TofUp7_IProtDispPath1.Text}\n{l_TofDown0_IProtDispPath1.Text}\n{l_TofDown1_IProtDispPath1.Text}\n{l_TofDown2_IProtDispPath1.Text}\n{l_TofDown3_IProtDispPath1.Text}\n{l_TofDown4_IProtDispPath1.Text}\n{l_TofDown5_IProtDispPath1.Text}\n{l_TofDown6_IProtDispPath1.Text}\n{l_TofDown7_IProtDispPath1.Text}\n{lDispVol_DisplayFProtPath1.Text}\n\n\n";
|
|
#endregion
|
|
#region Comment field
|
|
if (String.Equals(Decoded[Constants.PATH1].Comment, String.Empty))
|
|
DecodedData2Columns[ReportParams.Column3] = $"{DecodedData2Columns[ReportParams.Column3]}---";
|
|
else
|
|
DecodedData2Columns[ReportParams.Column3] = $"{DecodedData2Columns[ReportParams.Column3]}{Decoded[Constants.PATH1].Comment}";
|
|
#endregion
|
|
#endregion
|
|
#region PATH2
|
|
#region Set data
|
|
DecodedData2Columns[ReportParams.Column4] =
|
|
$"{l_Error_HProtDispPath2.Text}\n{l_TofTotalAvg_HProtDispPath2.Text}\n{l_DeltaTof_HProtDispPath2.Text}\n{l_DeltaVol_HProtDispPath2.Text}\n{l_AccuVol_HProtDispPath2.Text}\n{l_Temperature_HProtDispPath2.Text}\n{l_Time_HProtDispPath2.Text}\n{l_AmplitudeUp_HProtDispPath2.Text}\n{l_AmplitudeDown_HProtDispPath2.Text}\n{l_Valid_IProtDispPath2.Text}\n{l_TofSumOfAllUp_IProtDispPath2.Text}\n{l_PulsewidthUp_IProtDispPath2.Text}\n{l_AmplitudeUp_IProtDispPath2.Text}\n{l_AmplitudeCalibHigh_IProtDispPath2.Text}\n{l_TofSumOfAllDown_IProtDispPath2.Text}\n{l_PulsewidthDown_IProtDispPath2.Text}\n{l_AmplitudeDown_IProtDispPath2.Text}\n{l_AmplitudeCalibLow_IProtDispPath2.Text}\n{l_TofUp0_IProtDispPath2.Text}\n{l_TofUp1_IProtDispPath2.Text}\n{l_TofUp2_IProtDispPath2.Text}\n{l_TofUp3_IProtDispPath2.Text}\n{l_TofUp4_IProtDispPath2.Text}\n{l_TofUp5_IProtDispPath2.Text}\n{l_TofUp6_IProtDispPath2.Text}\n{l_TofUp7_IProtDispPath2.Text}\n{l_TofDown0_IProtDispPath2.Text}\n{l_TofDown1_IProtDispPath2.Text}\n{l_TofDown2_IProtDispPath2.Text}\n{l_TofDown3_IProtDispPath2.Text}\n{l_TofDown4_IProtDispPath2.Text}\n{l_TofDown5_IProtDispPath2.Text}\n{l_TofDown6_IProtDispPath2.Text}\n{l_TofDown7_IProtDispPath2.Text}\n{lDispVol_DisplayFProtPath2.Text}\n\n\n";
|
|
#endregion
|
|
#region Comment field
|
|
if (String.Equals(Decoded[Constants.PATH2].Comment, String.Empty))
|
|
DecodedData2Columns[ReportParams.Column4] = $"{DecodedData2Columns[ReportParams.Column4]}---";
|
|
else
|
|
DecodedData2Columns[ReportParams.Column4] = $"{DecodedData2Columns[ReportParams.Column4]}{Decoded[Constants.PATH2].Comment}";
|
|
#endregion
|
|
#endregion
|
|
#endregion
|
|
#endregion
|
|
#region Mean values text
|
|
#region Definitions and initializations
|
|
String MeanDataAdditionalInfo = $"Number of values = {nUD_SettingsMean.Value.ToString(culture)}";
|
|
String[] MeanColumns = new String[4] { String.Empty, String.Empty, String.Empty, String.Empty };
|
|
#endregion
|
|
#region Set text
|
|
#region First Column PATH0
|
|
#region Wait for background workers
|
|
WaitForBackgroundWorkers();
|
|
#endregion
|
|
#region Set text
|
|
MeanColumns[ReportParams.Column1] =
|
|
l_MeanValuesTof0UpPath0.Text + "\n" +
|
|
l_MeanValuesTof1UpPath0.Text + "\n" +
|
|
l_MeanValuesTof2UpPath0.Text + "\n" +
|
|
l_MeanValuesTof3UpPath0.Text + "\n" +
|
|
l_MeanValuesTof4UpPath0.Text + "\n" +
|
|
l_MeanValuesTof5UpPath0.Text + "\n" +
|
|
l_MeanValuesTof6UpPath0.Text + "\n" +
|
|
l_MeanValuesTof7UpPath0.Text + "\n" +
|
|
l_MeanValuesTof0DownPath0.Text + "\n" +
|
|
l_MeanValuesTof1DownPath0.Text + "\n" +
|
|
l_MeanValuesTof2DownPath0.Text + "\n" +
|
|
l_MeanValuesTof3DownPath0.Text + "\n" +
|
|
l_MeanValuesTof4DownPath0.Text + "\n" +
|
|
l_MeanValuesTof5DownPath0.Text + "\n" +
|
|
l_MeanValuesTof6DownPath0.Text + "\n" +
|
|
l_MeanValuesTof7DownPath0.Text + "\n" +
|
|
l_MeanValuesDifTof0Path0.Text + "\n" +
|
|
l_MeanValuesDifTof1Path0.Text + "\n" +
|
|
l_MeanValuesDifTof2Path0.Text + "\n" +
|
|
l_MeanValuesDifTof3Path0.Text + "\n" +
|
|
l_MeanValuesDifTof4Path0.Text + "\n" +
|
|
l_MeanValuesDifTof5Path0.Text + "\n" +
|
|
l_MeanValuesDifTof6Path0.Text + "\n" +
|
|
l_MeanValuesDifTof7Path0.Text + "\n" +
|
|
l_MeanValuesDifTof3ZcPath0.Text + "\n" +
|
|
l_MeanValuesDifTof8ZcPath0.Text + "\n" +
|
|
l_MeanValuesAmplitudeUpPath0.Text + "\n" +
|
|
l_MeanValuesAmplitudeDownPath0.Text + "\n" +
|
|
l_MeanValuesPulsewidthUpPath0.Text + "\n" +
|
|
l_MeanValuesPulsewidthDownPath0.Text + "\n" +
|
|
l_MeanValuesTemperaturePath0.Text + "\n";
|
|
|
|
#endregion
|
|
#endregion
|
|
#region Mean data PATH0
|
|
#region Wait for background workers
|
|
WaitForBackgroundWorkers();
|
|
#endregion
|
|
#region Set text
|
|
MeanColumns[ReportParams.Column2] =
|
|
l_MeanValuesTof0UpDispPath0.Text + "\n" +
|
|
l_MeanValuesTof1UpDispPath0.Text + "\n" +
|
|
l_MeanValuesTof2UpDispPath0.Text + "\n" +
|
|
l_MeanValuesTof3UpDispPath0.Text + "\n" +
|
|
l_MeanValuesTof4UpDispPath0.Text + "\n" +
|
|
l_MeanValuesTof5UpDispPath0.Text + "\n" +
|
|
l_MeanValuesTof6UpDispPath0.Text + "\n" +
|
|
l_MeanValuesTof7UpDispPath0.Text + "\n" +
|
|
l_MeanValuesTof0DownDispPath0.Text + "\n" +
|
|
l_MeanValuesTof1DownDispPath0.Text + "\n" +
|
|
l_MeanValuesTof2DownDispPath0.Text + "\n" +
|
|
l_MeanValuesTof3DownDispPath0.Text + "\n" +
|
|
l_MeanValuesTof4DownDispPath0.Text + "\n" +
|
|
l_MeanValuesTof5DownDispPath0.Text + "\n" +
|
|
l_MeanValuesTof6DownDispPath0.Text + "\n" +
|
|
l_MeanValuesTof7DownDispPath0.Text + "\n" +
|
|
l_MeanValuesDifTof0DispPath0.Text + "\n" +
|
|
l_MeanValuesDifTof1DispPath0.Text + "\n" +
|
|
l_MeanValuesDifTof2DispPath0.Text + "\n" +
|
|
l_MeanValuesDifTof3DispPath0.Text + "\n" +
|
|
l_MeanValuesDifTof4DispPath0.Text + "\n" +
|
|
l_MeanValuesDifTof5DispPath0.Text + "\n" +
|
|
l_MeanValuesDifTof6DispPath0.Text + "\n" +
|
|
l_MeanValuesDifTof7DispPath0.Text + "\n" +
|
|
l_MeanValuesDifTof3ZcDispPath0.Text + "\n" +
|
|
l_MeanValuesDifTof8ZcDispPath0.Text + "\n" +
|
|
l_MeanValuesAmplitudeUpDispPath0.Text + "\n" +
|
|
l_MeanValuesAmplitudeDownDispPath0.Text + "\n" +
|
|
l_MeanValuesPulsewidthUpDispPath0.Text + "\n" +
|
|
l_MeanValuesPulsewidthDownDispPath0.Text + "\n" +
|
|
l_MeanValuesTemperatureDispPath0.Text;
|
|
#endregion
|
|
#endregion
|
|
#region Mean data PATH1
|
|
#region Wait for background workers
|
|
WaitForBackgroundWorkers();
|
|
#endregion
|
|
#region Set text
|
|
MeanColumns[ReportParams.Column3] =
|
|
l_MeanValuesTof0UpDispPath1.Text + "\n" +
|
|
l_MeanValuesTof1UpDispPath1.Text + "\n" +
|
|
l_MeanValuesTof2UpDispPath1.Text + "\n" +
|
|
l_MeanValuesTof3UpDispPath1.Text + "\n" +
|
|
l_MeanValuesTof4UpDispPath1.Text + "\n" +
|
|
l_MeanValuesTof5UpDispPath1.Text + "\n" +
|
|
l_MeanValuesTof6UpDispPath1.Text + "\n" +
|
|
l_MeanValuesTof7UpDispPath1.Text + "\n" +
|
|
l_MeanValuesTof0DownDispPath1.Text + "\n" +
|
|
l_MeanValuesTof1DownDispPath1.Text + "\n" +
|
|
l_MeanValuesTof2DownDispPath1.Text + "\n" +
|
|
l_MeanValuesTof3DownDispPath1.Text + "\n" +
|
|
l_MeanValuesTof4DownDispPath1.Text + "\n" +
|
|
l_MeanValuesTof5DownDispPath1.Text + "\n" +
|
|
l_MeanValuesTof6DownDispPath1.Text + "\n" +
|
|
l_MeanValuesTof7DownDispPath1.Text + "\n" +
|
|
l_MeanValuesDifTof0DispPath1.Text + "\n" +
|
|
l_MeanValuesDifTof1DispPath1.Text + "\n" +
|
|
l_MeanValuesDifTof2DispPath1.Text + "\n" +
|
|
l_MeanValuesDifTof3DispPath1.Text + "\n" +
|
|
l_MeanValuesDifTof4DispPath1.Text + "\n" +
|
|
l_MeanValuesDifTof5DispPath1.Text + "\n" +
|
|
l_MeanValuesDifTof6DispPath1.Text + "\n" +
|
|
l_MeanValuesDifTof7DispPath1.Text + "\n" +
|
|
l_MeanValuesDifTof3ZcDispPath1.Text + "\n" +
|
|
l_MeanValuesDifTof8ZcDispPath1.Text + "\n" +
|
|
l_MeanValuesAmplitudeUpDispPath1.Text + "\n" +
|
|
l_MeanValuesAmplitudeDownDispPath1.Text + "\n" +
|
|
l_MeanValuesPulsewidthUpDispPath1.Text + "\n" +
|
|
l_MeanValuesPulsewidthDownDispPath1.Text + "\n" +
|
|
l_MeanValuesTemperatureDispPath1.Text;
|
|
|
|
#endregion
|
|
#endregion
|
|
#region Mean data PATH2
|
|
#region Wait for background workers
|
|
WaitForBackgroundWorkers();
|
|
#endregion
|
|
#region Set text
|
|
MeanColumns[ReportParams.Column4] =
|
|
l_MeanValuesTof0UpDispPath2.Text + "\n" +
|
|
l_MeanValuesTof1UpDispPath2.Text + "\n" +
|
|
l_MeanValuesTof2UpDispPath2.Text + "\n" +
|
|
l_MeanValuesTof3UpDispPath2.Text + "\n" +
|
|
l_MeanValuesTof4UpDispPath2.Text + "\n" +
|
|
l_MeanValuesTof5UpDispPath2.Text + "\n" +
|
|
l_MeanValuesTof6UpDispPath2.Text + "\n" +
|
|
l_MeanValuesTof7UpDispPath2.Text + "\n" +
|
|
l_MeanValuesTof0DownDispPath2.Text + "\n" +
|
|
l_MeanValuesTof1DownDispPath2.Text + "\n" +
|
|
l_MeanValuesTof2DownDispPath2.Text + "\n" +
|
|
l_MeanValuesTof3DownDispPath2.Text + "\n" +
|
|
l_MeanValuesTof4DownDispPath2.Text + "\n" +
|
|
l_MeanValuesTof5DownDispPath2.Text + "\n" +
|
|
l_MeanValuesTof6DownDispPath2.Text + "\n" +
|
|
l_MeanValuesTof7DownDispPath2.Text + "\n" +
|
|
l_MeanValuesDifTof0DispPath2.Text + "\n" +
|
|
l_MeanValuesDifTof1DispPath2.Text + "\n" +
|
|
l_MeanValuesDifTof2DispPath2.Text + "\n" +
|
|
l_MeanValuesDifTof3DispPath2.Text + "\n" +
|
|
l_MeanValuesDifTof4DispPath2.Text + "\n" +
|
|
l_MeanValuesDifTof5DispPath2.Text + "\n" +
|
|
l_MeanValuesDifTof6DispPath2.Text + "\n" +
|
|
l_MeanValuesDifTof7DispPath2.Text + "\n" +
|
|
l_MeanValuesDifTof3ZcDispPath2.Text + "\n" +
|
|
l_MeanValuesDifTof8ZcDispPath2.Text + "\n" +
|
|
l_MeanValuesAmplitudeUpDispPath2.Text + "\n" +
|
|
l_MeanValuesAmplitudeDownDispPath2.Text + "\n" +
|
|
l_MeanValuesPulsewidthUpDispPath2.Text + "\n" +
|
|
l_MeanValuesPulsewidthDownDispPath2.Text + "\n" +
|
|
l_MeanValuesTemperatureDispPath2.Text;
|
|
#endregion
|
|
#endregion
|
|
#endregion
|
|
#endregion
|
|
#region Standard deviation
|
|
#region Definitions and initializations
|
|
String[] StdDeviationColumns = new String[4] { String.Empty, String.Empty, String.Empty, String.Empty };
|
|
#endregion
|
|
#region First Column
|
|
WaitForBackgroundWorkers();
|
|
StdDeviationColumns[ReportParams.Column1] =
|
|
l_StdDev0PATH0.Text + "\n" + l_StdDev1PATH0.Text + "\n" + l_StdDev2PATH0.Text + "\n" + l_StdDev3PATH0.Text + "\n" +
|
|
l_StdDev4PATH0.Text + "\n" + l_StdDev5PATH0.Text + "\n" + l_StdDev6PATH0.Text + "\n" + l_StdDev7PATH0.Text + "\n" +
|
|
l_StdDev3ZeroCrossingsPath0.Text + "\n" + l_StdDev8ZeroCrossingsPath0.Text;
|
|
#endregion
|
|
#region Standard deviation PATH0
|
|
#region Wait for background workers
|
|
WaitForBackgroundWorkers();
|
|
#endregion
|
|
#region Prepare data
|
|
StdDeviationColumns[ReportParams.Column2] =
|
|
l_StdDev0DispPATH0.Text + "\n" + l_StdDev1DispPATH0.Text + "\n" + l_StdDev2DispPATH0.Text + "\n" + l_StdDev3DispPATH0.Text + "\n" +
|
|
l_StdDev4DispPATH0.Text + "\n" + l_StdDev5DispPATH0.Text + "\n" + l_StdDev6DispPATH0.Text + "\n" + l_StdDev7DispPATH0.Text + "\n" +
|
|
l_StdDev3ZeroCrossingsDispPath0.Text + "\n" + l_StdDev8ZeroCrossingsDispPath0.Text;
|
|
#endregion
|
|
#endregion
|
|
#region Standard deviation PATH1
|
|
#region Wait for background workers
|
|
WaitForBackgroundWorkers();
|
|
#endregion
|
|
#region Prepare data
|
|
StdDeviationColumns[ReportParams.Column3] =
|
|
$"{l_StdDev0DispPATH1.Text}\n{l_StdDev1DispPATH1.Text}\n{l_StdDev2DispPATH1.Text}\n{l_StdDev3DispPATH1.Text}\n{l_StdDev4DispPATH1.Text}\n{l_StdDev5DispPATH1.Text}\n{l_StdDev6DispPATH1.Text}\n{l_StdDev7DispPATH1.Text}\n{l_StdDev3ZeroCrossingsDispPath1.Text}\n{l_StdDev8ZeroCrossingsDispPath1.Text}";
|
|
#endregion
|
|
#endregion
|
|
#region Standard deviation PATH2
|
|
#region Wait for background workers
|
|
WaitForBackgroundWorkers();
|
|
#endregion
|
|
#region Prepare data
|
|
StdDeviationColumns[ReportParams.Column4] =
|
|
$"{l_StdDev0DispPATH2.Text}\n{l_StdDev1DispPATH2.Text}\n{l_StdDev2DispPATH2.Text}\n{l_StdDev3DispPATH2.Text}\n" +
|
|
$"{l_StdDev4DispPATH2.Text}\n{l_StdDev5DispPATH2.Text}\n{l_StdDev6DispPATH2.Text}\n{l_StdDev7DispPATH2.Text}\n" +
|
|
$"{l_StdDev3ZeroCrossingsDispPath2.Text}\n{l_StdDev8ZeroCrossingsDispPath2.Text}";
|
|
#endregion
|
|
#endregion
|
|
#endregion
|
|
#endregion
|
|
#region Check for serial number
|
|
if (String.Equals(rTB_ReportEnterSerialNumber.Text, String.Empty))
|
|
{
|
|
MessageBox.Show("Enter serial number!", "Form closing", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
return;
|
|
}
|
|
#endregion
|
|
#region Parameter query check
|
|
if (cB_ReportGP30Settings.Checked)
|
|
{
|
|
WaitForBackgroundWorkers();
|
|
if ((l_GetFirstLevelUpPath0Meter1.Text.Contains("-")) || (l_GetFirstLevelUpPath1Meter1.Text.Contains("-")) || (l_GetFirstLevelUpPath2Meter1.Text.Contains("-")) ||
|
|
(l_GetFirstLevelDownPath0Meter1.Text.Contains("-")) || (l_GetFirstLevelDownPath1Meter1.Text.Contains("-")) || (l_GetFirstLevelDownPath2Meter1.Text.Contains("-")) ||
|
|
(l_Gp30GetAmplitudeMeter1.Text.Contains("-")) || (l_Gp30GetNumberOfPulsesMeter1.Text.Contains("-")) || (l_Gp30GetStartHitMeter1.Text.Contains("-")))
|
|
{
|
|
MessageBox.Show("Perform parameter readout or deselect\n 'Include GP30 settings'-option", "Form closing", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
#endregion
|
|
#region Create pages and generate report
|
|
try
|
|
{
|
|
#region Update all graphs
|
|
#region Standard deviation PATH0
|
|
WaitForBackgroundWorkers();
|
|
CreateStdDevGraphPath0(zGC_StdDevPath0, ParamsStdDev[Constants.PATH0], false, tab_Maintab, cB_ReportStdDevPath0.Checked, (UInt32)nUD_SettingsXrangeStdDevGraph.Value);
|
|
#endregion
|
|
#region Standard deviation PATH1
|
|
WaitForBackgroundWorkers();
|
|
CreateStdDevGraphPath1(zGC_StdDevPath1, ParamsStdDev[Constants.PATH1], false, tab_Maintab, cB_ReportStdDevPath1.Checked, (UInt32)nUD_SettingsXrangeStdDevGraph.Value);
|
|
#endregion
|
|
#region Standard deviation PATH2
|
|
WaitForBackgroundWorkers();
|
|
CreateStdDevGraphPath2(zGC_StdDevPath2, ParamsStdDev[Constants.PATH2], false, tab_Maintab, cB_ReportStdDevPath2.Checked, (UInt32)nUD_SettingsXrangeStdDevGraph.Value);
|
|
#endregion
|
|
#region Maingraph
|
|
WaitForBackgroundWorkers();
|
|
Boolean[] GraphsSelected = new Boolean[Constants.NumberOfPaths] { cB_GraphOptionEnPath0.Checked, cB_GraphOptionEnPath1.Checked, cB_GraphOptionEnPath2.Checked };
|
|
//Maingraph1.CreateGraphs(false, GetTabStatus(), GetSelectedPath());
|
|
#endregion
|
|
#endregion
|
|
#region Create new report
|
|
WaitForBackgroundWorkers();
|
|
PdfDocument Report = new PdfDocument();
|
|
Report.Info.Title = rTB_ReportEnterTitle.Text;
|
|
Report.Info.Author = rTB_ReportEnterOperator.Text;
|
|
#endregion
|
|
#region Page "Titlepage
|
|
WaitForBackgroundWorkers();
|
|
Pagecounter = ReportPages.TitlePage(Pagecounter, Introduction, rTB_ReportEnterTitle.Text, rTB_ReportEnterDate.Text, rTB_ReportEnterOperator.Text, rTB_ReportEnterSerialNumber.Text, Report, Logo, culture);
|
|
#endregion
|
|
#region Page "SETTINGS"
|
|
WaitForBackgroundWorkers();
|
|
Pagecounter = ReportPages.Settings(Pagecounter, TextSoftwareVersion, SettingsFromGP30Columns, cB_ReportGP30Settings.Checked, Report, Logo, culture);
|
|
#endregion
|
|
#region Page "DECODED DATA"
|
|
WaitForBackgroundWorkers();
|
|
Pagecounter = ReportPages.DecodedData(Pagecounter, DecodedDataColumns, cB_ReportDecodedData.Checked, cB_ReportDecodedDataPath0.Checked, cB_ReportDecodedDataPath1.Checked, cB_ReportDecodedDataPath2.Checked, Report, Logo, culture);
|
|
#endregion
|
|
#region Page "DECODED DATA (I/H-Protocol)"
|
|
WaitForBackgroundWorkers();
|
|
Pagecounter = ReportPages.DecodedData2(Pagecounter, DecodedData2Columns, cB_ReportDecodedData_HProt.Checked, cB_ReportDecodedData_HProt_Path0.Checked, cB_ReportDecodedData_HProt_Path1.Checked, cB_ReportDecodedData_HProt_Path2.Checked, Report, Logo, culture);
|
|
#endregion
|
|
#region Page "MAINGRAPH"
|
|
WaitForBackgroundWorkers();
|
|
Pagecounter = ReportPages.Maingraph(Pagecounter, MainGraphTitle, zGC_MainGraph, cB_ReportMainGraph.Checked, Report, Logo, culture);
|
|
#endregion
|
|
#region Page "STANDARD DEVIATION"
|
|
if (cB_ReportStdDev.Checked)
|
|
{
|
|
WaitForBackgroundWorkers();
|
|
Pagecounter = ReportPages.StdDeviationPath0(Pagecounter, StdDeviationColumns, zGC_StdDevPath0, cB_ReportStdDevPath0.Checked, Report, Logo, culture);
|
|
WaitForBackgroundWorkers();
|
|
Pagecounter = ReportPages.StdDeviationPath1(Pagecounter, StdDeviationColumns, zGC_StdDevPath1, cB_ReportStdDevPath1.Checked, Report, Logo, culture);
|
|
WaitForBackgroundWorkers();
|
|
Pagecounter = ReportPages.StdDeviationPath2(Pagecounter, StdDeviationColumns, zGC_StdDevPath2, cB_ReportStdDevPath2.Checked, Report, Logo, culture);
|
|
}
|
|
#endregion
|
|
#region Page "MEAN VALUES"
|
|
WaitForBackgroundWorkers();
|
|
ReportPages.MeanValues(Pagecounter, MeanColumns, cB_ReportMean.Checked, cB_ReportMeanPath0.Checked, cB_ReportMeanPath1.Checked, cB_ReportMeanPath2.Checked, Report, Logo, culture);
|
|
#endregion
|
|
#region Save file
|
|
WaitForBackgroundWorkers();
|
|
|
|
FileDialogOK = Files.SaveFiledialogPdf(Itemname, ref Fullpath, DefaultReportDirectory);
|
|
if (FileDialogOK)
|
|
{
|
|
WaitForBackgroundWorkers();
|
|
DefaultReportDirectory = Path.GetDirectoryName(Fullpath);
|
|
WaitForBackgroundWorkers();
|
|
SavingOK = Files.SavePdf(Report, Fullpath);
|
|
|
|
}
|
|
#endregion
|
|
#region Result
|
|
if((!SavingOK)&&(FileDialogOK))
|
|
MessageBox.Show("Report generation failed", "Form closing", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
|
#endregion
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
#region Error
|
|
ErrorLog.Log(LogErrReason.Exception(), "GeneratePdfReport() failed", $"0x{ex.HResult.ToString("X", culture)}", String.Empty);
|
|
MessageBox.Show("Report generation failed", "Form closing", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
#endregion
|
|
}
|
|
#endregion
|
|
|
|
GC.Collect();
|
|
System.Runtime.GCSettings.LatencyMode = System.Runtime.GCLatencyMode.SustainedLowLatency;
|
|
}
|
|
}
|
|
} |