Initial commit 2
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<gcServer enabled="true" />
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<runtime>
|
||||
<gcAllowVeryLargeObjects enabled="true" />
|
||||
</runtime>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||
<parameters>
|
||||
<parameter value="v13.0" />
|
||||
</parameters>
|
||||
</defaultConnectionFactory>
|
||||
</entityFramework>
|
||||
|
||||
</configuration>
|
||||
@@ -0,0 +1,594 @@
|
||||
using System;
|
||||
using PdfSharp.Drawing;
|
||||
|
||||
namespace GenesisDisplayTool
|
||||
{
|
||||
|
||||
#region Labels and logging
|
||||
static class DataError
|
||||
{
|
||||
public const Int32 NoError = 0;
|
||||
public const Int32 TemperatureBelowRange = 0xF0B;
|
||||
public const Int32 TemperatureAboveRange = 0xF0C;
|
||||
public const Int32 BadPulse = 0x0F0D;
|
||||
public const Int32 AmplitudeOutOfRange = 0x0F0E;
|
||||
public const Int32 TofOutOfRange = 0x0F0F;
|
||||
public const Int32 DeltaTimeOfFlight = 0x0F10;
|
||||
public const Int32 TofTimeout = 0x0F11;
|
||||
public const Int32 TofOutOfRange2 = 0xF12;
|
||||
public const Int32 Unknown = 0xFFFF;
|
||||
}
|
||||
|
||||
public static class ZeroOffsetTestConstants
|
||||
{
|
||||
public const Int32 StabilizationTime = 10;
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Tof")]
|
||||
public static readonly Double DeltaTofAverageFactor = ((Math.Pow(10, 12)) / (Math.Pow(2, 38)));// /3.6379788;
|
||||
public const Int32 BadDataLimit = 3;
|
||||
}
|
||||
|
||||
static class Debugmessages
|
||||
{
|
||||
public const Boolean MessagesEnabled = true;
|
||||
public const String Line = "------------------------------------------------------------------------------------\n";
|
||||
}
|
||||
|
||||
|
||||
static class Settingsfile
|
||||
{
|
||||
// for position of items in file
|
||||
public const Int32 CmdMeter1Baudrate = 0;
|
||||
public const Int32 CmdMeter1Databits = 1;
|
||||
public const Int32 CmdMeter1Comselect = 2;
|
||||
public const Int32 CmdMeter1Stopbits = 3;
|
||||
public const Int32 CmdMeter1Parity = 4;
|
||||
public const Int32 CmdMeter1Handshake = 5;
|
||||
public const Int32 DataMeter1Baudrate = 6;
|
||||
public const Int32 DataMeter1Databits = 7;
|
||||
public const Int32 DataMeter1Comselect = 8;
|
||||
public const Int32 DataMeter1Stopbits = 9;
|
||||
public const Int32 DataMeter1Parity = 10;
|
||||
public const Int32 DataMeter1Handshake = 11;
|
||||
public const Int32 RawLogEnable = 12;
|
||||
public const Int32 CsvLogEnable = 13;
|
||||
public const Int32 CsvLogPath0 = 14;
|
||||
public const Int32 CsvLogPath1 = 15;
|
||||
public const Int32 CsvLogPath2 = 16;
|
||||
public const Int32 ListBoxOption = 17;
|
||||
public const Int32 MaingraphXval = 18;
|
||||
public const Int32 MaingraphPath0 = 19;
|
||||
public const Int32 MaingraphPath1 = 20;
|
||||
public const Int32 MaingraphPath2 = 21;
|
||||
public const Int32 MaingraphFlowVal = 22;
|
||||
public const Int32 Password1 = 23;
|
||||
public const Int32 JsonPath = 24;
|
||||
public const Int32 StdDeviationXval = 25;
|
||||
public const Int32 StdDeviationValues = 26;
|
||||
public const Int32 StdDeviationEnHit0Path0 = 27;
|
||||
public const Int32 StdDeviationEnHit1Path0 = 28;
|
||||
public const Int32 StdDeviationEnHit2Path0 = 29;
|
||||
public const Int32 StdDeviationEnHit3Path0 = 30;
|
||||
public const Int32 StdDeviationEnHit4Path0 = 31;
|
||||
public const Int32 StdDeviationEnHit5Path0 = 32;
|
||||
public const Int32 StdDeviationEnHit6Path0 = 33;
|
||||
public const Int32 StdDeviationEnHit7Path0 = 34;
|
||||
public const Int32 StdDeviationEn3HitsPath0 = 35;
|
||||
public const Int32 StdDeviationEn8HitsPath0 = 36;
|
||||
public const Int32 StdDeviationEnHit0Path1 = 37;
|
||||
public const Int32 StdDeviationEnHit1Path1 = 38;
|
||||
public const Int32 StdDeviationEnHit2Path1 = 39;
|
||||
public const Int32 StdDeviationEnHit3Path1 = 40;
|
||||
public const Int32 StdDeviationEnHit4Path1 = 41;
|
||||
public const Int32 StdDeviationEnHit5Path1 = 42;
|
||||
public const Int32 StdDeviationEnHit6Path1 = 43;
|
||||
public const Int32 StdDeviationEnHit7Path1 = 44;
|
||||
public const Int32 StdDeviationEn3HitsPath1 = 45;
|
||||
public const Int32 StdDeviationEn8HitsPath1 = 46;
|
||||
public const Int32 StdDeviationEnHit0Path2 = 47;
|
||||
public const Int32 StdDeviationEnHit1Path2 = 48;
|
||||
public const Int32 StdDeviationEnHit2Path2 = 49;
|
||||
public const Int32 StdDeviationEnHit3Path2 = 50;
|
||||
public const Int32 StdDeviationEnHit4Path2 = 51;
|
||||
public const Int32 StdDeviationEnHit5Path2 = 52;
|
||||
public const Int32 StdDeviationEnHit6Path2 = 53;
|
||||
public const Int32 StdDeviationEnHit7Path2 = 54;
|
||||
public const Int32 StdDeviationEn3HitsPath2 = 55;
|
||||
public const Int32 StdDeviationEn8HitsPath2 = 56;
|
||||
public const Int32 LogDirectory = 57;
|
||||
public const Int32 ReportDirectory = 58;
|
||||
public const Int32 ImagesDirectory = 59;
|
||||
public const Int32 CsvDirectory = 60;
|
||||
public const Int32 MassLogging = 61;
|
||||
public const Int32 CmdMeter2Baudrate = 62;
|
||||
public const Int32 CmdMeter2Databits = 63;
|
||||
public const Int32 CmdMeter2Comselect = 64;
|
||||
public const Int32 CmdMeter2Stopbits = 65;
|
||||
public const Int32 CmdMeter2Parity = 66;
|
||||
public const Int32 CmdMeter2Handshake = 67;
|
||||
public const Int32 DataMeter2Baudrate = 68;
|
||||
public const Int32 DataMeter2Databits = 69;
|
||||
public const Int32 DataMeter2Comselect = 70;
|
||||
public const Int32 DataMeter2Stopbits = 71;
|
||||
public const Int32 DataMeter2Parity = 72;
|
||||
public const Int32 DataMeter2Handshake = 73;
|
||||
public const Int32 CmdMeter3Baudrate = 74;
|
||||
public const Int32 CmdMeter3Databits = 75;
|
||||
public const Int32 CmdMeter3Comselect = 76;
|
||||
public const Int32 CmdMeter3Stopbits = 77;
|
||||
public const Int32 CmdMeter3Parity = 78;
|
||||
public const Int32 CmdMeter3Handshake = 79;
|
||||
public const Int32 DataMeter3Baudrate = 80;
|
||||
public const Int32 DataMeter3Databits = 81;
|
||||
public const Int32 DataMeter3Comselect = 82;
|
||||
public const Int32 DataMeter3Stopbits = 83;
|
||||
public const Int32 DataMeter3Parity = 84;
|
||||
public const Int32 DataMeter3Handshake = 85;
|
||||
public const Int32 Password2 = 86;
|
||||
public const Int32 Password3 = 87;
|
||||
public const Int32 Splitcounter = 88;
|
||||
|
||||
}
|
||||
static class ReportParams
|
||||
{
|
||||
public const Int32 LogoXPos = 500;
|
||||
public const Int32 LogoYPos = 10;
|
||||
public const Int32 LogoXSize = 50;
|
||||
public const Int32 LogoYSize = 20;
|
||||
public const Int32 HeadlineXPos = 0;
|
||||
public const Int32 HeadlineYPos = 50;
|
||||
public const Int32 Headline2XPos = 128;
|
||||
public const Int32 Headline2YPos = 113;
|
||||
public const Int32 PageNumberXPosition = 220;
|
||||
public const Int32 PageNumberYPosition = -20;
|
||||
public const Int32 StandardTextXPos = 128;
|
||||
public const Int32 StandardTextYPos = 150;
|
||||
public const Int32 ImageXSize = 400;
|
||||
public const Int32 ImageYSize = 240;
|
||||
public const Int32 ImageXPos = 125;
|
||||
public const Int32 ImageYPos = 135;
|
||||
public const Int32 IntroductionXPos = 100;
|
||||
public const Int32 IntroductionYPos = 600;
|
||||
public static readonly XFont font20 = new XFont("Eras Bold ITC ", 20, XFontStyle.Bold);
|
||||
public static readonly XFont font14 = new XFont("Calibri", 14, XFontStyle.Bold);
|
||||
public static readonly XFont font12 = new XFont("Calibri", 12, XFontStyle.BoldItalic);
|
||||
public static readonly XFont fontStandard = new XFont("Calibri", 10, XFontStyle.Regular);
|
||||
public const Int32 Column1 = 0;
|
||||
public const Int32 Column2 = 1;
|
||||
public const Int32 Column3 = 2;
|
||||
public const Int32 Column4 = 3;
|
||||
public const Int32 Column5 = 4;
|
||||
}
|
||||
|
||||
static class Json
|
||||
{
|
||||
public static readonly String[] SupportedTypes = new String[8] { "uint8_t", "uint16_t", "uint32_t", "enum8", "bool_t", "int8_t", "int16_t", "int32_t"};
|
||||
}
|
||||
static class Constants
|
||||
{
|
||||
public const Int32 RawCyclesToStorage = 1000;
|
||||
public static readonly Int32[] CsvCyclesToStorage = new Int32[Constants.NumberOfPaths] { 450, 500, 550 };
|
||||
public const Double Vcal = 350; // For amplitude measurement. See TDC-GP30, vol.3, 2-6
|
||||
public const UInt16 NumberOfMeters = 3;
|
||||
public const UInt16 Meter1 = 0;
|
||||
public const UInt16 Meter2 = 1;
|
||||
public const UInt16 Meter3 = 2;
|
||||
public const UInt16 CmdMeter1 = 1;
|
||||
public const UInt16 DataMeter1 = 2;
|
||||
public const UInt16 CmdMeter2 = 3;
|
||||
public const UInt16 DataMeter2 = 4;
|
||||
public const UInt16 CmdMeter3 = 5;
|
||||
public const UInt16 DataMeter3 = 6;
|
||||
public const UInt16 MainGraphDefaultXValues = 200;
|
||||
public const UInt16 MainGraphDefaultFlowValue = 10;
|
||||
public const UInt16 MainGraphListMaxElements = 20000;
|
||||
public const UInt16 StdDevGraphDefaultXValues = 200;
|
||||
public const UInt16 StdDevGraphDefaultElements = 20;
|
||||
public const UInt16 StdDevGraphListMaxElements = 20000;
|
||||
public const UInt16 NumberOfPaths = 3;
|
||||
public const UInt16 PATH0 = 0;
|
||||
public const UInt16 PATH1 = 1;
|
||||
public const UInt16 PATH2 = 2;
|
||||
public const UInt16 NOPATH = 4;
|
||||
public const UInt16 HIT0 = 0;
|
||||
public const UInt16 HIT1 = 1;
|
||||
public const UInt16 HIT2 = 2;
|
||||
public const UInt16 HIT3 = 3;
|
||||
public const UInt16 HIT4 = 4;
|
||||
public const UInt16 HIT5 = 5;
|
||||
public const UInt16 HIT6 = 6;
|
||||
public const UInt16 HIT7 = 7;
|
||||
public const UInt16 ListItem0 = 0;
|
||||
public const UInt16 ListItem1 = 1;
|
||||
public const UInt16 ListItem2 = 2;
|
||||
public const UInt16 ListItem3 = 3;
|
||||
public const UInt16 ListItem4 = 4;
|
||||
public const UInt16 ListItem5 = 5;
|
||||
public const UInt16 ListItem6 = 6;
|
||||
public const String CsvDefaultModeString = "0x1C";
|
||||
public const Double DefaultScrollGrace = (Double)0.05;
|
||||
public const Double FirstHitLevelFactor = (Double)0.88;
|
||||
public const Double DefaultHccCorrectionFactor = 1.0;
|
||||
public const UInt16 Gp30WriteMultipleMaxLength = 20; // tbc
|
||||
public const Double NominalFrequency = 4.0;
|
||||
public const Double FlowFactor = 0.0036379788;
|
||||
public const Double TofFactor = 3.6379788;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static class Formats
|
||||
{
|
||||
#region Format strings for display
|
||||
#region Format strings for "Decoded Data"-display
|
||||
public const String TofDispString = "000000.000000000000";
|
||||
public const String HccCorrectionValue = "0.00000";
|
||||
public const String PwDispString = "0.00";
|
||||
public const String AmpDispUpString = "000.0";
|
||||
public const String AmpDispDownString = "-000.0";
|
||||
public const String TempDispString = "0.00";
|
||||
public const String Flow = "0.00";
|
||||
#endregion
|
||||
#region Format strings for "Mean"-Display
|
||||
public const String MeanDispString = "0.00";
|
||||
#endregion
|
||||
#region Format strings for "Std-Deviation"-Display
|
||||
public const String StdDevDispString = "0.00";
|
||||
#endregion
|
||||
#endregion
|
||||
#region Format strings for CSV-Logging
|
||||
public const String TofLogString = "000000.000000000000";
|
||||
public const String PwLogString = "0.00";
|
||||
public const String AmpLogString = "000.0";
|
||||
public const String TempLogString = "0.00";
|
||||
public const String CsvDateTimeLogString = "HH:mm:ss:fff;yyyy.MM.dd;";
|
||||
public const String ErrorLogString = "HH:mm:ss:fff;yyyy.MM.dd;";
|
||||
public const String RawDataDateTimeLogString = "yyyy-MM-dd HH:mm:ss:fff ";
|
||||
public const String CsvIndexLogString = "{0:D8}";
|
||||
public const String CsvFileDateTimeString = "yyyyMMdd_HHmmss_";
|
||||
public const String TxtFileDateTimeString = "yyyyMMdd_HHmmss_";
|
||||
#endregion
|
||||
#region Date/ Time for raw file naming
|
||||
public const String RawFileDateTimeString = "yyyyMMdd_HHmmss_";
|
||||
#endregion
|
||||
#region Date/ Time for image files naming
|
||||
public const String ImageFileDateTimeString = "yyyyMMdd_HHmmss_";
|
||||
#endregion
|
||||
#region Date/ Time for reports
|
||||
public const String ReportDateTimeTitleString = "yyyy-MM-dd";
|
||||
public const String PdfDateTimeString = "yyyyMMdd_HHmmss_";
|
||||
#endregion
|
||||
#region Format for GP30 first hit level adjustments
|
||||
public const String FirstHitLevelVoltage = "000.00";
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static class Units
|
||||
{
|
||||
#region Unit strings for Display
|
||||
public const String TofDispString = " ns";
|
||||
public const String DifTofDispString = " ps";
|
||||
public const String StdDevDispString = " ps";
|
||||
public const String AmpDispString = " mV";
|
||||
public const String TempDispString = " °C";
|
||||
public const String Flow = " m³/h";
|
||||
#endregion
|
||||
#region Unit Strings for CSV-Logging
|
||||
public const String TofCsvLogString = "E-9;";
|
||||
#endregion
|
||||
#region First hit level voltage
|
||||
public const String FirstHitLevelVoltage = " mV";
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region Serial stuff
|
||||
public static class SettingsFileError
|
||||
{
|
||||
public const Int32 Ok = 0x00;
|
||||
public const Int32 Length = 0x01;
|
||||
public const Int32 Format = 0x02;
|
||||
public const Int32 Unknown = 0x03;
|
||||
}
|
||||
|
||||
public static class Message
|
||||
{
|
||||
public const String Data = "V";
|
||||
public const String Temperature = "T";
|
||||
public const String Comment = "C";
|
||||
public const String Hcc = "H";
|
||||
public const Int32 ProtocolIdentPosition = 24;
|
||||
public const Int32 MessageTypePosition = 26;
|
||||
public const Int32 PathIdentPosition = 28;
|
||||
public const Int32 ValidIdentPosition = 30;
|
||||
}
|
||||
#endregion
|
||||
#region GP30 stuff
|
||||
/*
|
||||
public static class GP30Registers
|
||||
{
|
||||
public static Byte[] TriggerUpgrade() { return new Byte[] { 0x00, 0x00 }; }
|
||||
public static Byte[] CheckPresence() { return new Byte[] { 0x00, 0x01 }; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Byte.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Pcb")]
|
||||
public static Byte[] PcbSerialNumber() { return new Byte[] { 0x00, 0x02 }; }
|
||||
public static Byte[] CustomerSerialNumber0() { return new Byte[] { 0x00, 0x03 }; }
|
||||
public static Byte[] CustomerSerialNumber1() { return new Byte[] { 0x00, 0x04 }; }
|
||||
public static Byte[] CustomerSerialNumber2() { return new Byte[] { 0x00, 0x05 }; }
|
||||
public static Byte[] CustomerSerialNumber3() { return new Byte[] { 0x00, 0x06 }; }
|
||||
public static Byte[] MonotonicSeconds() { return new Byte[] { 0x00, 0x07 }; }
|
||||
public static Byte[] CalendarSeconds() { return new Byte[] { 0x00, 0x08 }; }
|
||||
public static Byte[] CoreRevision() { return new Byte[] { 0x00, 0x09 }; }
|
||||
public static Byte[] DriveCapacity() { return new Byte[] { 0x00, 0x0A }; }
|
||||
public static Byte[] ExitReason() { return new Byte[] { 0x00, 0x0B }; }
|
||||
public static Byte[] CorePlatform() { return new Byte[] { 0x00, 0x0C }; }
|
||||
public static Byte[] Quota() { return new Byte[] { 0x08, 0x00 }; }
|
||||
public static Byte[] Drive() { return new Byte[] { 0x08, 0x01 }; }
|
||||
public static Byte[] TriggerLogFlush() { return new Byte[] { 0x08, 0x02 }; }
|
||||
public static Byte[] AlarmStatus0() { return new Byte[] { 0x09, 0x00 }; }
|
||||
public static Byte[] AlarmStatus1() { return new Byte[] { 0x09, 0x01 }; }
|
||||
public static Byte[] TriggerAlarmCancel() { return new Byte[] { 0x09, 0x02 }; }
|
||||
public static Byte[] AlarmStatus2() { return new Byte[] { 0x09, 0x03 }; }
|
||||
public static Byte[] AlarmStatus3() { return new Byte[] { 0x09, 0x04 }; }
|
||||
public static Byte[] AlarmStatus4() { return new Byte[] { 0x09, 0x05 }; }
|
||||
public static Byte[] AlarmStatus5() { return new Byte[] { 0x09, 0x06 }; }
|
||||
public static Byte[] AlarmStatus6() { return new Byte[] { 0x09, 0x07 }; }
|
||||
public static Byte[] AlarmStatus7() { return new Byte[] { 0x09, 0x08 }; }
|
||||
public static Byte[] AlarmEnableMask() { return new Byte[] { 0x09, 0x09 }; }
|
||||
public static Byte[] AlarmVisualAutoClearMask() { return new Byte[] { 0x09, 0x0A }; }
|
||||
public static Byte[] BatteryVoltage() { return new Byte[] { 0x01, 0x00 }; }
|
||||
public static Byte[] BatteryManufacturer() { return new Byte[] { 0x01, 0x01 }; }
|
||||
public static Byte[] Privilege() { return new Byte[] { 0x04, 0x00 }; }
|
||||
public static Byte[] Password() { return new Byte[] { 0x04, 0x01 }; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Samplerate")]
|
||||
public static Byte[] Samplerate() { return new Byte[] { 0x0F, 0x00 }; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Lvl")]
|
||||
public static Byte[] FirstHitLvlUpPath0() { return new Byte[] { 0x0F, 0x01 }; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Lvl")]
|
||||
public static Byte[] FirstHitLvlUpPath1() { return new Byte[] { 0x0F, 0x02 }; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Lvl")]
|
||||
public static Byte[] FirstHitLvlUpPath2() { return new Byte[] { 0x0F, 0x03 }; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Lvl")]
|
||||
public static Byte[] FirstHitLvlDownPath0() { return new Byte[] { 0x0F, 0x04 }; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Lvl")]
|
||||
public static Byte[] FirstHitLvlDownPath1() { return new Byte[] { 0x0F, 0x05 }; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Lvl")]
|
||||
public static Byte[] FirstHitLvlDownPath2() { return new Byte[] { 0x0F, 0x06 }; }
|
||||
public static Byte[] StartHit() { return new Byte[] { 0x0F, 0x07 }; }
|
||||
public static Byte[] AmplitudePeakDetectEnd() { return new Byte[] { 0x0F, 0x08 }; }
|
||||
public static Byte[] NumberOfTXBursts() { return new Byte[] { 0x0F, 0x09 }; }
|
||||
public static Byte[] MeterSize() { return new Byte[] { 0x0F, 0x0C }; }
|
||||
public static Byte[] CalFactorPath0() { return new Byte[] { 0x0F, 0x0D }; }
|
||||
public static Byte[] CalFactorPath1() { return new Byte[] { 0x0F, 0x0E }; }
|
||||
public static Byte[] CalFactorPath2() { return new Byte[] { 0x0F, 0x0F }; }
|
||||
public static Byte[] ZeroOffsetPath0() { return new Byte[] { 0x0F, 0x10 }; }
|
||||
public static Byte[] ZeroOffsetPath1() { return new Byte[] { 0x0F, 0x11 }; }
|
||||
public static Byte[] ZeroOffsetPath2() { return new Byte[] { 0x0F, 0x12 }; }
|
||||
public static Byte[] ResetAccu() { return new Byte[] { 0x0F, 0x14 }; }
|
||||
public static Byte[] Arrow() { return new Byte[] { 0x0F, 0x15 }; }
|
||||
public static Byte[] LedMode() { return new Byte[] { 0x0F, 0x16 }; }
|
||||
public static Byte[] StoreCalibration() { return new Byte[] { 0x0F, 0x17 }; }
|
||||
public static Byte[] PercentagePath0() { return new Byte[] { 0x0F, 0x26 }; }
|
||||
public static Byte[] PercentagePath1() { return new Byte[] { 0x0F, 0x27 }; }
|
||||
public static Byte[] PercentagePath2() { return new Byte[] { 0x0F, 0x28 }; }
|
||||
public static Byte[] FirstHitShift() { return new Byte[] { 0x0F, 0x29 }; }
|
||||
public static Byte[] FirstHitMinimum() { return new Byte[] { 0x0F, 0x2A }; }
|
||||
public static Byte[] TofErrorLimit() { return new Byte[] { 0x0F, 0x2B }; }
|
||||
public static Byte[] FirstHitUpdatePeriod() { return new Byte[] { 0x0F, 0x2C }; }
|
||||
public static Byte[] ToFTempOffset1() { return new Byte[] { 0x0F, 0x2E }; }
|
||||
public static Byte[] ToFTempOffset2() { return new Byte[] { 0x0F, 0x2F }; }
|
||||
public static Byte[] ToFTempOffset3() { return new Byte[] { 0x0F, 0x30 }; }
|
||||
public static Byte[] ToFTempCalibrate() { return new Byte[] { 0x0F, 0x31 }; }
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
public static class GP30Payloads
|
||||
{
|
||||
public const Byte Base = 0x05;
|
||||
public const Byte SupportedBaudrates = 0x00;
|
||||
public const Byte SupportedPacketSizes = 0x01;
|
||||
public const Byte SupportedProtocolVersion = 0x02;
|
||||
public const Byte SetBaudrate = 0x03;
|
||||
public const Byte SetPacketsize = 0x04;
|
||||
public const Byte TrainingByte = 0x05;
|
||||
public const Byte TrainingTime = 0x06;
|
||||
public const Byte AttemptedBaudrate = 0x07;
|
||||
public const Byte ResetInter = 0x08;
|
||||
public const Byte AutosetLow = 0x09;
|
||||
public const Byte AutosetHigh = 0x09;
|
||||
}
|
||||
|
||||
public static class GP30RequestType
|
||||
{
|
||||
public const Byte ReadRegister = 0x00;
|
||||
public const Byte WriteRegister = 0x01;
|
||||
public const Byte QueryCaps = 0x02;
|
||||
public const Byte MultipleWrite = 0x03;
|
||||
}
|
||||
|
||||
public static class GP30Commands
|
||||
{
|
||||
public const Byte Startbyte = 0x5B;
|
||||
public const Byte Nop = 0x00;
|
||||
public const Byte QueryCaps = 0x01;
|
||||
public const Byte QueryCapsReply = 0x02;
|
||||
public const Byte SetCaps = 0x03;
|
||||
public const Byte SetCapsReply = 0x04;
|
||||
public const Byte Train = 0x05;
|
||||
public const Byte TrainReply = 0x06;
|
||||
public const Byte RepeatLast = 0x07;
|
||||
public const Byte RepeatLastReply = 0x08;
|
||||
public const Byte ReadData = 0x09;
|
||||
public const Byte ReadDataReply = 0x0A;
|
||||
public const Byte WriteData = 0x0B;
|
||||
public const Byte WriteDataReply = 0x0C;
|
||||
public const Byte MultipleReadData = 0x0D;
|
||||
public const Byte MultipleReadDataReply = 0x0E;
|
||||
public const Byte MultipleWriteData = 0x0F;
|
||||
public const Byte MultipleWriteDataReply = 0x10;
|
||||
public const Byte SetLevel = 0x11;
|
||||
public const Byte SetLevelReply = 0x12;
|
||||
public const Byte SetBitrateLsb = 0x03;
|
||||
public const Byte SetBitrateMsb = 0x05;
|
||||
public const Byte SetPacketSizesLsb = 0x04;
|
||||
public const Byte SetPacketSizesMsb = 0x05;
|
||||
public const Byte SetProtocolLsb = 0x02;
|
||||
public const Byte SetProtocolMsb = 0x05;
|
||||
|
||||
}
|
||||
|
||||
public static class GP30Payload
|
||||
{
|
||||
public const Byte GetBitrateLsb = 0x00;
|
||||
public const Byte GetBitrateMsb = 0x05;
|
||||
public const Byte GetPacketSizesLsb = 0x01;
|
||||
public const Byte GetPacketSizesMsb = 0x05;
|
||||
public const Byte GetProtocolLsb = 0x02;
|
||||
public const Byte GetProtocolMsb = 0x05;
|
||||
}
|
||||
|
||||
|
||||
public static class GP30BytePosition
|
||||
{
|
||||
public const Byte ErrCodeBase = 2;//1;
|
||||
public const Byte ErrCodeSubreason = 1;//2;
|
||||
public const Byte CrcLsb = 5; // not supported with the common solution
|
||||
public const Byte CrcMsb = 6; // not supported with the common solution
|
||||
public const Byte Cmd = 0; // previously 1
|
||||
public const Byte Reply = 3;// previously 8
|
||||
public const Byte ReplyMsb = 9;
|
||||
public const Byte CmdBitrateLsb = 12;
|
||||
public const Byte CmdBitrateMsb = 13;
|
||||
public const Byte BitrateLsb = 14;
|
||||
public const Byte BitrateMsb = 15;
|
||||
public const Byte CmdPacketSizeLsb = 18;
|
||||
public const Byte CmdPacketSizeMsb = 19;
|
||||
public const Byte PacketSizeLsb = 20;
|
||||
public const Byte PacketSizeMsb = 21;
|
||||
public const Byte CmdProtocolLsb = 24;
|
||||
public const Byte CmdProtocolMsb = 25;
|
||||
public const Byte ProtocolLsb = 26;
|
||||
public const Byte ProtocolMsb = 27;
|
||||
|
||||
}
|
||||
|
||||
public static class GP30ConfigExErrors
|
||||
{
|
||||
public const Byte BaseOk = 0x00;
|
||||
public const Byte Base = 0x04;
|
||||
public const Byte LockedOut = 0x00;
|
||||
public const Byte AuthenticationFail = 0x01;
|
||||
public const Byte AccessDenied = 0x02;
|
||||
public const Byte UnknownParameter = 0x03;
|
||||
public const Byte InUse = 0x04;
|
||||
public const Byte SizesDoNotMatch = 0x05;
|
||||
public const Byte CannotReadConfigfile = 0x06;
|
||||
public const Byte UserNotKnown = 0x07;
|
||||
public const Byte CannotCreateConfigFile = 0x08;
|
||||
public const Byte StoreDidNotStore = 0x09;
|
||||
public const Byte StoreCorrupt = 0x0A;
|
||||
public const Byte ExpectedWrite = 0x0B;
|
||||
public const Byte ExpectedRead = 0x0C;
|
||||
public const Byte StopCycling = 0x0D;
|
||||
public const Byte TooManyOpen = 0x0E;
|
||||
public const Byte NeverOpened = 0x0F;
|
||||
public const Byte FileProtected = 0x1F;
|
||||
public const Byte PartialRecall = 0x2F;
|
||||
public const Byte DefaultPasswordUsed = 0x3F;
|
||||
}
|
||||
|
||||
public static class GP30HighLevelErrors
|
||||
{
|
||||
public const Byte BaseOk = 0x00;
|
||||
public const Byte Base = 0x05;
|
||||
public const Byte PayloadCount = 0x00;
|
||||
public const Byte InvalidSubreason = 0x01;
|
||||
public const Byte InvalidBaudrate = 0x02;
|
||||
public const Byte InvalidBuffersize = 0x03;
|
||||
public const Byte CrcFailure = 0x04;
|
||||
public const Byte UnrecognizedCmd = 0x05;
|
||||
public const Byte Framing = 0x06;
|
||||
public const Byte Overflow = 0x07;
|
||||
public const Byte PacketTimeout = 0x08;
|
||||
public const Byte InvalidEscape = 0x09;
|
||||
public const Byte UnknownParameter = 0x0A;
|
||||
public const Byte TrainingFailed = 0x0B;
|
||||
public const Byte NoBreak = 0x0C;
|
||||
public const Byte NoSubreason = 0xFF;
|
||||
|
||||
}
|
||||
|
||||
static class GP30LowLevelErrors
|
||||
{
|
||||
public const Int16 NoError = 0;
|
||||
public const Int16 SerialPortClosed = -2;
|
||||
public const Int16 SerialPortWriteFailure = -3;
|
||||
public const Int16 SerialPortReadFailure = -4;
|
||||
public const Int16 MaxDataLength = -5;
|
||||
public const Int16 Exception = -6;
|
||||
public const Int16 CrcCalcError = -7;
|
||||
public const Int16 Unknown = -8;
|
||||
public const Int16 Timeout = -9;
|
||||
}
|
||||
|
||||
public static class GP30PrivilegeLevel
|
||||
{
|
||||
public const Byte Level1 = 0x01;
|
||||
public const Byte Level2 = 0x02;
|
||||
public const Byte Level3 = 0x03;
|
||||
public const Byte Level4 = 0x04;
|
||||
public const Byte Level5 = 0x05;
|
||||
public const Byte Level6 = 0x06;
|
||||
public const Byte Level7 = 0x07;
|
||||
public const Byte Level8 = 0x08;
|
||||
public const Byte LevelDefault = 0xFF;
|
||||
|
||||
}
|
||||
|
||||
public static class GP30ConfigRegister
|
||||
{
|
||||
public const Byte Base = 0x05;
|
||||
public const Byte Baudratecapabilities = 0x00;
|
||||
public const Byte Packetsizecapabilties = 0x01;
|
||||
public const Byte Protocolversion = 0x02;
|
||||
public const Byte Baudrateselected = 0x03;
|
||||
public const Byte Packetsizeselected = 0x04;
|
||||
public const Byte Testpulsecontrol = 0x05;
|
||||
}
|
||||
|
||||
public static class GP30Parameters
|
||||
{
|
||||
public const Double FirstHitVoltageMin = 200; // [TBC]
|
||||
public const Double FirstHitVoltageMax = 1000; // [TBC]
|
||||
public const UInt16 Timeout = 5;
|
||||
public const UInt16 PasswordMaxlength = 12;
|
||||
public const UInt16 TXDataMaxlength = 8;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Graph stuff
|
||||
public class zedGraphParameters
|
||||
{
|
||||
public String Title = "default";
|
||||
public String xAxis = "default";
|
||||
public String yAxis = "default";
|
||||
}
|
||||
#endregion
|
||||
#region Error logging
|
||||
public static class LogErrReason
|
||||
{
|
||||
public static String Exception()
|
||||
{
|
||||
return "exception";
|
||||
}
|
||||
|
||||
public const String Function = "function";
|
||||
public const String Unknown = "unknown";
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Printing;
|
||||
using ZedGraph;
|
||||
using System.IO;
|
||||
|
||||
namespace GenesisDisplayTool
|
||||
{
|
||||
|
||||
public partial class GENESIS_DISPLAY_TOOL : Form
|
||||
{
|
||||
private String CsvMeanPage(Boolean replaceUnits)
|
||||
{
|
||||
String Data = String.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
Data =
|
||||
l_MeanValuesTof0UpPath0.Text + ";" + l_MeanValuesTof0UpDispPath0.Text + ";" + l_MeanValuesTof0UpDispPath1.Text + ";" + l_MeanValuesTof0UpDispPath2.Text + ";\n" +
|
||||
l_MeanValuesTof1UpPath0.Text + ";" + l_MeanValuesTof1UpDispPath0.Text + ";" + l_MeanValuesTof1UpDispPath1.Text + ";" + l_MeanValuesTof1UpDispPath2.Text + ";\n" +
|
||||
l_MeanValuesTof2UpPath0.Text + ";" + l_MeanValuesTof2UpDispPath0.Text + ";" + l_MeanValuesTof2UpDispPath1.Text + ";" + l_MeanValuesTof2UpDispPath2.Text + ";\n" +
|
||||
l_MeanValuesTof3UpPath0.Text + ";" + l_MeanValuesTof3UpDispPath0.Text + ";" + l_MeanValuesTof3UpDispPath1.Text + ";" + l_MeanValuesTof3UpDispPath2.Text + ";\n" +
|
||||
l_MeanValuesTof4UpPath0.Text + ";" + l_MeanValuesTof4UpDispPath0.Text + ";" + l_MeanValuesTof4UpDispPath1.Text + ";" + l_MeanValuesTof4UpDispPath2.Text + ";\n" +
|
||||
l_MeanValuesTof5UpPath0.Text + ";" + l_MeanValuesTof5UpDispPath0.Text + ";" + l_MeanValuesTof5UpDispPath1.Text + ";" + l_MeanValuesTof5UpDispPath2.Text + ";\n" +
|
||||
l_MeanValuesTof6UpPath0.Text + ";" + l_MeanValuesTof6UpDispPath0.Text + ";" + l_MeanValuesTof6UpDispPath1.Text + ";" + l_MeanValuesTof6UpDispPath2.Text + ";\n" +
|
||||
l_MeanValuesTof7UpPath0.Text + ";" + l_MeanValuesTof7UpDispPath0.Text + ";" + l_MeanValuesTof7UpDispPath1.Text + ";" + l_MeanValuesTof7UpDispPath2.Text + ";\n" +
|
||||
l_MeanValuesTof0DownPath0.Text + ";" + l_MeanValuesTof0DownDispPath0.Text + ";" + l_MeanValuesTof0DownDispPath1.Text + ";" + l_MeanValuesTof0DownDispPath2.Text + ";\n" +
|
||||
l_MeanValuesTof1DownPath0.Text + ";" + l_MeanValuesTof1DownDispPath0.Text + ";" + l_MeanValuesTof1DownDispPath1.Text + ";" + l_MeanValuesTof1DownDispPath2.Text + ";\n" +
|
||||
l_MeanValuesTof2DownPath0.Text + ";" + l_MeanValuesTof2DownDispPath0.Text + ";" + l_MeanValuesTof2DownDispPath1.Text + ";" + l_MeanValuesTof2DownDispPath2.Text + ";\n" +
|
||||
l_MeanValuesTof3DownPath0.Text + ";" + l_MeanValuesTof3DownDispPath0.Text + ";" + l_MeanValuesTof3DownDispPath1.Text + ";" + l_MeanValuesTof3DownDispPath2.Text + ";\n" +
|
||||
l_MeanValuesTof4DownPath0.Text + ";" + l_MeanValuesTof4DownDispPath0.Text + ";" + l_MeanValuesTof4DownDispPath1.Text + ";" + l_MeanValuesTof4DownDispPath2.Text + ";\n" +
|
||||
l_MeanValuesTof5DownPath0.Text + ";" + l_MeanValuesTof5DownDispPath0.Text + ";" + l_MeanValuesTof5DownDispPath1.Text + ";" + l_MeanValuesTof5DownDispPath2.Text + ";\n" +
|
||||
l_MeanValuesTof6DownPath0.Text + ";" + l_MeanValuesTof6DownDispPath0.Text + ";" + l_MeanValuesTof6DownDispPath1.Text + ";" + l_MeanValuesTof6DownDispPath2.Text + ";\n" +
|
||||
l_MeanValuesTof7DownPath0.Text + ";" + l_MeanValuesTof7DownDispPath0.Text + ";" + l_MeanValuesTof7DownDispPath1.Text + ";" + l_MeanValuesTof7DownDispPath2.Text + ";\n" +
|
||||
l_MeanValuesDifTof0Path0.Text + ";" + l_MeanValuesDifTof0DispPath0.Text + ";" + l_MeanValuesDifTof0DispPath1.Text + ";" + l_MeanValuesDifTof0DispPath2.Text + ";\n" +
|
||||
l_MeanValuesDifTof1Path0.Text + ";" + l_MeanValuesDifTof1DispPath0.Text + ";" + l_MeanValuesDifTof1DispPath1.Text + ";" + l_MeanValuesDifTof1DispPath2.Text + ";\n" +
|
||||
l_MeanValuesDifTof2Path0.Text + ";" + l_MeanValuesDifTof2DispPath0.Text + ";" + l_MeanValuesDifTof2DispPath1.Text + ";" + l_MeanValuesDifTof2DispPath2.Text + ";\n" +
|
||||
l_MeanValuesDifTof3Path0.Text + ";" + l_MeanValuesDifTof3DispPath0.Text + ";" + l_MeanValuesDifTof3DispPath1.Text + ";" + l_MeanValuesDifTof3DispPath2.Text + ";\n" +
|
||||
l_MeanValuesDifTof4Path0.Text + ";" + l_MeanValuesDifTof4DispPath0.Text + ";" + l_MeanValuesDifTof4DispPath1.Text + ";" + l_MeanValuesDifTof4DispPath2.Text + ";\n" +
|
||||
l_MeanValuesDifTof5Path0.Text + ";" + l_MeanValuesDifTof5DispPath0.Text + ";" + l_MeanValuesDifTof5DispPath1.Text + ";" + l_MeanValuesDifTof5DispPath2.Text + ";\n" +
|
||||
l_MeanValuesDifTof6Path0.Text + ";" + l_MeanValuesDifTof6DispPath0.Text + ";" + l_MeanValuesDifTof6DispPath1.Text + ";" + l_MeanValuesDifTof6DispPath2.Text + ";\n" +
|
||||
l_MeanValuesDifTof7Path0.Text + ";" + l_MeanValuesDifTof7DispPath0.Text + ";" + l_MeanValuesDifTof7DispPath1.Text + ";" + l_MeanValuesDifTof7DispPath2.Text + ";\n" +
|
||||
l_MeanValuesDifTof3ZcPath0.Text + ";" + l_MeanValuesDifTof3ZcDispPath0.Text + ";" + l_MeanValuesDifTof3ZcDispPath1.Text + ";" + l_MeanValuesDifTof3ZcDispPath2.Text + ";\n" +
|
||||
l_MeanValuesDifTof8ZcPath0.Text + ";" + l_MeanValuesDifTof8ZcDispPath0.Text + ";" + l_MeanValuesDifTof8ZcDispPath1.Text + ";" + l_MeanValuesDifTof8ZcDispPath2.Text + ";\n" +
|
||||
l_MeanValuesAmplitudeUpPath0.Text + ";" + l_MeanValuesAmplitudeUpDispPath0.Text + ";" + l_MeanValuesAmplitudeUpDispPath1.Text + ";" + l_MeanValuesAmplitudeUpDispPath2.Text + ";\n" +
|
||||
l_MeanValuesAmplitudeUpPath0.Text + ";" + l_MeanValuesAmplitudeUpDispPath0.Text + ";" + l_MeanValuesAmplitudeUpDispPath1.Text + ";" + l_MeanValuesAmplitudeDownDispPath2.Text + ";\n" +
|
||||
l_MeanValuesPulsewidthUpPath0.Text + ";" + l_MeanValuesPulsewidthUpDispPath0.Text + ";" + l_MeanValuesPulsewidthUpDispPath1.Text + ";" + l_MeanValuesPulsewidthUpDispPath2.Text + ";\n" +
|
||||
l_MeanValuesPulsewidthDownPath0.Text + ";" + l_MeanValuesPulsewidthUpDispPath0.Text + ";" + l_MeanValuesPulsewidthUpDispPath1.Text + ";" + l_MeanValuesPulsewidthDownDispPath2.Text + ";\n" +
|
||||
l_MeanValuesTemperaturePath0.Text + ";" + l_MeanValuesTemperatureDispPath0.Text + ";" + l_MeanValuesTemperatureDispPath1.Text + ";" + l_MeanValuesTemperatureDispPath2.Text + ";\n";
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "CsvMeanPage() failed", "0x" + ex.HResult.ToString("X", globalCulture), String.Empty);
|
||||
#endregion
|
||||
|
||||
}
|
||||
if (replaceUnits)
|
||||
{
|
||||
Data = Data.Replace(Units.TempDispString, String.Empty);
|
||||
Data = Data.Replace(Units.AmpDispString, String.Empty);
|
||||
Data = Data.Replace(Units.Flow, String.Empty);
|
||||
Data = Data.Replace(Units.TofDispString, String.Empty);
|
||||
Data = Data.Replace(Units.DifTofDispString, String.Empty);
|
||||
Data = Data.Replace("---", String.Empty);
|
||||
}
|
||||
return Data;
|
||||
}
|
||||
private String CsvDecodedDataPage(Boolean replaceUnits)
|
||||
{
|
||||
String Data = String.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
Data =
|
||||
l_HccValPath0.Text + ";" + l_HccValDispPath0.Text + ";" + l_HccValDispPath1.Text + ";" + l_HccValDispPath2.Text + ";\n" +
|
||||
l_HccCorrectionFactorPath0.Text + ";" + l_HccCorrectionFactorDispPath0.Text + ";" + l_HccCorrectionFactorDispPath1.Text + ";" + l_HccCorrectionFactorDispPath2.Text + ";\n" +
|
||||
l_TofSumOfAllUpPath0.Text + ";" + l_TofSumOfAllUpDispPath0.Text + ";" + l_TofSumOfAllUpDispPath1.Text + ";" + l_TofSumOfAllUpDispPath2.Text + ";\n" +
|
||||
l_TofSumOfAllDownPath0.Text + ";" + l_TofSumOfAllDownDispPath0.Text + ";" + l_TofSumOfAllDownDispPath1.Text + ";" + l_TofSumOfAllDownDispPath2.Text + ";\n" +
|
||||
l_PwUpPath0.Text + ";" + l_PwUpDispPath0.Text + ";" + l_PwUpDispPath1.Text + ";" + l_PwUpDispPath2.Text + ";\n" +
|
||||
l_PwDownPath0.Text + ";" + l_PwDownDispPath0.Text + ";" + l_PwDownDispPath1.Text + ";" + l_PwDownDispPath2.Text + ";\n" +
|
||||
l_AmpUpPath0.Text + ";" + l_AmpUpDispPath0.Text + ";" + l_AmpUpDispPath1.Text + ";" + l_AmpUpDispPath2.Text + ";\n" +
|
||||
l_AmpDownPath0.Text + ";" + l_AmpDownDispPath0.Text + ";" + l_AmpDownDispPath1.Text + ";" + l_AmpDownDispPath2.Text + ";\n" +
|
||||
l_Tof0UpPath0.Text + ";" + l_Tof0UpDispPath0.Text + ";" + l_Tof0UpDispPath1.Text + ";" + l_MeanValuesTof0UpDispPath2.Text + ";\n" +
|
||||
l_Tof1UpPath0.Text + ";" + l_Tof1UpDispPath0.Text + ";" + l_Tof1UpDispPath1.Text + ";" + l_MeanValuesTof1UpDispPath2.Text + ";\n" +
|
||||
l_Tof2UpPath0.Text + ";" + l_Tof2UpDispPath0.Text + ";" + l_Tof2UpDispPath1.Text + ";" + l_MeanValuesTof2UpDispPath2.Text + ";\n" +
|
||||
l_Tof3UpPath0.Text + ";" + l_Tof3UpDispPath0.Text + ";" + l_Tof3UpDispPath1.Text + ";" + l_MeanValuesTof3UpDispPath2.Text + ";\n" +
|
||||
l_Tof4UpPath0.Text + ";" + l_Tof4UpDispPath0.Text + ";" + l_Tof4UpDispPath1.Text + ";" + l_MeanValuesTof4UpDispPath2.Text + ";\n" +
|
||||
l_Tof5UpPath0.Text + ";" + l_Tof5UpDispPath0.Text + ";" + l_Tof5UpDispPath1.Text + ";" + l_MeanValuesTof5UpDispPath2.Text + ";\n" +
|
||||
l_Tof6UpPath0.Text + ";" + l_Tof6UpDispPath0.Text + ";" + l_Tof6UpDispPath1.Text + ";" + l_MeanValuesTof6UpDispPath2.Text + ";\n" +
|
||||
l_Tof7UpPath0.Text + ";" + l_Tof7UpDispPath0.Text + ";" + l_Tof7UpDispPath1.Text + ";" + l_MeanValuesTof7UpDispPath2.Text + ";\n" +
|
||||
l_Tof0DownPath0.Text + ";" + l_Tof0DownDispPath0.Text + ";" + l_Tof0DownDispPath1.Text + ";" + l_Tof0DownDispPath2.Text + ";\n" +
|
||||
l_Tof1DownPath0.Text + ";" + l_Tof1DownDispPath0.Text + ";" + l_Tof1DownDispPath1.Text + ";" + l_Tof1DownDispPath2.Text + ";\n" +
|
||||
l_Tof2DownPath0.Text + ";" + l_Tof2DownDispPath0.Text + ";" + l_Tof2DownDispPath1.Text + ";" + l_Tof2DownDispPath2.Text + ";\n" +
|
||||
l_Tof3DownPath0.Text + ";" + l_Tof3DownDispPath0.Text + ";" + l_Tof3DownDispPath1.Text + ";" + l_Tof3DownDispPath2.Text + ";\n" +
|
||||
l_Tof4DownPath0.Text + ";" + l_Tof4DownDispPath0.Text + ";" + l_Tof4DownDispPath1.Text + ";" + l_Tof4DownDispPath2.Text + ";\n" +
|
||||
l_Tof5DownPath0.Text + ";" + l_Tof5DownDispPath0.Text + ";" + l_Tof5DownDispPath1.Text + ";" + l_Tof5DownDispPath2.Text + ";\n" +
|
||||
l_Tof6DownPath0.Text + ";" + l_Tof6DownDispPath0.Text + ";" + l_Tof6DownDispPath1.Text + ";" + l_Tof6DownDispPath2.Text + ";\n" +
|
||||
l_Tof7DownPath0.Text + ";" + l_Tof7DownDispPath0.Text + ";" + l_Tof7DownDispPath1.Text + ";" + l_Tof7DownDispPath2.Text + ";\n" +
|
||||
l_DifTof0Path0.Text + ";" + l_DifTof0DispPath0.Text + ";" + l_DifTof0DispPath1.Text + ";" + l_DifTof0DispPath2.Text + ";\n" +
|
||||
l_DifTof1Path0.Text + ";" + l_DifTof1DispPath0.Text + ";" + l_DifTof1DispPath1.Text + ";" + l_DifTof1DispPath2.Text + ";\n" +
|
||||
l_DifTof2Path0.Text + ";" + l_DifTof2DispPath0.Text + ";" + l_DifTof2DispPath1.Text + ";" + l_DifTof2DispPath2.Text + ";\n" +
|
||||
l_DifTof3Path0.Text + ";" + l_DifTof3DispPath0.Text + ";" + l_DifTof3DispPath1.Text + ";" + l_DifTof3DispPath2.Text + ";\n" +
|
||||
l_DifTof4Path0.Text + ";" + l_DifTof4DispPath0.Text + ";" + l_DifTof4DispPath1.Text + ";" + l_DifTof4DispPath2.Text + ";\n" +
|
||||
l_DifTof5Path0.Text + ";" + l_DifTof5DispPath0.Text + ";" + l_DifTof5DispPath1.Text + ";" + l_DifTof5DispPath2.Text + ";\n" +
|
||||
l_DifTof6Path0.Text + ";" + l_DifTof6DispPath0.Text + ";" + l_DifTof6DispPath1.Text + ";" + l_DifTof6DispPath2.Text + ";\n" +
|
||||
l_DifTof7Path0.Text + ";" + l_DifTof7DispPath0.Text + ";" + l_DifTof7DispPath1.Text + ";" + l_DifTof7DispPath2.Text + ";\n" +
|
||||
l_TemperaturePath0.Text + ";" + l_TemperatureDispPath0.Text + ";" + l_TemperatureDispPath1.Text + ";" + l_TemperatureDispPath2.Text + ";\n" +
|
||||
l_FlowPath0.Text + ";" + l_FlowDispPath0.Text + ";" + l_FlowDispPath1.Text + ";" + l_FlowDispPath2.Text + ";\n";
|
||||
|
||||
|
||||
if (replaceUnits)
|
||||
{
|
||||
Data = Data.Replace(Units.TofDispString, String.Empty);
|
||||
Data = Data.Replace(Units.DifTofDispString, String.Empty);
|
||||
Data = Data.Replace(Units.TempDispString, String.Empty);
|
||||
Data = Data.Replace(Units.AmpDispString, String.Empty);
|
||||
Data = Data.Replace(Units.Flow, String.Empty);
|
||||
Data = Data.Replace("---", String.Empty);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "CsvDecodedDataPage() failed", "0x" + ex.HResult.ToString("X", globalCulture), String.Empty);
|
||||
#endregion
|
||||
}
|
||||
|
||||
return Data;
|
||||
}
|
||||
private String CsvStdDeviationPage(Boolean replaceUnits)
|
||||
{
|
||||
String Data = String.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
Data =
|
||||
l_StdDev0PATH0.Text + ";" + l_StdDev0DispPATH0.Text + ";" + l_StdDev0DispPATH1.Text + ";" + l_StdDev0DispPATH2.Text + ";\n" +
|
||||
l_StdDev1PATH0.Text + ";" + l_StdDev1DispPATH0.Text + ";" + l_StdDev1DispPATH1.Text + ";" + l_StdDev1DispPATH2.Text + ";\n" +
|
||||
l_StdDev2PATH0.Text + ";" + l_StdDev2DispPATH0.Text + ";" + l_StdDev2DispPATH1.Text + ";" + l_StdDev2DispPATH2.Text + ";\n" +
|
||||
l_StdDev3PATH0.Text + ";" + l_StdDev3DispPATH0.Text + ";" + l_StdDev3DispPATH1.Text + ";" + l_StdDev3DispPATH2.Text + ";\n" +
|
||||
l_StdDev4PATH0.Text + ";" + l_StdDev4DispPATH0.Text + ";" + l_StdDev4DispPATH1.Text + ";" + l_StdDev4DispPATH2.Text + ";\n" +
|
||||
l_StdDev5PATH0.Text + ";" + l_StdDev5DispPATH0.Text + ";" + l_StdDev5DispPATH1.Text + ";" + l_StdDev5DispPATH2.Text + ";\n" +
|
||||
l_StdDev6PATH0.Text + ";" + l_StdDev6DispPATH0.Text + ";" + l_StdDev6DispPATH1.Text + ";" + l_StdDev6DispPATH2.Text + ";\n" +
|
||||
l_StdDev7PATH0.Text + ";" + l_StdDev7DispPATH0.Text + ";" + l_StdDev7DispPATH1.Text + ";" + l_StdDev7DispPATH2.Text + ";\n" +
|
||||
l_StdDev8ZeroCrossingsPath0.Text + ";" + l_StdDev8ZeroCrossingsDispPath0.Text + ";" + l_StdDev8ZeroCrossingsDispPath1.Text + ";" + l_StdDev8ZeroCrossingsDispPath2.Text + ";\n" +
|
||||
l_StdDev3ZeroCrossingsPath0.Text + ";" + l_StdDev3ZeroCrossingsDispPath0.Text + ";" + l_StdDev3ZeroCrossingsDispPath1.Text + ";" + l_StdDev3ZeroCrossingsDispPath2.Text + ";\n";
|
||||
if (replaceUnits)
|
||||
{
|
||||
Data = Data.Replace(Units.StdDevDispString, String.Empty);
|
||||
Data = Data.Replace("---", String.Empty);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "CsvStdDeviationPage() failed", "0x" + ex.HResult.ToString("X", globalCulture), String.Empty);
|
||||
#endregion
|
||||
}
|
||||
|
||||
return Data;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,701 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Printing;
|
||||
using ZedGraph;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
|
||||
|
||||
namespace GenesisDisplayTool
|
||||
{
|
||||
public static class DecodedDataHelper
|
||||
{
|
||||
public static DecodedData[] getDefaultDecodedDataArray(Int32 count)
|
||||
{
|
||||
var ret = new DecodedData[count];
|
||||
for (Int32 i = 0; i < count; i++)
|
||||
{
|
||||
ret[i] = getDefaultDecodedData();
|
||||
}
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
public static DecodedData getDefaultDecodedData()
|
||||
{
|
||||
return new DecodedData()
|
||||
{
|
||||
test = 0,
|
||||
DataValid = "0",
|
||||
MessageType = String.Empty,
|
||||
ProtocolVersion = String.Empty,
|
||||
Comment = String.Empty,
|
||||
HccVal = 0,
|
||||
TofSumOfAllUp = 0,
|
||||
TofSumOfAllDown = 0,
|
||||
TofUp = new Double[8] { 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
TofDown = new Double[8] { 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
DifTof = new Double[8] { 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
PulsewidthUp = 0,
|
||||
PulsewidthDown = 0,
|
||||
AmpUpRaw = 0,
|
||||
AmpDownRaw = 0,
|
||||
AmpUpCalculated = 0,
|
||||
AmpDownCalculated = 0,
|
||||
AmpCalHigh = 0,
|
||||
AmpCalLow = 0,
|
||||
AmpOffset = 0,
|
||||
AmpGradient = 0,
|
||||
TemperatureHot = 0,
|
||||
TemperatureCold = 0,
|
||||
HccCorrectionFactor = Constants.DefaultHccCorrectionFactor,
|
||||
Path = 0,
|
||||
DeltaTimeOfFlight = 0.0, // protocol version 'e'
|
||||
RawDeltaVolume = 0.0, // protocol version 'e'
|
||||
RawDeltaVolumeScaling = 0.0, // protocol version 'e'
|
||||
SampleInterval = 0,
|
||||
Flow = 0,
|
||||
|
||||
TofSumOfAllUpMean = 0,
|
||||
TofSumOfAllDownMean = 0,
|
||||
TofUpMean = new Double[8] { 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
TofDownMean = new Double[8] { 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
DifTofMean = new Double[8] { 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
DifTof3HitsMean = 0,
|
||||
DifTof8HitsMean = 0,
|
||||
PulsewidthUpMean = 0,
|
||||
PulsewidthDownMean = 0,
|
||||
AmpUpMean = 0,
|
||||
AmpDownMean = 0,
|
||||
TemperatureHotMean = 0,
|
||||
FlowMean = 0,
|
||||
|
||||
DifTof3HitsStdDeviation = 0,
|
||||
DifTof8HitsStdDeviation = 0,
|
||||
StdDeviation = new Double[8] { 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
|
||||
Mode = String.Empty,
|
||||
RawTimestamp = String.Empty,
|
||||
CsvTimestamp = String.Empty,
|
||||
DecodingSuceeded = false,
|
||||
FProt_DisplayVol = 0,
|
||||
FProt_Time = 0,
|
||||
CRC = String.Empty,
|
||||
|
||||
#region G-Protocol
|
||||
GProt_AmplitudeUp = 0,
|
||||
GProt_AmplitudeDown = 0,
|
||||
GProt_PulsewidthRatioUp = 0,
|
||||
GProt_PulsewidthRatioDown = 0,
|
||||
#endregion
|
||||
#region H-Protocol
|
||||
HProt_Error = 0,
|
||||
HProt_RawTemperature = 0,
|
||||
HProt_CalculatedTemperature = 0,
|
||||
HProt_TotalTimeOfFlightAvg = 0,
|
||||
HProt_TimeOfFlightUp = 0,
|
||||
HProt_TimeOfFlightDown = 0,
|
||||
HProt_TemperatureScale = 0,
|
||||
HProt_AmplitudeDown = 0,
|
||||
HProt_AmplitudeUp = 0,
|
||||
HProt_DeltaTimeOfFlight = 0,
|
||||
HProt_RawDeltaVolume = 0,
|
||||
HProt_RawDeltaVolumeScaling = 0,
|
||||
HProt_RawDeltaVolumeAccu = 0,
|
||||
HProt_DeltaVolumeQm = 0,
|
||||
HProt_AccuVolumeQm = 0,
|
||||
#endregion
|
||||
#region I-Protocol
|
||||
IProt_SumOfAllUp = 0,
|
||||
IProt_PwUp = 0,
|
||||
IProt_AmpUp = 0,
|
||||
IProt_AmpCalHigh = 0,
|
||||
IProt_SumOfAllDown = 0,
|
||||
IProt_PwDown = 0,
|
||||
IProt_AmpCalLow = 0,
|
||||
IProt_AmpGradient = 0,
|
||||
IProt_AmpOffset = 0,
|
||||
IProt_AmpUpCalculated = 0,
|
||||
IProt_AmpDownCalculated = 0,
|
||||
IProt_TofUp = new Double[8] { 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
IProt_TofDown = new Double[8] { 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
IProt_DifTof = new Double[8] { 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
IProt_Crc = String.Empty
|
||||
|
||||
#endregion
|
||||
};
|
||||
}
|
||||
}
|
||||
public class DecodedData : ICloneable
|
||||
{
|
||||
#region For all protocols
|
||||
public Double test;
|
||||
public String DataValid;
|
||||
public String MessageType;
|
||||
public String ProtocolVersion;
|
||||
public UInt16 Path;
|
||||
#endregion
|
||||
#region D-protocol
|
||||
public String Comment;
|
||||
public Double HccVal;
|
||||
public Double TofSumOfAllUp;
|
||||
public Double TofSumOfAllDown;
|
||||
public Double[] TofUp = new Double[8];
|
||||
public Double[] TofDown = new Double[8];
|
||||
public Double[] DifTof = new Double[8];
|
||||
public Double PulsewidthUp;
|
||||
public Double PulsewidthDown;
|
||||
public Double AmpUpRaw;
|
||||
public Double AmpDownRaw;
|
||||
public Double AmpUpCalculated;
|
||||
public Double AmpDownCalculated;
|
||||
public Double AmpCalHigh;
|
||||
private Double ampCalLow;
|
||||
public Double AmpCalLow { get { return ampCalLow; } set { ampCalLow = value; } }
|
||||
public Double AmpOffset;
|
||||
public Double AmpGradient;
|
||||
public Double TemperatureHot;
|
||||
public Double TemperatureCold;
|
||||
public Double HccCorrectionFactor;
|
||||
#endregion
|
||||
#region E-protocol/ G-protocol
|
||||
public Double DeltaTimeOfFlight; // protocol version 'e' and 'g'
|
||||
public Double RawDeltaVolume; // protocol version 'e'
|
||||
public Double RawDeltaVolumeScaling; // protocol version 'e'
|
||||
|
||||
public Double RawDeltaVolumeAccu; // protocol version 'e'
|
||||
public Double SampleInterval;
|
||||
public Double Flow;
|
||||
#endregion
|
||||
#region F-protocol
|
||||
public Int32 FProt_DisplayVol;
|
||||
public Int32 FProt_Time;
|
||||
public Int32 GProt_Time;
|
||||
public String CRC;
|
||||
#endregion
|
||||
#region G-protocol
|
||||
public Double GProt_AmplitudeUp;
|
||||
public Double GProt_AmplitudeDown;
|
||||
public Double GProt_PulsewidthRatioUp;
|
||||
public Double GProt_PulsewidthRatioDown;
|
||||
#endregion
|
||||
#region I-protocol
|
||||
public Int32 IProt_Valid;
|
||||
public Double IProt_SumOfAllUp;
|
||||
public Double IProt_PwUp;
|
||||
public Double IProt_AmpUp;
|
||||
public Double IProt_AmpCalHigh;
|
||||
public Double IProt_SumOfAllDown;
|
||||
public Double[] IProt_DifTof;
|
||||
public Double IProt_PwDown;
|
||||
public Double IProt_AmpDown;
|
||||
public Double IProt_AmpCalLow;
|
||||
public Double IProt_AmpGradient;
|
||||
public Double IProt_AmpOffset;
|
||||
public Double IProt_AmpUpCalculated;
|
||||
public Double IProt_AmpDownCalculated;
|
||||
public Double IProt_Temperature;
|
||||
public Double[] IProt_TofUp = new Double[8];
|
||||
public Double[] IProt_TofDown = new Double[8];
|
||||
public Boolean DataForGraph;
|
||||
public Boolean DataForTempGraph;
|
||||
public String IProt_Crc;
|
||||
#endregion
|
||||
#region H-protocol
|
||||
public Int32 HProt_Error;
|
||||
public Double HProt_SampleInterval;
|
||||
public Double HProt_AmplitudeUp;
|
||||
public Double HProt_AmplitudeDown;
|
||||
public Double HProt_TotalTimeOfFlightAvg;
|
||||
public Double HProt_DeltaTimeOfFlight;
|
||||
public Double HProt_RawDeltaVolume;
|
||||
public Double HProt_RawDeltaVolumeAccu;
|
||||
public Double HProt_DeltaVolumeQm;
|
||||
public Double HProt_AccuVolumeQm;
|
||||
public Double HProt_RawDeltaVolumeScaling;
|
||||
public Double HProt_TimeOfFlightUp;
|
||||
public Double HProt_TimeOfFlightDown;
|
||||
public Double HProt_RawTemperature;
|
||||
public Double HProt_CalculatedTemperature;
|
||||
public Double HProt_TemperatureScale;
|
||||
public UInt32 HProt_Time;
|
||||
#endregion
|
||||
#region Mean values
|
||||
public Double TofSumOfAllUpMean;
|
||||
public Double TofSumOfAllDownMean;
|
||||
public Double[] TofUpMean = new Double[8];
|
||||
public Double[] TofDownMean = new Double[8];
|
||||
public Double[] DifTofMean = new Double[8];
|
||||
public Double DifTof3HitsMean;
|
||||
public Double DifTof8HitsMean;
|
||||
public Double PulsewidthUpMean;
|
||||
public Double PulsewidthDownMean;
|
||||
public Double AmpUpMean;
|
||||
public Double AmpDownMean;
|
||||
public Double TemperatureHotMean;
|
||||
public Double TemperatureColdMean;
|
||||
public Double FlowMean;
|
||||
#endregion
|
||||
#region Standard deviation
|
||||
public Double DifTof3HitsStdDeviation;
|
||||
public Double DifTof8HitsStdDeviation;
|
||||
public Double[] StdDeviation;
|
||||
#endregion
|
||||
#region Miscellaneous
|
||||
public String Mode;
|
||||
public String RawTimestamp;
|
||||
public String CsvTimestamp;
|
||||
public Boolean DecodingSuceeded;
|
||||
#endregion
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var toClone = (DecodedData)MemberwiseClone();
|
||||
|
||||
toClone.TofUp = (Double[])TofUp.Clone();
|
||||
toClone.TofDown = (Double[])TofDown.Clone();
|
||||
toClone.DifTof = (Double[])DifTof.Clone();
|
||||
|
||||
return toClone;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public partial class GENESIS_DISPLAY_TOOL : Form
|
||||
{
|
||||
Int32 GcCounter = 0;
|
||||
|
||||
private void MainLoop(object sender, EventArgs e)
|
||||
{
|
||||
CultureInfo Culture = GetGlobalCulture();
|
||||
const UInt16 MeterNumber = Constants.Meter1;
|
||||
|
||||
#region Definitions and initializations
|
||||
DecodedData[] DecodingResult = DecodedDataHelper.getDefaultDecodedDataArray(Constants.NumberOfPaths);
|
||||
DecodingResult[Constants.PATH0] = ((DecodedData)Decoded[Constants.PATH0].Clone());
|
||||
DecodingResult[Constants.PATH1] = ((DecodedData)Decoded[Constants.PATH1].Clone());
|
||||
DecodingResult[Constants.PATH2] = ((DecodedData)Decoded[Constants.PATH2].Clone());
|
||||
String MessageType = String.Empty;
|
||||
String ProtocolVersion = String.Empty;
|
||||
String Temp = String.Empty;
|
||||
|
||||
|
||||
//l_DispRxStringLength.Text = RxDataBuffer[MeterNumber].Length.ToString(culture); // Debug length of rxstring
|
||||
#endregion
|
||||
#region Prepare data
|
||||
if (RxDataBuffer[MeterNumber].Contains("@"))
|
||||
{
|
||||
Temp = $"{RxDataBuffer[MeterNumber]}\n";
|
||||
RxDataBuffer[MeterNumber] = String.Empty;
|
||||
ValidData[MeterNumber] = true;
|
||||
}
|
||||
else
|
||||
ValidData[MeterNumber] = false;
|
||||
#endregion
|
||||
#region Decode
|
||||
if (ValidData[MeterNumber])
|
||||
{
|
||||
ValidData[MeterNumber] = false;
|
||||
#region Decode data
|
||||
DecodingResult = DecodeTelegram.DecodedDataDecodeTelegram(Temp, cB_StdDevEnable.Checked, cB_MeanValuesEnable.Checked, DecodingResult, Constants.NominalFrequency);
|
||||
#endregion
|
||||
#region Get timestamp
|
||||
DateTime CurrentTime = new DateTime();
|
||||
CurrentTime = DateTime.Now;
|
||||
String RawTimestamp = CurrentTime.ToString(Formats.RawDataDateTimeLogString, Culture);
|
||||
String CsvTimestamp = CurrentTime.ToString(Formats.CsvDateTimeLogString, Culture);
|
||||
#endregion
|
||||
#region Additional decoding parameters
|
||||
UInt16 Path = DecodingResult[Constants.PATH0].Path; // the same value for all paths
|
||||
MessageType = DecodingResult[Path].MessageType;
|
||||
ProtocolVersion = DecodingResult[Path].ProtocolVersion;
|
||||
#endregion
|
||||
#region Raw data
|
||||
RawData.DisplayText(RawTimestamp, Temp, Culture);
|
||||
RawData.SaveText(SaveDataPathRaw, RawTimestamp, RawLoggingSingleMeterEnable, Temp, Constants.RawCyclesToStorage, Culture); // print complet
|
||||
#endregion
|
||||
#region Labels
|
||||
Display.DecodedDataUpdateLabels(DecodingResult, Path, Culture);
|
||||
#endregion
|
||||
#region Comment field
|
||||
//if ((UInt16.Equals(Path, Constants.PATH0)) && (String.Equals(MessageType, Message.Comment)))
|
||||
//{
|
||||
// if (rTB_DecodedDataComment.Text.Length > nUD_SettingsCommentFieldAutoclear.Value)
|
||||
// rTB_DecodedDataComment.Clear();
|
||||
// rTB_DecodedDataComment.AppendText($"{DecodingResult[Constants.PATH0].Comment}\n");
|
||||
// rTB_DecodedDataComment.ScrollToCaret();
|
||||
//}
|
||||
#endregion
|
||||
#region Maingraph
|
||||
// Maingraph1.InitParameters((Double)nUD_SettingsXMainGraph.Value, lB_Graph_SelectGraph.Text, cB_MultihitOverallAvgEn.Checked, (Int32)nUD_SettingsStdDev.Value, (Int32)nUD_SettingsMean.Value);
|
||||
if ((cB_GraphReset.Checked))// && (MessageType == Message.Data))
|
||||
{
|
||||
#region Live values
|
||||
if ((!lB_Graph_SelectGraph.Text.Contains("Mean")) && (!lB_Graph_SelectGraph.Text.Contains("deviation"))&& (Boolean.Equals(DecodingResult[Path].DataForGraph, true)))
|
||||
{
|
||||
AssignDataToMainGraph(DecodingResult, Path, ref GraphListMainTotal, ref GraphListMainWindow, (Double)nUD_SettingsXMainGraph.Value);
|
||||
//zGC_MainGraph.AssignData(DecodingResult, Path, ref GraphCounterDataMainTotal, ref GraphIndexOfLists);
|
||||
goto SkipOptions; // also works without 'goto' if you're wanna be MISRA compliant
|
||||
}
|
||||
#endregion
|
||||
//#region Mean values/ no std deviation
|
||||
//if ((lB_Graph_SelectGraph.Text.Contains("Mean")) && (!lB_Graph_SelectGraph.Text.Contains("deviation")))
|
||||
//{
|
||||
// if(((Int32)TelegramCounterTofMean[Constants.PATH0] >= (Int32)nUD_SettingsMean.Value||
|
||||
// ((Int32)TelegramCounterFlowMean[Constants.PATH0] >= (Int32)nUD_SettingsMean.Value))||
|
||||
// ((Int32)TelegramCounterOthersMean[Constants.PATH0] >= (Int32)nUD_SettingsMean.Value))
|
||||
// //Maingraph1.AssignData(DecodingResult, Path, ref GraphCounterDataMainTotal, ref GraphIndexOfLists);
|
||||
|
||||
// goto SkipOptions; // also works without 'goto'
|
||||
//}
|
||||
//#endregion
|
||||
//#region Std deviation/ no mean values
|
||||
//if ((!lB_Graph_SelectGraph.Text.Contains("Mean")) && (lB_Graph_SelectGraph.Text.Contains("deviation")))
|
||||
//{
|
||||
// if ((Int32)TelegramCounterStdDeviationMultihit[Constants.PATH0] >= (Int32)nUD_SettingsStdDev.Value)
|
||||
// //Maingraph1.AssignData(DecodingResult, Path, ref GraphCounterDataMainTotal, ref GraphIndexOfLists);
|
||||
// goto SkipOptions; // also works without 'goto' if you're wanna be MISRA compliant
|
||||
//}
|
||||
//#endregion
|
||||
/*
|
||||
#region Mean values/ std deviation
|
||||
if ((lB_Graph_SelectGraph.Text.Contains("Mean")) && (lB_Graph_SelectGraph.Text.Contains("deviation")))
|
||||
{
|
||||
if (((Int32)TelegramCounterStdDeviationMultihit[Constants.PATH0] >= (Int32)nUD_SettingsStdDev.Value)
|
||||
&& ((Int32)TelegramCounterTofMean[Constants.PATH0] >= (Int32)nUD_SettingsMean.Value)||
|
||||
((Int32)TelegramCounterFlowMean[Constants.PATH0] >= (Int32)nUD_SettingsMean.Value))
|
||||
|
||||
Maingraph1.AssignData(DecodingResult, Path, ref GraphCounterDataMainTotal, ref GraphIndexOfLists);
|
||||
}
|
||||
#endregion*/
|
||||
// Jump to here to skip unneeded options
|
||||
SkipOptions:;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Refresh values for background workers
|
||||
Decoded[Constants.PATH0] = (DecodedData)DecodingResult[Constants.PATH0].Clone();
|
||||
Decoded[Constants.PATH1] = (DecodedData)DecodingResult[Constants.PATH1].Clone();
|
||||
Decoded[Constants.PATH2] = (DecodedData)DecodingResult[Constants.PATH2].Clone();
|
||||
#endregion
|
||||
return;
|
||||
|
||||
#region Start mean dif tofs
|
||||
if ((ProtocolVersion == "d") || (ProtocolVersion == "i"))
|
||||
{
|
||||
switch (Path)
|
||||
{
|
||||
case Constants.PATH0:
|
||||
ElapsedCounterTofMean = StartBackgroundWorkerTofMeanPath0(MessageType, ElapsedCounterTofMean, cB_MeanValuesEnable.Checked);
|
||||
if (TelegramCounterDifTofMean[Constants.PATH0] >= (UInt16)nUD_SettingsMean.Value)
|
||||
ElapsedCounterStdDeviation = StartBackgroundWorkerStdDeviationPath0(MessageType, ElapsedCounterStdDeviation, cB_StdDevEnable.Checked);
|
||||
ElapsedCounterDifTofMean = StartDifTofMeanBackgroundWorkerPath0(MessageType, ElapsedCounterDifTofMean, cB_MeanValuesEnable.Checked);
|
||||
ElapsedCounterMultiHitMean = StartMultihitBackgroundWorkerPath0(MessageType, ElapsedCounterMultiHitMean, cB_MeanValuesEnable.Checked);
|
||||
ElapsedCounterOthersMean = StartBackgroundWorkerOthersMeanPath0(MessageType, ElapsedCounterOthersMean, cB_MeanValuesEnable.Checked);
|
||||
break;
|
||||
case Constants.PATH1:
|
||||
ElapsedCounterTofMean = StartBackgroundWorkerTofMeanPath1(MessageType, ElapsedCounterTofMean, cB_MeanValuesEnable.Checked);
|
||||
if (TelegramCounterDifTofMean[Constants.PATH1] >= (UInt16)nUD_SettingsMean.Value)
|
||||
ElapsedCounterStdDeviation = StartBackgroundWorkerStdDeviationPath1(MessageType, ElapsedCounterStdDeviation, cB_StdDevEnable.Checked);
|
||||
ElapsedCounterDifTofMean = StartDifTofMeanBackgroundWorkerPath1(MessageType, ElapsedCounterDifTofMean, cB_MeanValuesEnable.Checked);
|
||||
ElapsedCounterMultiHitMean = StartMultihitBackgroundWorkerPath1(MessageType, ElapsedCounterMultiHitMean, cB_MeanValuesEnable.Checked);
|
||||
ElapsedCounterOthersMean = StartBackgroundWorkerOthersMeanPath1(MessageType, ElapsedCounterOthersMean, cB_MeanValuesEnable.Checked);
|
||||
break;
|
||||
case Constants.PATH2:
|
||||
ElapsedCounterTofMean = StartBackgroundWorkerTofMeanPath2(MessageType, ElapsedCounterTofMean, cB_MeanValuesEnable.Checked);
|
||||
if (TelegramCounterDifTofMean[Constants.PATH2] >= (UInt16)nUD_SettingsMean.Value)
|
||||
ElapsedCounterStdDeviation = StartBackgroundWorkerStdDeviationPath2(MessageType, ElapsedCounterStdDeviation, cB_StdDevEnable.Checked);
|
||||
ElapsedCounterDifTofMean = StartDifTofMeanBackgroundWorkerPath2(MessageType, ElapsedCounterDifTofMean, cB_MeanValuesEnable.Checked);
|
||||
ElapsedCounterMultiHitMean = StartMultihitBackgroundWorkerPath2(MessageType, ElapsedCounterMultiHitMean, cB_MeanValuesEnable.Checked);
|
||||
ElapsedCounterOthersMean = StartBackgroundWorkerOthersMeanPath2(MessageType, ElapsedCounterOthersMean, cB_MeanValuesEnable.Checked);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Start mean flow
|
||||
if (ProtocolVersion == "e")
|
||||
{
|
||||
switch (Path)
|
||||
{
|
||||
case Constants.PATH0: ElapsedCounterFlowMean = StartBackgroundWorkerFlowMeanPath0(MessageType, ElapsedCounterFlowMean, cB_MeanValuesEnable.Checked);
|
||||
break;
|
||||
case Constants.PATH1: ElapsedCounterFlowMean = StartBackgroundWorkerFlowMeanPath1(MessageType, ElapsedCounterFlowMean, cB_MeanValuesEnable.Checked);
|
||||
break;
|
||||
case Constants.PATH2: ElapsedCounterFlowMean = StartBackgroundWorkerFlowMeanPath2(MessageType, ElapsedCounterFlowMean, cB_MeanValuesEnable.Checked);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Start mean temperature
|
||||
if (((ProtocolVersion == "d") || (ProtocolVersion == "i")) && (Path == Constants.PATH0))
|
||||
{
|
||||
ElapsedCounterTemperatureMean = StartBackgroundWorkerTemperatureMeanPath0(MessageType, ElapsedCounterTemperatureMean, cB_MeanValuesEnable.Checked);
|
||||
ElapsedCounterTemperatureMean = StartBackgroundWorkerTemperatureMeanPath1(MessageType, ElapsedCounterTemperatureMean, cB_MeanValuesEnable.Checked);
|
||||
ElapsedCounterTemperatureMean = StartBackgroundWorkerTemperatureMeanPath2(MessageType, ElapsedCounterTemperatureMean, cB_MeanValuesEnable.Checked);
|
||||
}
|
||||
|
||||
if ((ProtocolVersion == "a") || (ProtocolVersion=="b"))
|
||||
{
|
||||
switch(Path)
|
||||
{
|
||||
case Constants.PATH0: StartBackgroundWorkerTemperatureMeanPath0(MessageType, ElapsedCounterTemperatureMean, cB_MeanValuesEnable.Checked);
|
||||
break;
|
||||
case Constants.PATH1: StartBackgroundWorkerTemperatureMeanPath1(MessageType, ElapsedCounterTemperatureMean, cB_MeanValuesEnable.Checked);
|
||||
break;
|
||||
case Constants.PATH2: StartBackgroundWorkerTemperatureMeanPath2(MessageType, ElapsedCounterTemperatureMean, cB_MeanValuesEnable.Checked);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
#region Monitor background workers
|
||||
DebugElapsedValues(ElapsedCounterTofMean, ElapsedCounterDifTofMean, ElapsedCounterMultiHitMean, ElapsedCounterOthersMean, ElapsedCounterTemperatureMean, ElapsedCounterFlowMean, ElapsedCounterStdDeviation, InvokeMainloopExceptionsCounter, SumOfAllElapsedValues, Culture);
|
||||
#endregion
|
||||
|
||||
Misc.GarbageCollector(ref GcCounter);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
private void MainLoopMassLoggingMeter1(object sender, EventArgs e)
|
||||
{
|
||||
CultureInfo culture = GetGlobalCulture();
|
||||
const UInt16 MeterNumber = Constants.Meter1;
|
||||
|
||||
#region Definitions and initializations
|
||||
DecodedData[] DecodingResult = DecodedDataHelper.getDefaultDecodedDataArray(Constants.NumberOfPaths);
|
||||
DecodingResult[Constants.PATH0] = ((DecodedData)Decoded[Constants.PATH0].Clone());
|
||||
DecodingResult[Constants.PATH1] = ((DecodedData)Decoded[Constants.PATH1].Clone());
|
||||
DecodingResult[Constants.PATH2] = ((DecodedData)Decoded[Constants.PATH2].Clone());
|
||||
String MessageType = String.Empty;
|
||||
String ProtocolVersion = String.Empty;
|
||||
String Temp = String.Empty;
|
||||
l_DispRxStringLength.Text = RxDataBuffer[MeterNumber].Length.ToString(culture); // Debug length of rxstring
|
||||
#endregion
|
||||
#region Prepare data
|
||||
for (UInt16 i = 0; i < RxDataBuffer[MeterNumber].Count(); i++)
|
||||
{
|
||||
if (RxDataBuffer[MeterNumber].ElementAt(0).ToString(culture).Equals("@"))
|
||||
{
|
||||
if (!String.IsNullOrEmpty(Output[MeterNumber]))
|
||||
{
|
||||
Temp = $"@{Output[MeterNumber]}";
|
||||
ValidData[MeterNumber] = true;
|
||||
}
|
||||
Output[MeterNumber] = String.Empty;
|
||||
}
|
||||
else
|
||||
Output[MeterNumber] = $"{Output[MeterNumber]}{RxDataBuffer[MeterNumber].ElementAt(0)}";
|
||||
|
||||
RxDataBuffer[MeterNumber] = RxDataBuffer[MeterNumber].Remove(0, 1);
|
||||
}
|
||||
#endregion
|
||||
#region Decode
|
||||
if (ValidData[MeterNumber])
|
||||
{
|
||||
Temp = Temp.Replace("\n", String.Empty);
|
||||
ValidData[MeterNumber] = false;
|
||||
#region Decode data
|
||||
DecodingResult = DecodeTelegram.DecodedDataDecodeTelegram(Output[MeterNumber], cB_StdDevEnable.Checked, cB_MeanValuesEnable.Checked, DecodingResult, Constants.NominalFrequency);
|
||||
#endregion
|
||||
#region Get timestamp
|
||||
DateTime CurrentTime = new DateTime();
|
||||
CurrentTime = DateTime.Now;
|
||||
String RawTimestamp = CurrentTime.ToString(Formats.RawDataDateTimeLogString, culture);
|
||||
String CsvTimestamp = CurrentTime.ToString(Formats.CsvDateTimeLogString, culture);
|
||||
#endregion
|
||||
#region Additional decoding parameters
|
||||
UInt16 Path = DecodingResult[Constants.PATH0].Path; // the same value for all paths
|
||||
MessageType = DecodingResult[Path].MessageType;
|
||||
ProtocolVersion = DecodingResult[Path].ProtocolVersion;
|
||||
#endregion
|
||||
#region CSV-Logging
|
||||
//if ((LoggingCsvEn == true) && (MessageType == Message.Data))
|
||||
//{
|
||||
// CsvLogging.Log(Path, ref CsvIndexValue, cB_Form1CsvLoggingPath0.Checked,
|
||||
// cB_Form1CsvLoggingPath1.Checked, cB_Form1CsvLoggingPath2.Checked, DecodingResult, @SaveDataPathCsv, CsvTimestamp, ref CsvDataToLog, Constants.CsvCyclesToStorage);
|
||||
//}
|
||||
#endregion
|
||||
#region Refresh values for background workers
|
||||
Decoded[Constants.PATH0] = (DecodedData)DecodingResult[Constants.PATH0].Clone();
|
||||
Decoded[Constants.PATH1] = (DecodedData)DecodingResult[Constants.PATH1].Clone();
|
||||
Decoded[Constants.PATH2] = (DecodedData)DecodingResult[Constants.PATH2].Clone();
|
||||
#endregion
|
||||
#region Monitor background workers
|
||||
DebugElapsedValues(ElapsedCounterTofMean, ElapsedCounterDifTofMean, ElapsedCounterMultiHitMean, ElapsedCounterOthersMean, ElapsedCounterTemperatureMean, ElapsedCounterFlowMean, ElapsedCounterStdDeviation, InvokeMainloopExceptionsCounter, SumOfAllElapsedValues, this.globalCulture);
|
||||
#endregion
|
||||
|
||||
Misc.GarbageCollector(ref GcCounter);
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
private void MainLoopMassLoggingMeter2(object sender, EventArgs e)
|
||||
{
|
||||
CultureInfo culture = GetGlobalCulture();
|
||||
const UInt16 MeterNumber = Constants.Meter2;
|
||||
|
||||
#region Definitions and initializations
|
||||
DecodedData[] DecodingResult = DecodedDataHelper.getDefaultDecodedDataArray(Constants.NumberOfPaths);
|
||||
DecodingResult[Constants.PATH0] = ((DecodedData)Decoded[Constants.PATH0].Clone());
|
||||
DecodingResult[Constants.PATH1] = ((DecodedData)Decoded[Constants.PATH1].Clone());
|
||||
DecodingResult[Constants.PATH2] = ((DecodedData)Decoded[Constants.PATH2].Clone());
|
||||
|
||||
String MessageType = String.Empty;
|
||||
String ProtocolVersion = String.Empty;
|
||||
String Temp = String.Empty;
|
||||
l_DispRxStringLength.Text = RxDataBuffer[MeterNumber].Length.ToString(culture); // Debug length of rxstring
|
||||
#endregion
|
||||
#region Prepare data
|
||||
for (UInt16 i = 0; i < RxDataBuffer[MeterNumber].Count(); i++)
|
||||
{
|
||||
if (RxDataBuffer[MeterNumber].ElementAt(0).ToString(culture).Equals("@"))
|
||||
{
|
||||
if (!String.IsNullOrEmpty(Output[MeterNumber]))
|
||||
{
|
||||
Temp = $"@{Output[MeterNumber]}";
|
||||
ValidData[MeterNumber] = true;
|
||||
}
|
||||
Output[MeterNumber] = String.Empty;
|
||||
}
|
||||
else
|
||||
Output[MeterNumber] = $"{Output[MeterNumber]}{RxDataBuffer[MeterNumber].ElementAt(0)}";
|
||||
|
||||
RxDataBuffer[MeterNumber] = RxDataBuffer[MeterNumber].Remove(0, 1);
|
||||
}
|
||||
#endregion
|
||||
#region Decode
|
||||
if (ValidData[MeterNumber])
|
||||
{
|
||||
#region Decode data
|
||||
Temp = Temp.Replace("\n", String.Empty);
|
||||
ValidData[MeterNumber] = false;
|
||||
DecodingResult = DecodeTelegram.DecodedDataDecodeTelegram(Output[MeterNumber], cB_StdDevEnable.Checked, cB_MeanValuesEnable.Checked, DecodingResult, Constants.NominalFrequency);
|
||||
#endregion
|
||||
#region Get timestamp
|
||||
DateTime CurrentTime = new DateTime();
|
||||
CurrentTime = DateTime.Now;
|
||||
String RawTimestamp = CurrentTime.ToString(Formats.RawDataDateTimeLogString, culture);
|
||||
String CsvTimestamp = CurrentTime.ToString(Formats.CsvDateTimeLogString, culture);
|
||||
#endregion
|
||||
#region Additional decoding parameters
|
||||
UInt16 Path = DecodingResult[Constants.PATH0].Path; // the same value for all paths
|
||||
MessageType = DecodingResult[Path].MessageType;
|
||||
ProtocolVersion = DecodingResult[Path].ProtocolVersion;
|
||||
#endregion
|
||||
#region Raw data
|
||||
//RawData.DisplayAndSaveText(SaveDataPathRaw, RawTimestamp, RawLoggingSingleMeterEnable, Output[MeterNumber], Constants.RawCyclesToStorage); // print complet
|
||||
#endregion
|
||||
#region CSV-Logging
|
||||
//if ((LoggingCsvEn == true) && (MessageType == Message.Data))
|
||||
//{
|
||||
// CsvLogging.Log(Path, ref CsvIndexValue, cB_Form1CsvLoggingPath0.Checked,
|
||||
// cB_Form1CsvLoggingPath1.Checked, cB_Form1CsvLoggingPath2.Checked, DecodingResult, @SaveDataPathCsv, CsvTimestamp, ref CsvDataToLog, Constants.CsvCyclesToStorage);
|
||||
//}
|
||||
#endregion
|
||||
#region Refresh values for background workers
|
||||
Decoded[Constants.PATH0] = (DecodedData)DecodingResult[Constants.PATH0].Clone();
|
||||
Decoded[Constants.PATH1] = (DecodedData)DecodingResult[Constants.PATH1].Clone();
|
||||
Decoded[Constants.PATH2] = (DecodedData)DecodingResult[Constants.PATH2].Clone();
|
||||
#endregion
|
||||
#region Monitor background workers
|
||||
DebugElapsedValues(ElapsedCounterTofMean, ElapsedCounterDifTofMean, ElapsedCounterMultiHitMean, ElapsedCounterOthersMean, ElapsedCounterTemperatureMean, ElapsedCounterFlowMean, ElapsedCounterStdDeviation, InvokeMainloopExceptionsCounter, SumOfAllElapsedValues, culture);
|
||||
#endregion
|
||||
|
||||
Misc.GarbageCollector(ref GcCounter);
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
private void MainLoopMassLoggingMeter3(object sender, EventArgs e)
|
||||
{
|
||||
CultureInfo culture = GetGlobalCulture();
|
||||
const UInt16 MeterNumber = Constants.Meter3;
|
||||
|
||||
#region Definitions and initializations
|
||||
DecodedData[] DecodingResult = DecodedDataHelper.getDefaultDecodedDataArray(Constants.NumberOfPaths);
|
||||
DecodingResult[Constants.PATH0] = ((DecodedData)Decoded[Constants.PATH0].Clone());
|
||||
DecodingResult[Constants.PATH1] = ((DecodedData)Decoded[Constants.PATH1].Clone());
|
||||
DecodingResult[Constants.PATH2] = ((DecodedData)Decoded[Constants.PATH2].Clone());
|
||||
String MessageType = String.Empty;
|
||||
String ProtocolVersion = String.Empty;
|
||||
String Temp = String.Empty;
|
||||
l_DispRxStringLength.Text = RxDataBuffer[MeterNumber].Length.ToString(culture); // Debug length of rxstring
|
||||
#endregion
|
||||
#region Prepare data
|
||||
for (UInt16 i = 0; i < RxDataBuffer[MeterNumber].Count(); i++)
|
||||
{
|
||||
if (RxDataBuffer[MeterNumber].ElementAt(0).ToString(culture).Equals("@"))
|
||||
{
|
||||
if (!String.IsNullOrEmpty(Output[MeterNumber]))
|
||||
{
|
||||
Temp = $"@{Output[MeterNumber]}";
|
||||
ValidData[MeterNumber] = true;
|
||||
}
|
||||
Output[MeterNumber] = String.Empty;
|
||||
}
|
||||
else
|
||||
Output[MeterNumber] = $"{Output[MeterNumber]}{RxDataBuffer[MeterNumber].ElementAt(0)}";
|
||||
|
||||
RxDataBuffer[MeterNumber] = RxDataBuffer[MeterNumber].Remove(0, 1);
|
||||
}
|
||||
#endregion
|
||||
#region Decode
|
||||
if (ValidData[MeterNumber])
|
||||
{
|
||||
#region Decode data
|
||||
Temp = Temp.Replace("\n", String.Empty);
|
||||
ValidData[MeterNumber] = false;
|
||||
DecodingResult = DecodeTelegram.DecodedDataDecodeTelegram(Output[MeterNumber], cB_StdDevEnable.Checked, cB_MeanValuesEnable.Checked, DecodingResult, Constants.NominalFrequency);
|
||||
#endregion
|
||||
#region Get timestamp
|
||||
DateTime CurrentTime = new DateTime();
|
||||
CurrentTime = DateTime.Now;
|
||||
String RawTimestamp = CurrentTime.ToString(Formats.RawDataDateTimeLogString, culture);
|
||||
String CsvTimestamp = CurrentTime.ToString(Formats.CsvDateTimeLogString, culture);
|
||||
#endregion
|
||||
#region Additional decoding parameters
|
||||
UInt16 Path = DecodingResult[Constants.PATH0].Path; // the same value for all paths
|
||||
MessageType = DecodingResult[Path].MessageType;
|
||||
ProtocolVersion = DecodingResult[Path].ProtocolVersion;
|
||||
#endregion
|
||||
#region Raw data
|
||||
//RawData.DisplayAndSaveText(SaveDataPathRaw, RawTimestamp, RawLoggingSingleMeterEnable, Output[MeterNumber], Constants.RawCyclesToStorage); // print complet
|
||||
#endregion
|
||||
#region CSV-Logging
|
||||
//if ((LoggingCsvEn == true) && (MessageType == Message.Data))
|
||||
//{
|
||||
// CsvLogging.Log(Path, ref CsvIndexValue, cB_Form1CsvLoggingPath0.Checked,
|
||||
// cB_Form1CsvLoggingPath1.Checked, cB_Form1CsvLoggingPath2.Checked, DecodingResult, @SaveDataPathCsv, CsvTimestamp, ref CsvDataToLog, Constants.CsvCyclesToStorage);
|
||||
//}
|
||||
#endregion
|
||||
#region Refresh values for background workers
|
||||
Decoded[Constants.PATH0] = (DecodedData)DecodingResult[Constants.PATH0].Clone();
|
||||
Decoded[Constants.PATH1] = (DecodedData)DecodingResult[Constants.PATH1].Clone();
|
||||
Decoded[Constants.PATH2] = (DecodedData)DecodingResult[Constants.PATH2].Clone();
|
||||
#endregion
|
||||
#region Monitor background workers
|
||||
DebugElapsedValues(ElapsedCounterTofMean, ElapsedCounterDifTofMean, ElapsedCounterMultiHitMean, ElapsedCounterOthersMean, ElapsedCounterTemperatureMean, ElapsedCounterFlowMean, ElapsedCounterStdDeviation, InvokeMainloopExceptionsCounter, SumOfAllElapsedValues, culture);
|
||||
#endregion
|
||||
|
||||
Misc.GarbageCollector(ref GcCounter);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Printing;
|
||||
using ZedGraph;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
|
||||
|
||||
namespace GenesisDisplayTool
|
||||
{
|
||||
public static partial class ErrorLog
|
||||
{
|
||||
|
||||
public static void Log(String reason, String description, String Parameter1, String Parameter2)
|
||||
{
|
||||
#region Definitions and initializations
|
||||
// StringBuilder messageBoxCS = new StringBuilder();
|
||||
String userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
|
||||
String WriteToErrFile = $"{DateTime.Now.ToString(Formats.ErrorLogString)}{userName};{reason};{description};{Parameter1};{Parameter2}";
|
||||
#endregion
|
||||
#region Write settings to file
|
||||
try
|
||||
{
|
||||
using (System.IO.StreamWriter sw0 = System.IO.File.AppendText(@"..\ErrorLog.txt"))
|
||||
sw0.WriteLine(WriteToErrFile);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// MessageBox.Show("Error parameters could not be written to file", "Form closing", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static void Write(string reason)
|
||||
{
|
||||
#region Definitions and initializations
|
||||
// System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
|
||||
String userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
|
||||
String WriteToErrFile = $"{DateTime.Now.ToString("mm:ss:fff")}{reason}";
|
||||
#endregion
|
||||
#region Write settings to file
|
||||
try
|
||||
{
|
||||
using (System.IO.StreamWriter sw0 = System.IO.File.AppendText(@"..\Write.txt"))
|
||||
sw0.WriteLine(WriteToErrFile);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// MessageBox.Show("Error parameters could not be written to file", "Form closing", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,392 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Printing;
|
||||
using ZedGraph;
|
||||
using System.IO;
|
||||
|
||||
namespace GenesisDisplayTool
|
||||
{
|
||||
public static class Files
|
||||
{
|
||||
#region Open files/ save to file
|
||||
public static Boolean OpenText(out String textToGet, String fullpath, CultureInfo culture)
|
||||
{
|
||||
Boolean OpeningOk = false;
|
||||
textToGet = String.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
textToGet = File.ReadAllText(fullpath);
|
||||
OpeningOk = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), " Files.OpenText() failed", $"0x{ex.HResult.ToString("X", culture)}", String.Empty);
|
||||
}
|
||||
|
||||
return OpeningOk;
|
||||
}
|
||||
public static Boolean SaveText(String textToWrite, String fullpath, CultureInfo culture)
|
||||
{
|
||||
Boolean SavingOK = false;
|
||||
|
||||
try
|
||||
{
|
||||
File.WriteAllText(fullpath, textToWrite);
|
||||
SavingOK = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), " Files.SaveText() failed", $"0x{ex.HResult.ToString("X", culture)}", String.Empty);
|
||||
|
||||
}
|
||||
|
||||
return SavingOK;
|
||||
}
|
||||
public static Boolean SaveImage(ZedGraphControl graph, String fullpath, CultureInfo culture)
|
||||
{
|
||||
Boolean SavingOK = false;
|
||||
|
||||
try
|
||||
{
|
||||
graph.MasterPane.GetImage(1080, 640, 600, true).Save(fullpath);
|
||||
SavingOK = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), " Files.SaveToImage() failed", $"0x{ex.HResult.ToString("X", culture)}", String.Empty);
|
||||
}
|
||||
|
||||
return SavingOK;
|
||||
}
|
||||
public static Boolean SavePdf(PdfSharp.Pdf.PdfDocument document, String fullpath)
|
||||
{
|
||||
Boolean SavingOK = false;
|
||||
|
||||
try
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
document.Save(@fullpath);
|
||||
System.Diagnostics.Process.Start(@fullpath);
|
||||
});
|
||||
SavingOK = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), " Files.SavePdf() failed", "0x" + ex.HResult.ToString("X", GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetGlobalCulture()), String.Empty);
|
||||
}
|
||||
|
||||
return SavingOK;
|
||||
}
|
||||
#endregion
|
||||
#region File dialogs
|
||||
public static Boolean SaveFiledialogPdf(String itemname, ref String fullpath, String initialDirectory)
|
||||
{
|
||||
#region Definitions and initializations
|
||||
String FullFilename = String.Empty;
|
||||
Boolean DialogOK = false;
|
||||
#endregion
|
||||
#region Everything else
|
||||
try
|
||||
{
|
||||
#region Set Filename
|
||||
FullFilename = $"{DateTime.Now.ToString(Formats.PdfDateTimeString)}GENESIS_{itemname}.pdf";
|
||||
#endregion
|
||||
#region SaveFileDialog
|
||||
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
|
||||
saveFileDialog1.Filter = "document (*.pdf)|*.pdf";
|
||||
saveFileDialog1.FilterIndex = 2;
|
||||
saveFileDialog1.RestoreDirectory = true;
|
||||
saveFileDialog1.FileName = FullFilename;
|
||||
if (Directory.Exists(initialDirectory))
|
||||
saveFileDialog1.InitialDirectory = initialDirectory;
|
||||
#endregion
|
||||
#region Save to file
|
||||
if (OpenFileDialog.Equals(saveFileDialog1.ShowDialog(), DialogResult.OK))
|
||||
{
|
||||
DialogOK = true;
|
||||
fullpath = Path.GetFullPath(saveFileDialog1.FileName);
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), " Files.SaveFiledialogPdf() failed", $"0x{ex.HResult.ToString("X", GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetGlobalCulture())}", String.Empty);
|
||||
}
|
||||
#endregion
|
||||
|
||||
return DialogOK;
|
||||
}
|
||||
public static Boolean SaveFiledialogPng(String itemname, out String fullpath, String initialDirectory)
|
||||
{
|
||||
#region Definitions and initializations
|
||||
String FullFilename = String.Empty;
|
||||
Boolean DialogOK = false;
|
||||
fullpath = String.Empty;
|
||||
#endregion
|
||||
#region Everything else
|
||||
try
|
||||
{
|
||||
#region Set Filename
|
||||
FullFilename = $"{ DateTime.Now.ToString(Formats.ImageFileDateTimeString)}GENESIS_{itemname}.png";
|
||||
#endregion
|
||||
#region SaveFileDialog
|
||||
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
|
||||
saveFileDialog1.Filter = "image (*.png)|*.png";
|
||||
saveFileDialog1.FilterIndex = 2;
|
||||
saveFileDialog1.RestoreDirectory = true;
|
||||
saveFileDialog1.FileName = FullFilename;
|
||||
if (Directory.Exists(initialDirectory))
|
||||
saveFileDialog1.InitialDirectory = initialDirectory;
|
||||
#endregion
|
||||
#region Save to file
|
||||
if (OpenFileDialog.Equals(saveFileDialog1.ShowDialog(), DialogResult.OK))
|
||||
{
|
||||
DialogOK = true;
|
||||
fullpath = Path.GetFullPath(saveFileDialog1.FileName);
|
||||
}
|
||||
saveFileDialog1.Dispose();
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), " Files.SaveFiledialogPng() failed", $"0x{ex.HResult.ToString("X", GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetGlobalCulture())}", String.Empty);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
return DialogOK;
|
||||
}
|
||||
public static Boolean SaveFiledialogCsv(String itemname, out String fullpath, String initialDirectory)
|
||||
{
|
||||
#region Definitions and initializations
|
||||
String FullFilename = String.Empty;
|
||||
Boolean DialogOK = false;
|
||||
fullpath = String.Empty;
|
||||
#endregion
|
||||
#region Everything else
|
||||
try
|
||||
{
|
||||
#region Set Filename
|
||||
FullFilename = DateTime.Now.ToString(Formats.CsvFileDateTimeString) +"GENESIS_"+ itemname + ".csv";
|
||||
#endregion
|
||||
#region SaveFileDialog
|
||||
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
|
||||
saveFileDialog1.Filter = "comma separated values (*.csv)|*.csv";
|
||||
saveFileDialog1.FilterIndex = 2;
|
||||
saveFileDialog1.RestoreDirectory = true;
|
||||
saveFileDialog1.FileName = FullFilename;
|
||||
if (Directory.Exists(initialDirectory))
|
||||
saveFileDialog1.InitialDirectory = initialDirectory;
|
||||
#endregion
|
||||
#region Save to file
|
||||
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
DialogOK = true;
|
||||
fullpath = Path.GetFullPath(saveFileDialog1.FileName);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), " Files.SaveFiledialogCsv() failed", "0x" + ex.HResult.ToString("X", GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetGlobalCulture()), String.Empty);
|
||||
}
|
||||
#endregion
|
||||
|
||||
return DialogOK;
|
||||
}
|
||||
public static Boolean SaveFiledialogConversion(String itemname, ref String fullpath, String initialDirectory)
|
||||
{
|
||||
#region Definitions and initializations
|
||||
String FullFilename = String.Empty;
|
||||
Boolean DialogOK = false;
|
||||
#endregion
|
||||
#region Everything else
|
||||
try
|
||||
{
|
||||
#region Set Filename
|
||||
FullFilename = itemname + ".csv";
|
||||
#endregion
|
||||
#region SaveFileDialog
|
||||
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
|
||||
saveFileDialog1.Filter = "comma separated values (*.csv)|*.csv";
|
||||
saveFileDialog1.FilterIndex = 2;
|
||||
saveFileDialog1.RestoreDirectory = true;
|
||||
saveFileDialog1.FileName = FullFilename;
|
||||
if (Directory.Exists(initialDirectory))
|
||||
saveFileDialog1.InitialDirectory = initialDirectory;
|
||||
#endregion
|
||||
#region Save to file
|
||||
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
DialogOK = true;
|
||||
fullpath = Path.GetFullPath(saveFileDialog1.FileName);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), " Files.SaveFiledialogConversion() failed", "0x" + ex.HResult.ToString("X", GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetGlobalCulture()), String.Empty);
|
||||
}
|
||||
#endregion
|
||||
|
||||
return DialogOK;
|
||||
}
|
||||
public static Boolean SaveFiledialogTxt(String itemname, out String fullpath, String initialDirectory)
|
||||
{
|
||||
#region Definitions and initializations
|
||||
String FullFilename = String.Empty;
|
||||
fullpath = String.Empty;
|
||||
Boolean DialogOK = false;
|
||||
#endregion
|
||||
#region Everything else
|
||||
try
|
||||
{
|
||||
#region Set Filename
|
||||
FullFilename = $"{DateTime.Now.ToString(Formats.TxtFileDateTimeString)}GENESIS_{itemname}.txt";
|
||||
#endregion
|
||||
#region SaveFileDialog
|
||||
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
|
||||
saveFileDialog1.Filter = "text files (*.txt)|*.txt";
|
||||
saveFileDialog1.FilterIndex = 2;
|
||||
saveFileDialog1.RestoreDirectory = true;
|
||||
saveFileDialog1.FileName = FullFilename;
|
||||
if (Directory.Exists(initialDirectory))
|
||||
saveFileDialog1.InitialDirectory = initialDirectory;
|
||||
#endregion
|
||||
#region Save to file
|
||||
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
DialogOK = true;
|
||||
fullpath = Path.GetFullPath(saveFileDialog1.FileName);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), " Files.SaveFiledialogTxt() failed", $"0x{ex.HResult.ToString("X")}", String.Empty);
|
||||
}
|
||||
#endregion
|
||||
|
||||
return DialogOK;
|
||||
}
|
||||
public static Boolean OpenFileDialogText(out String fullpath, String initialDirectory)
|
||||
{
|
||||
#region Definitions and initializations
|
||||
String Filename = String.Empty;
|
||||
String FileContent = String.Empty;
|
||||
Boolean DialogOK = false;
|
||||
fullpath = String.Empty;
|
||||
#endregion
|
||||
#region File dialog
|
||||
OpenFileDialog openFileDialog1 = new OpenFileDialog();
|
||||
|
||||
openFileDialog1.Filter = "text files (*.txt)|*.txt";
|
||||
openFileDialog1.FilterIndex = 2;
|
||||
openFileDialog1.RestoreDirectory = true;
|
||||
openFileDialog1.FileName = Filename;
|
||||
if (Directory.Exists(initialDirectory))
|
||||
openFileDialog1.InitialDirectory = initialDirectory;
|
||||
#endregion
|
||||
#region Open file
|
||||
try
|
||||
{
|
||||
// -- open file --
|
||||
if (OpenFileDialog.Equals(openFileDialog1.ShowDialog(), DialogResult.OK))
|
||||
{
|
||||
#region Get PATH
|
||||
fullpath = Path.GetFullPath(openFileDialog1.FileName);
|
||||
DialogOK = true;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), "Files.OpenFileDialogText() failed", $"0x{ex.HResult.ToString("X", GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetGlobalCulture())}", String.Empty);
|
||||
}
|
||||
#endregion
|
||||
#region Return
|
||||
return DialogOK;
|
||||
#endregion
|
||||
}
|
||||
public static Boolean OpenFileDialogJson(ref String fullpath, String initialDirectory)
|
||||
{
|
||||
#region Definitions and initializations
|
||||
String Filename = String.Empty;
|
||||
String FileContent = String.Empty;
|
||||
Boolean DialogOK = false;
|
||||
#endregion
|
||||
#region File dialog
|
||||
OpenFileDialog openFileDialog1 = new OpenFileDialog();
|
||||
openFileDialog1.Filter = "json files (*.json)|*.json";
|
||||
openFileDialog1.FilterIndex = 2;
|
||||
openFileDialog1.RestoreDirectory = true;
|
||||
openFileDialog1.FileName = Filename;
|
||||
if (Directory.Exists(initialDirectory))
|
||||
openFileDialog1.InitialDirectory = initialDirectory;
|
||||
#endregion
|
||||
#region Open file
|
||||
// -- open file --
|
||||
if (OpenFileDialog.Equals(openFileDialog1.ShowDialog(), DialogResult.OK))
|
||||
{
|
||||
#region Get PATH
|
||||
fullpath = Path.GetFullPath(openFileDialog1.FileName);
|
||||
DialogOK = true;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region Return
|
||||
return DialogOK;
|
||||
#endregion
|
||||
}
|
||||
public static Boolean OpenFileDialogCsv(ref String fullpath, String initialDirectory)
|
||||
{
|
||||
#region Definitions and initializations
|
||||
String Filename = String.Empty;
|
||||
String FileContent = String.Empty;
|
||||
Boolean DialogOK = false;
|
||||
#endregion
|
||||
#region File dialog
|
||||
OpenFileDialog openFileDialog1 = new OpenFileDialog();
|
||||
openFileDialog1.Filter = "Comma seperated values (*.csv)|*.csv";
|
||||
openFileDialog1.FilterIndex = 2;
|
||||
openFileDialog1.RestoreDirectory = true;
|
||||
openFileDialog1.FileName = Filename;
|
||||
if (Directory.Exists(initialDirectory))
|
||||
openFileDialog1.InitialDirectory = initialDirectory;
|
||||
#endregion
|
||||
#region Open file
|
||||
try
|
||||
{
|
||||
// -- open file --
|
||||
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
#region Get PATH
|
||||
fullpath = Path.GetFullPath(openFileDialog1.FileName);
|
||||
DialogOK = true;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), "Files.OpenFileDialogCsv() failed", "0x" + ex.HResult.ToString("X"), String.Empty);
|
||||
}
|
||||
#endregion
|
||||
#region Return
|
||||
return DialogOK;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Generated
+21362
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,722 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
using System.Diagnostics;
|
||||
using PdfSharp.Pdf;
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.DocumentObjectModel.Tables;
|
||||
using MigraDoc.Rendering;
|
||||
|
||||
namespace GenesisDisplayTool
|
||||
{
|
||||
|
||||
|
||||
public partial class GENESIS_DISPLAY_TOOL : Form
|
||||
{
|
||||
static void DefineContentSection(Document document)
|
||||
{
|
||||
Section section = document.AddSection();
|
||||
section.PageSetup.OddAndEvenPagesHeaderFooter = true;
|
||||
section.PageSetup.StartingNumber = 1;
|
||||
HeaderFooter header = section.Headers.Primary;
|
||||
header.AddParagraph("\tOdd Page Header");
|
||||
header = section.Headers.EvenPage;
|
||||
header.AddParagraph("Even Page Header");
|
||||
// Create a paragraph with centered page number. See definition of style "Footer".
|
||||
Paragraph paragraph = new Paragraph();
|
||||
paragraph.AddTab();
|
||||
paragraph.AddPageField();
|
||||
// Add paragraph to footer for odd pages.
|
||||
section.Footers.Primary.Add(paragraph);
|
||||
// Add clone of paragraph to footer for odd pages. Cloning is necessary because an object must
|
||||
// not belong to more than one other object. If you forget cloning an exception is thrown.
|
||||
section.Footers.EvenPage.Add(paragraph.Clone());
|
||||
}
|
||||
private void MigraDocTitlepage(Document document)
|
||||
{
|
||||
Section section = document.AddSection();
|
||||
|
||||
Paragraph paragraph = section.AddParagraph();
|
||||
paragraph.Format.SpaceAfter = "3cm";
|
||||
|
||||
|
||||
paragraph = section.AddParagraph(rTB_ReportEnterTitle.Text);
|
||||
paragraph.Format.Font.Size = 18;
|
||||
paragraph.Format.Font.Bold = true;
|
||||
paragraph.Format.Alignment = ParagraphAlignment.Center;
|
||||
paragraph.Format.Font.Color = Colors.Black;
|
||||
paragraph.Format.SpaceBefore = "6cm";
|
||||
paragraph.Format.SpaceAfter = "3cm";
|
||||
|
||||
paragraph = section.AddParagraph("by");
|
||||
paragraph.Format.Font.Size = 12;
|
||||
paragraph.Format.Font.Italic = true;
|
||||
paragraph.Format.Alignment = ParagraphAlignment.Center;
|
||||
paragraph.Format.SpaceAfter = "3cm";
|
||||
|
||||
paragraph = section.AddParagraph(rTB_ReportEnterOperator.Text);
|
||||
paragraph.Format.Font.Size = 14;
|
||||
paragraph.Format.Alignment = ParagraphAlignment.Center;
|
||||
paragraph.Format.SpaceAfter = "3cm";
|
||||
|
||||
|
||||
paragraph = section.AddParagraph(rtB_ReportTitlepageIntro.Text);
|
||||
paragraph.Format.Font.Size = 12;
|
||||
// paragraph.Format.Alignment = ParagraphAlignment.Center;
|
||||
paragraph.Format.Alignment = ParagraphAlignment.Justify;
|
||||
paragraph.Format.SpaceAfter = "3cm";
|
||||
|
||||
}
|
||||
public static void DefineTableOfContents(Document document)
|
||||
{
|
||||
Section section = document.LastSection;
|
||||
|
||||
section.AddPageBreak();
|
||||
Paragraph paragraph = section.AddParagraph("Table of Contents");
|
||||
paragraph.Format.Font.Size = 14;
|
||||
paragraph.Format.Font.Bold = true;
|
||||
paragraph.Format.SpaceAfter = 24;
|
||||
paragraph.Format.OutlineLevel = OutlineLevel.Level1;
|
||||
|
||||
paragraph = section.AddParagraph();
|
||||
paragraph.Style = "TOC";
|
||||
Hyperlink hyperlink = paragraph.AddHyperlink("GP30 Settings");
|
||||
hyperlink.AddText("GP30 Settings\t");
|
||||
hyperlink.AddPageRefField("GP30 Settings");
|
||||
hyperlink = paragraph.AddHyperlink("Decoded Data");
|
||||
hyperlink.AddText("Decoded Data\t");
|
||||
hyperlink.AddPageRefField("Decoded Data");
|
||||
|
||||
paragraph = section.AddParagraph();
|
||||
paragraph.Style = "TOC";
|
||||
hyperlink = paragraph.AddHyperlink("Tables");
|
||||
hyperlink.AddText("Tables\t");
|
||||
hyperlink.AddPageRefField("Tables");
|
||||
|
||||
paragraph = section.AddParagraph();
|
||||
paragraph.Style = "TOC";
|
||||
hyperlink = paragraph.AddHyperlink("Charts");
|
||||
hyperlink.AddText("Charts\t");
|
||||
hyperlink.AddPageRefField("Charts");
|
||||
}
|
||||
public static void DefineStyles(Document document)
|
||||
{
|
||||
// Get the predefined style Normal.
|
||||
Style style = document.Styles["Normal"];
|
||||
// Because all styles are derived from Normal, the next line changes the
|
||||
// font of the whole document. Or, more exactly, it changes the font of
|
||||
// all styles and paragraphs that do not redefine the font.
|
||||
style.Font.Name = "Times New Roman";
|
||||
|
||||
// Heading1 to Heading9 are predefined styles with an outline level. An outline level
|
||||
// other than OutlineLevel.BodyText automatically creates the outline (or bookmarks)
|
||||
// in PDF.
|
||||
|
||||
style = document.Styles["Heading1"];
|
||||
style.Font.Name = "Arial";
|
||||
style.Font.Size = 14;
|
||||
style.ParagraphFormat.Alignment = ParagraphAlignment.Center;
|
||||
style.Font.Bold = true;
|
||||
style.Font.Color = Colors.Black;
|
||||
style.ParagraphFormat.PageBreakBefore = true;
|
||||
style.ParagraphFormat.SpaceAfter = 10;
|
||||
|
||||
style = document.Styles["Heading2"];
|
||||
style.Font.Name = "Arial";
|
||||
style.Font.Size = 12;
|
||||
style.Font.Bold = true;
|
||||
style.ParagraphFormat.PageBreakBefore = false;
|
||||
style.ParagraphFormat.SpaceBefore = 6;
|
||||
style.ParagraphFormat.SpaceAfter = 6;
|
||||
|
||||
style = document.Styles["Heading3"];
|
||||
style.Font.Size = 10;
|
||||
style.Font.Bold = true;
|
||||
style.Font.Italic = true;
|
||||
style.ParagraphFormat.SpaceBefore = 6;
|
||||
style.ParagraphFormat.SpaceAfter = 3;
|
||||
|
||||
style = document.Styles[StyleNames.Header];
|
||||
style.ParagraphFormat.AddTabStop("16cm", MigraDoc.DocumentObjectModel.TabAlignment.Right);
|
||||
|
||||
style = document.Styles[StyleNames.Footer];
|
||||
style.ParagraphFormat.AddTabStop("8cm", MigraDoc.DocumentObjectModel.TabAlignment.Center);
|
||||
|
||||
// Create a new style called TextBox based on style Normal
|
||||
style = document.Styles.AddStyle("TextBox", "Normal");
|
||||
style.ParagraphFormat.Alignment = ParagraphAlignment.Justify;
|
||||
style.ParagraphFormat.Borders.Width = 2.5;
|
||||
style.ParagraphFormat.Borders.Distance = "3pt";
|
||||
style.ParagraphFormat.Shading.Color = Colors.SkyBlue;
|
||||
|
||||
// Create a new style called TOC based on style Normal
|
||||
style = document.Styles.AddStyle("TOC", "Normal");
|
||||
style.ParagraphFormat.AddTabStop("16cm", MigraDoc.DocumentObjectModel.TabAlignment.Right, TabLeader.Dots);
|
||||
style.ParagraphFormat.Font.Color = Colors.Blue;
|
||||
}
|
||||
private void MigraDocDecodedDataPath0(Document report)
|
||||
{
|
||||
string ClockCalibrationValue = string.Empty;
|
||||
string PulsewidthUp = string.Empty;
|
||||
string PulsewidthDown = string.Empty;
|
||||
string AmplitudeUp = string.Empty;
|
||||
string AmplitudeDown = string.Empty;
|
||||
string AmplitudeCalUp = string.Empty;
|
||||
string AmplitudeCalDown = string.Empty;
|
||||
string TofSumOfAllUp = string.Empty;
|
||||
string TofSumOfAllDown = string.Empty;
|
||||
string Tof0Up = string.Empty;
|
||||
string Tof1Up = string.Empty;
|
||||
string Tof2Up = string.Empty;
|
||||
string Tof3Up = string.Empty;
|
||||
string Tof4Up = string.Empty;
|
||||
string Tof5Up = string.Empty;
|
||||
string Tof6Up = string.Empty;
|
||||
string Tof7Up = string.Empty;
|
||||
string Tof0Down = string.Empty;
|
||||
string Tof1Down = string.Empty;
|
||||
string Tof2Down = string.Empty;
|
||||
string Tof3Down = string.Empty;
|
||||
string Tof4Down = string.Empty;
|
||||
string Tof5Down = string.Empty;
|
||||
string Tof6Down = string.Empty;
|
||||
string Tof7Down = string.Empty;
|
||||
string Temperature = string.Empty;
|
||||
string DifTof0 = string.Empty;
|
||||
string DifTof1 = string.Empty;
|
||||
string DifTof2 = string.Empty;
|
||||
string DifTof3 = string.Empty;
|
||||
string DifTof4 = string.Empty;
|
||||
string DifTof5 = string.Empty;
|
||||
string DifTof6 = string.Empty;
|
||||
string DifTof7 = string.Empty;
|
||||
|
||||
/*
|
||||
if (l_GetFirstLevelUpPath0.Text != "---")
|
||||
FirstHitLevelUpPath0 = l_GetFirstLevelUpPath0.Text + " (" + (Convert.ToDouble(l_GetFirstLevelUpPath0.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage) + "mV)";
|
||||
else
|
||||
FirstHitLevelUpPath0 = "---";
|
||||
|
||||
if (l_GetFirstLevelUpPath1.Text != "---")
|
||||
FirstHitLevelUpPath1 = l_GetFirstLevelUpPath1.Text + " (" + (Convert.ToDouble(l_GetFirstLevelUpPath1.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage) + "mV)";
|
||||
else
|
||||
FirstHitLevelUpPath1 = "---";
|
||||
|
||||
if (l_GetFirstLevelUpPath2.Text != "---")
|
||||
FirstHitLevelUpPath2 = l_GetFirstLevelUpPath2.Text + " (" + (Convert.ToDouble(l_GetFirstLevelUpPath2.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage) + "mV)";
|
||||
else
|
||||
FirstHitLevelUpPath2 = "---";
|
||||
|
||||
if (l_GetFirstLevelDownPath0.Text != "---")
|
||||
FirstHitLevelDownPath0 = l_GetFirstLevelDownPath0.Text + " (" + (Convert.ToDouble(l_GetFirstLevelUpPath0.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage) + "mV)";
|
||||
else
|
||||
FirstHitLevelDownPath0 = "---";
|
||||
|
||||
if (l_GetFirstLevelDownPath1.Text != "---")
|
||||
FirstHitLevelDownPath1 = l_GetFirstLevelDownPath1.Text + " (" + (Convert.ToDouble(l_GetFirstLevelUpPath1.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage) + "mV)";
|
||||
else
|
||||
FirstHitLevelDownPath1 = "---";
|
||||
|
||||
if (l_GetFirstLevelDownPath2.Text != "---")
|
||||
FirstHitLevelDownPath2 = l_GetFirstLevelDownPath2.Text + " (" + (Convert.ToDouble(l_GetFirstLevelUpPath2.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage) + "mV)";
|
||||
else
|
||||
FirstHitLevelDownPath2 = "---";
|
||||
|
||||
if (l_Gp30GetNumberOfPulses.Text != "---")
|
||||
NumberOfBursts = l_Gp30GetNumberOfPulses.Text;
|
||||
else
|
||||
NumberOfBursts = "---";
|
||||
|
||||
if (l_Gp30GetStartHit.Text != "---")
|
||||
StartHit = l_Gp30GetStartHit.Text;
|
||||
else
|
||||
StartHit = "---";
|
||||
|
||||
if (l_Gp30GetAmplitude.Text != "---")
|
||||
AmplitudePeak = l_Gp30GetAmplitude.Text;
|
||||
else
|
||||
AmplitudePeak = "---";
|
||||
|
||||
if (l_Gp30GetSamplerate.Text != "---")
|
||||
Samplerate = l_Gp30GetSamplerate.Text;
|
||||
else
|
||||
Samplerate = "---";
|
||||
|
||||
|
||||
|
||||
Section Gp30Settings = Report.AddSection();
|
||||
|
||||
Paragraph paragraph = Gp30Settings.AddParagraph("GP30 Settings");
|
||||
paragraph.Style = "Heading1";
|
||||
paragraph.Format.SpaceAfter = 50;
|
||||
paragraph.AddBookmark("GP30 Settings");
|
||||
|
||||
Table TableGp30Settings = new Table();
|
||||
|
||||
TableGp30Settings.Borders.Width = 0.75;
|
||||
TableGp30Settings.Format.Alignment = ParagraphAlignment.Center;
|
||||
Column Parameter = TableGp30Settings.AddColumn(Unit.FromCentimeter(6));
|
||||
Column Value = TableGp30Settings.AddColumn(Unit.FromCentimeter(6));
|
||||
|
||||
Row row = TableGp30Settings.AddRow();
|
||||
row.Format.Font.Bold = true;
|
||||
Cell cell = row.Cells[0];
|
||||
cell.AddParagraph("Parameter");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph("Value");
|
||||
|
||||
|
||||
row = TableGp30Settings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("First Hit level up PATH0");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(FirstHitLevelUpPath0);
|
||||
|
||||
row = TableGp30Settings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("First Hit level up PATH1");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(FirstHitLevelUpPath1);
|
||||
|
||||
row = TableGp30Settings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("First Hit level up PATH2");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(FirstHitLevelUpPath2);
|
||||
|
||||
row = TableGp30Settings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("First Hit level down PATH0");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(FirstHitLevelDownPath0);
|
||||
|
||||
row = TableGp30Settings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("First Hit level down PATH1");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(FirstHitLevelDownPath1);
|
||||
|
||||
row = TableGp30Settings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("First Hit level down PATH2");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(FirstHitLevelDownPath2);
|
||||
|
||||
row = TableGp30Settings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("Number of bursts");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(NumberOfBursts);
|
||||
|
||||
row = TableGp30Settings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("Starthit");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(StartHit);
|
||||
|
||||
row = TableGp30Settings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("Amplitude Peak Detect");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(AmplitudePeak);
|
||||
|
||||
row = TableGp30Settings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("Samplerate");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(Samplerate);
|
||||
Report.LastSection.Add(TableGp30Settings);*/
|
||||
}
|
||||
private void MigraDocGp30Settings(Document Report)
|
||||
{
|
||||
string FirstHitLevelUpPath0 = string.Empty;
|
||||
string FirstHitLevelUpPath1 = string.Empty;
|
||||
string FirstHitLevelUpPath2 = string.Empty;
|
||||
string FirstHitLevelDownPath0 = string.Empty;
|
||||
string FirstHitLevelDownPath1 = string.Empty;
|
||||
string FirstHitLevelDownPath2 = string.Empty;
|
||||
string NumberOfBursts = string.Empty;
|
||||
string StartHit = string.Empty;
|
||||
string AmplitudePeak = string.Empty;
|
||||
string Samplerate = string.Empty;
|
||||
|
||||
|
||||
if (l_GetFirstLevelUpPath0Meter1.Text != "---")
|
||||
FirstHitLevelUpPath0 = l_GetFirstLevelUpPath0Meter1.Text + " (" + (Convert.ToDouble(l_GetFirstLevelUpPath0Meter1.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage) + "mV)";
|
||||
else
|
||||
FirstHitLevelUpPath0 = "---";
|
||||
|
||||
if (l_GetFirstLevelUpPath1Meter1.Text != "---")
|
||||
FirstHitLevelUpPath1 = l_GetFirstLevelUpPath1Meter1.Text + " (" + (Convert.ToDouble(l_GetFirstLevelUpPath1Meter1.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage) + "mV)";
|
||||
else
|
||||
FirstHitLevelUpPath1 = "---";
|
||||
|
||||
if (l_GetFirstLevelUpPath2Meter1.Text != "---")
|
||||
FirstHitLevelUpPath2 = l_GetFirstLevelUpPath2Meter1.Text + " (" + (Convert.ToDouble(l_GetFirstLevelUpPath2Meter1.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage) + "mV)";
|
||||
else
|
||||
FirstHitLevelUpPath2 = "---";
|
||||
|
||||
if (l_GetFirstLevelDownPath0Meter1.Text != "---")
|
||||
FirstHitLevelDownPath0 = l_GetFirstLevelDownPath0Meter1.Text + " (" + (Convert.ToDouble(l_GetFirstLevelUpPath0Meter1.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage) + "mV)";
|
||||
else
|
||||
FirstHitLevelDownPath0 = "---";
|
||||
|
||||
if (l_GetFirstLevelDownPath1Meter1.Text != "---")
|
||||
FirstHitLevelDownPath1 = l_GetFirstLevelDownPath1Meter1.Text + " (" + (Convert.ToDouble(l_GetFirstLevelUpPath1Meter1.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage) + "mV)";
|
||||
else
|
||||
FirstHitLevelDownPath1 = "---";
|
||||
|
||||
if (l_GetFirstLevelDownPath2Meter1.Text != "---")
|
||||
FirstHitLevelDownPath2 = l_GetFirstLevelDownPath2Meter1.Text + " (" + (Convert.ToDouble(l_GetFirstLevelUpPath2Meter1.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage) + "mV)";
|
||||
else
|
||||
FirstHitLevelDownPath2 = "---";
|
||||
|
||||
if (l_Gp30GetNumberOfPulsesMeter1.Text != "---")
|
||||
NumberOfBursts = l_Gp30GetNumberOfPulsesMeter1.Text;
|
||||
else
|
||||
NumberOfBursts = "---";
|
||||
|
||||
if (l_Gp30GetStartHitMeter1.Text != "---")
|
||||
StartHit = l_Gp30GetStartHitMeter1.Text;
|
||||
else
|
||||
StartHit = "---";
|
||||
|
||||
if (l_Gp30GetAmplitudeMeter1.Text != "---")
|
||||
AmplitudePeak = l_Gp30GetAmplitudeMeter1.Text;
|
||||
else
|
||||
AmplitudePeak = "---";
|
||||
|
||||
if (l_Gp30GetSamplerateMeter1.Text != "---")
|
||||
Samplerate = l_Gp30GetSamplerateMeter1.Text;
|
||||
else
|
||||
Samplerate = "---";
|
||||
|
||||
|
||||
|
||||
Section Settings = Report.AddSection();
|
||||
|
||||
Paragraph paragraph = Settings.AddParagraph("Settings");
|
||||
paragraph.Style = "Heading1";
|
||||
paragraph.Format.SpaceAfter = 50;
|
||||
paragraph.AddBookmark("Settings");
|
||||
|
||||
Table TableSettings = new Table();
|
||||
|
||||
TableSettings.Borders.Width = 0.75;
|
||||
TableSettings.Format.Alignment = ParagraphAlignment.Center;
|
||||
Column Parameter = TableSettings.AddColumn(Unit.FromCentimeter(6));
|
||||
Column Value = TableSettings.AddColumn(Unit.FromCentimeter(6));
|
||||
|
||||
Row row = TableSettings.AddRow();
|
||||
row.Format.Font.Bold = true;
|
||||
Cell cell = row.Cells[0];
|
||||
cell.AddParagraph("Parameter");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph("Value");
|
||||
|
||||
|
||||
row = TableSettings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("First Hit level up PATH1");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(FirstHitLevelUpPath0);
|
||||
|
||||
row = TableSettings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("First Hit level up PATH2");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(FirstHitLevelUpPath1);
|
||||
|
||||
row = TableSettings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("First Hit level up PATH3");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(FirstHitLevelUpPath2);
|
||||
|
||||
row = TableSettings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("First Hit level down PATH1");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(FirstHitLevelDownPath0);
|
||||
|
||||
row = TableSettings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("First Hit level down PATH2");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(FirstHitLevelDownPath1);
|
||||
|
||||
row = TableSettings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("First Hit level down PATH3");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(FirstHitLevelDownPath2);
|
||||
|
||||
row = TableSettings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("Number of bursts");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(NumberOfBursts);
|
||||
|
||||
row = TableSettings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("Starthit");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(StartHit);
|
||||
|
||||
row = TableSettings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("Amplitude Peak Detect");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(AmplitudePeak);
|
||||
|
||||
row = TableSettings.AddRow();
|
||||
cell = row.Cells[0];
|
||||
cell.AddParagraph("Samplerate");
|
||||
cell = row.Cells[1];
|
||||
cell.AddParagraph(Samplerate);
|
||||
Report.LastSection.Add(TableSettings);
|
||||
}
|
||||
private void GenerateMigraDoc()
|
||||
{
|
||||
Document Report = new Document();
|
||||
DefineStyles(Report);
|
||||
MigraDocTitlepage(Report);
|
||||
DefineTableOfContents(Report);
|
||||
//DefineContentSection(Report);
|
||||
MigraDocGp30Settings(Report);
|
||||
|
||||
|
||||
PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(false, PdfFontEmbedding.Always);
|
||||
pdfRenderer.Document = Report;
|
||||
pdfRenderer.RenderDocument();
|
||||
|
||||
string filename = "Hello World.pdf";
|
||||
pdfRenderer.PdfDocument.Save(filename);
|
||||
Process.Start(filename);
|
||||
}
|
||||
/*
|
||||
public static Document CreateDocument()
|
||||
{
|
||||
// Create a new MigraDoc document
|
||||
Document document = new Document();
|
||||
document.Info.Title = "Hello, MigraDoc";
|
||||
document.Info.Subject = "Demonstrates an excerpt of the capabilities of MigraDoc.";
|
||||
document.Info.Author = "Stefan Lange";
|
||||
|
||||
Styles.DefineStyles(document);
|
||||
|
||||
Cover.DefineCover(document);
|
||||
TableOfContents.DefineTableOfContents(document);
|
||||
|
||||
DefineContentSection(document);
|
||||
|
||||
Paragraphs.DefineParagraphs(document);
|
||||
Tables.DefineTables(document);
|
||||
Charts.DefineCharts(document);
|
||||
|
||||
return document;
|
||||
}*/
|
||||
private void GenerateWordReport()
|
||||
{
|
||||
|
||||
//#region Parameter query check
|
||||
//if (cB_ReportGP30Settings.Checked)
|
||||
//{
|
||||
// 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
|
||||
//#region Declarations
|
||||
//string FilenameWord = rTB_ReportEnterDate.Text.Replace("-", string.Empty);
|
||||
//string Fullpath = string.Empty;
|
||||
//#region GP30-settings
|
||||
//#region PATH0 up
|
||||
//string TextGp30Settings = string.Empty;
|
||||
//if (l_GetFirstLevelUpPath0Meter1.Text != "---")
|
||||
// TextGp30Settings = TextGp30Settings + "First Hit level up PATH0: " + l_GetFirstLevelUpPath0Meter1.Text + " (" + (Convert.ToDouble(l_GetFirstLevelUpPath0Meter1.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage, CultureInfo.InvariantCulture) + "mV)\n";
|
||||
//else
|
||||
// TextGp30Settings = TextGp30Settings + "First Hit level up PATH0: ---\n";
|
||||
//#endregion
|
||||
//#region PATH1 up
|
||||
//if (l_GetFirstLevelUpPath1Meter1.Text != "---")
|
||||
// TextGp30Settings = TextGp30Settings + "First Hit level up PATH1: " + l_GetFirstLevelUpPath1Meter1.Text + " (" + (Convert.ToDouble(l_GetFirstLevelUpPath1Meter1.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage, CultureInfo.InvariantCulture) + "mV)\n";
|
||||
//else
|
||||
// TextGp30Settings = TextGp30Settings + "First Hit level up PATH1: ---\n";
|
||||
//#endregion
|
||||
//#region PATH2 up
|
||||
//if (l_GetFirstLevelUpPath2Meter1.Text != "---")
|
||||
// TextGp30Settings = TextGp30Settings + "First Hit level up PATH2: " + l_GetFirstLevelUpPath2Meter1.Text + " (" + (Convert.ToDouble(l_GetFirstLevelUpPath2Meter1.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage, CultureInfo.InvariantCulture) + "mV)\n";
|
||||
//else
|
||||
// TextGp30Settings = TextGp30Settings + "First Hit level up PATH2: ---\n";
|
||||
//#endregion
|
||||
//#region PATH0 down
|
||||
//if (l_GetFirstLevelDownPath0Meter1.Text != "---")
|
||||
// TextGp30Settings = TextGp30Settings + "First Hit level down PATH0: " + l_GetFirstLevelDownPath0Meter1.Text + " (" + (Convert.ToDouble(l_GetFirstLevelDownPath0Meter1.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage, CultureInfo.InvariantCulture) + "mV)\n";
|
||||
//else
|
||||
// TextGp30Settings = TextGp30Settings + "First Hit level down PATH0: ---\n";
|
||||
//#endregion
|
||||
//#region PATH1 down
|
||||
//if (l_GetFirstLevelDownPath1Meter1.Text != "---")
|
||||
// TextGp30Settings = TextGp30Settings + "First Hit level down PATH1: " + l_GetFirstLevelDownPath1Meter1.Text + " (" + (Convert.ToDouble(l_GetFirstLevelDownPath1Meter1.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage, CultureInfo.InvariantCulture) + "mV)\n";
|
||||
//else
|
||||
// TextGp30Settings = TextGp30Settings + "First Hit level down PATH1: ---\n";
|
||||
//#endregion
|
||||
//#region PATH2 down
|
||||
//if (l_GetFirstLevelDownPath2Meter1.Text != "---")
|
||||
// TextGp30Settings = TextGp30Settings + "First Hit level down PATH2: " + l_GetFirstLevelDownPath2Meter1.Text + " (" + (Convert.ToDouble(l_GetFirstLevelDownPath2Meter1.Text) * Constants.FirstHitLevelFactor).ToString(Formats.FirstHitLevelVoltage, CultureInfo.InvariantCulture) + "mV)\n";
|
||||
//else
|
||||
// TextGp30Settings = TextGp30Settings + "First Hit level down PATH2: ---\n";
|
||||
//#endregion
|
||||
//#region Number of bursts
|
||||
//if (l_Gp30GetNumberOfPulsesMeter1.Text != "---")
|
||||
// TextGp30Settings = TextGp30Settings + "Number of bursts: " + l_Gp30GetNumberOfPulsesMeter1.Text + "\n";
|
||||
//else
|
||||
// TextGp30Settings = TextGp30Settings + "Number of bursts: ---\n";
|
||||
//#endregion
|
||||
//#region Start hit
|
||||
//if (l_Gp30GetStartHitMeter1.Text != "---")
|
||||
// TextGp30Settings = TextGp30Settings + "Starthit: " + l_Gp30GetStartHitMeter1.Text + "\n";
|
||||
//else
|
||||
// TextGp30Settings = TextGp30Settings + "Starthit: ---\n";
|
||||
//#endregion
|
||||
//#region Amplitude peak detect
|
||||
//if (l_Gp30GetAmplitudeMeter1.Text != "---")
|
||||
// TextGp30Settings = TextGp30Settings + "Amplitude peak detect: " + l_Gp30GetAmplitudeMeter1.Text + "\n";
|
||||
//else
|
||||
// TextGp30Settings = TextGp30Settings + "Amplitude peak detect: ---\n";
|
||||
//#endregion
|
||||
//#region Samplerate
|
||||
//if (l_Gp30GetSamplerateMeter1.Text != "---")
|
||||
// TextGp30Settings = TextGp30Settings + "Samplerate: " + l_Gp30GetSamplerateMeter1.Text + "\n";
|
||||
//else
|
||||
// TextGp30Settings = TextGp30Settings + "Samplerate: ---\n";
|
||||
//#endregion
|
||||
//#endregion
|
||||
//FilenameWord = FilenameWord + "_" + rTB_ReportEnterOperator.Text + "_" + rTB_ReportEnterTitle.Text + ".docx";
|
||||
//#endregion
|
||||
//#region Initialisation
|
||||
//Microsoft.Office.Interop.Word.Application winword = new Microsoft.Office.Interop.Word.Application();
|
||||
//Set status for word application is to be visible or not.
|
||||
//winword.Visible = false;
|
||||
//Create a missing variable for missing value
|
||||
//object missing = System.Reflection.Missing.Value;
|
||||
//Create a new document
|
||||
//Microsoft.Office.Interop.Word.Document document = winword.Documents.Add(ref missing, ref missing, ref missing, ref missing);
|
||||
//#endregion
|
||||
//#region Header
|
||||
//foreach (Microsoft.Office.Interop.Word.Section section in document.Sections)
|
||||
//{
|
||||
// Get the header range and add the header details.
|
||||
// Microsoft.Office.Interop.Word.Range headerRange = section.Headers[Microsoft.Office.Interop.Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range;
|
||||
// headerRange.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphRight;
|
||||
// string path = System.IO.Directory.GetCurrentDirectory() + "\\XylemLogoSmall.png";
|
||||
// headerRange.InlineShapes.AddPicture(@path);
|
||||
//}
|
||||
//#endregion
|
||||
//#region Titlepage
|
||||
//Microsoft.Office.Interop.Word.Paragraph Titlepage = document.Paragraphs.Add(ref missing);
|
||||
//Titlepage.Range.Font.ColorIndex = Microsoft.Office.Interop.Word.WdColorIndex.wdBlack;
|
||||
//Titlepage.Range.Font.Name = "Arial";
|
||||
//Titlepage.Range.Text = string.Empty;
|
||||
//Titlepage.Range.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
|
||||
//Titlepage.Range.Font.Size = 20;
|
||||
//Titlepage.Range.Font.Bold = 1;
|
||||
//Titlepage.Range.Italic = 0;
|
||||
//Titlepage.Range.Text = "\n\n\n" + rTB_ReportEnterTitle.Text + "\n\n";
|
||||
//Titlepage.Range.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
|
||||
//Titlepage.Range.Font.Size = 14;
|
||||
//Titlepage.Range.Font.Bold = 1;
|
||||
//Titlepage.Range.Italic = 0;
|
||||
//Titlepage.Range.Text = rTB_ReportEnterDate.Text + "\n";
|
||||
//Titlepage.Range.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
|
||||
//Titlepage.Range.Font.Size = 12;
|
||||
//Titlepage.Range.Font.Bold = 1;
|
||||
//Titlepage.Range.Italic = 1;
|
||||
//Titlepage.Range.Text = "by\n";
|
||||
//Titlepage.Range.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
|
||||
//Titlepage.Range.Font.Size = 14;
|
||||
//Titlepage.Range.Font.Bold = 1;
|
||||
//Titlepage.Range.Italic = 0;
|
||||
//Titlepage.Range.Text = rTB_ReportEnterOperator.Text + "\n\n\n\n\n\n";
|
||||
//Titlepage.Range.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphLeft;
|
||||
//Titlepage.Range.Font.Size = 10;
|
||||
//Titlepage.Range.Font.Bold = 0;
|
||||
//Titlepage.Range.Italic = 0;
|
||||
//Titlepage.Range.Text = rtB_ReportTitlepageIntro.Text;
|
||||
//Titlepage.Range.InsertParagraphAfter();
|
||||
//Titlepage.Range.InsertBreak();
|
||||
//#endregion
|
||||
//#region Page GP30 settings
|
||||
//if (cB_ReportGP30Settings.Checked)
|
||||
//{
|
||||
// Microsoft.Office.Interop.Word.Paragraph GP30Settings = document.Paragraphs.Add(ref missing);
|
||||
// GP30Settings.Range.PageSetup.LeftMargin = (float)45;
|
||||
// GP30Settings.Range.Font.ColorIndex = Microsoft.Office.Interop.Word.WdColorIndex.wdBlack;
|
||||
// GP30Settings.Range.Font.Name = "Arial";
|
||||
// GP30Settings.Range.PageSetup.LeftMargin = (float)60;
|
||||
// GP30Settings.Range.Text = string.Empty;
|
||||
// #region Headline1
|
||||
// GP30Settings.Range.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
|
||||
// GP30Settings.Range.Font.Size = 20;
|
||||
// GP30Settings.Range.Font.Bold = 1;
|
||||
// GP30Settings.Range.Italic = 0;
|
||||
// GP30Settings.Range.Text = "GP30-Settings\n";
|
||||
// #endregion
|
||||
// #region Headline2
|
||||
// GP30Settings.Range.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphLeft;
|
||||
// GP30Settings.Range.PageSetup.LeftMargin = (float)60;
|
||||
// GP30Settings.Range.Font.Size = 12;
|
||||
// GP30Settings.Range.Font.Bold = 1;
|
||||
// GP30Settings.Range.Italic = 1;
|
||||
// GP30Settings.Range.Text = "Values obtained from register readout\n\n";
|
||||
// #endregion
|
||||
// #region Data
|
||||
// GP30Settings.Range.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphLeft;
|
||||
// GP30Settings.Range.ParagraphFormat.LineSpacing = 8;
|
||||
// GP30Settings.Range.Font.Size = 10;
|
||||
// GP30Settings.Range.Font.Bold = 0;
|
||||
// GP30Settings.Range.Italic = 0;
|
||||
// GP30Settings.Range.Text = TextGp30Settings;
|
||||
// #endregion
|
||||
// GP30Settings.Range.InsertBreak();
|
||||
//}
|
||||
//#endregion
|
||||
|
||||
|
||||
//#region Save files
|
||||
//#region Save file dialog
|
||||
//SaveFileDialog saveFileDialog1 = new SaveFileDialog();
|
||||
//saveFileDialog1.Filter = "DOCX (*.docx)|*.docx";
|
||||
//saveFileDialog1.Filter = "DOCX (*.docx)|*.docx";
|
||||
//saveFileDialog1.FilterIndex = 2;
|
||||
//saveFileDialog1.RestoreDirectory = true;
|
||||
//saveFileDialog1.FileName = FilenameWord;
|
||||
//#endregion
|
||||
//#region Save to file
|
||||
//if (saveFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
//{
|
||||
// SaveDataPathWord = System.IO.Path.GetFullPath(saveFileDialog1.FileName);
|
||||
// Fullpath = SaveDataPathWord;
|
||||
|
||||
// object filename = Fullpath;
|
||||
// document.SaveAs2(ref filename);
|
||||
// document.Close(ref missing, ref missing, ref missing);
|
||||
// document = null;
|
||||
// winword.Quit(ref missing, ref missing, ref missing);
|
||||
// winword = null;
|
||||
// MessageBox.Show("Document created successfully !");
|
||||
|
||||
//}
|
||||
//#endregion
|
||||
//#endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,271 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\Common\packages\Microsoft.Net.Native.SharedLibrary-arm.2.0.0\build\Microsoft.Net.Native.SharedLibrary-arm.props" Condition="Exists('..\Common\packages\Microsoft.Net.Native.SharedLibrary-arm.2.0.0\build\Microsoft.Net.Native.SharedLibrary-arm.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{DA2961C6-96EF-4D09-AF73-0EAA1E221A5F}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>GenesisDisplayTool</RootNamespace>
|
||||
<AssemblyName>GenesisDisplayTool</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>3</WarningLevel>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<CodeAnalysisRuleSet>
|
||||
</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<CodeAnalysisRuleSet>
|
||||
</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'GenesisDisplayTool_V01|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\GenesisDisplayTool_V01\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>
|
||||
</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CsvExport.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CsvLogging.cs" />
|
||||
<Compile Include="dataaccess.cs" />
|
||||
<Compile Include="Debug.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="DecodedData.cs" />
|
||||
<Compile Include="DecodeTelegram.cs" />
|
||||
<Compile Include="ErrorLog.cs" />
|
||||
<Compile Include="Files.cs" />
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FutureReports.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Gp30.cs" />
|
||||
<Compile Include="Json.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Maingraph.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Maths.cs" />
|
||||
<Compile Include="Mean.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Constants.cs" />
|
||||
<Compile Include="MeanCalculate.cs" />
|
||||
<Compile Include="Miscellanous.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RawData.cs" />
|
||||
<Compile Include="RegisterProperties.cs" />
|
||||
<Compile Include="Report.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ReportPages.cs" />
|
||||
<Compile Include="SerialConfig.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="StandardDeviation.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.5.2 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="License-LGPL.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Common\Hardware\Interfaces\Ports\SerialPorts\SerialPorts.csproj">
|
||||
<Project>{72037E89-4F63-4B3F-BEFF-4138E578CE99}</Project>
|
||||
<Name>SerialPorts</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Common\Hardware\WaterMeter\Genesis\DataPackages\DataPackages.csproj">
|
||||
<Project>{0E524D43-7B66-45CD-AA74-41D51AFC3D99}</Project>
|
||||
<Name>DataPackages</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Common\Hardware\WaterMeter\Genesis\GenesisConfig\GenesisConfig.csproj">
|
||||
<Project>{F013A56B-7BE6-4852-9CD8-B971CD1ADD0C}</Project>
|
||||
<Name>GenesisConfig</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Common\Hardware\WaterMeter\Genesis\GenesisCore\GenesisCore.csproj">
|
||||
<Project>{04201E95-90A0-4B73-A72F-379739B2A3AE}</Project>
|
||||
<Name>GenesisCore</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Common\Hardware\WaterMeter\Genesis\Registers\Registers.csproj">
|
||||
<Project>{F4AAF7E6-7333-4284-B735-E32DEB076C64}</Project>
|
||||
<Name>Registers</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Common\Hardware\WaterMeter\WaterMeterCore\WaterMeterCore.csproj">
|
||||
<Project>{8203ABB8-38E5-472E-A742-33F38B7A74A6}</Project>
|
||||
<Name>WaterMeterCore</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Common\Hardware\WaterMeter\WaterMeterCore\WaterMeterRegisters\WaterMeterRegisters.csproj">
|
||||
<Project>{26afcf1e-1287-48b8-a506-32b1e8a0dd0e}</Project>
|
||||
<Name>WaterMeterRegisters</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
<HintPath>..\Common\packages\Microsoft.Office.Interop.Word.15.0.4797.1003\lib\net20\Microsoft.Office.Interop.Word.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MigraDoc.DocumentObjectModel, Version=1.32.4334.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\Common\packages\PDFsharp-MigraDoc-GDI.1.32.4334.0\lib\net20\MigraDoc.DocumentObjectModel.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MigraDoc.Rendering, Version=1.32.4334.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\Common\packages\PDFsharp-MigraDoc-GDI.1.32.4334.0\lib\net20\MigraDoc.Rendering.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MigraDoc.RtfRendering, Version=1.32.4334.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\Common\packages\PDFsharp-MigraDoc-GDI.1.32.4334.0\lib\net20\MigraDoc.RtfRendering.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\Common\packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\Common\packages\NLog.4.5.6\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="PdfSharp, Version=1.32.3057.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\Common\packages\PDFsharp-MigraDoc-GDI.1.32.4334.0\lib\net20\PdfSharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="PdfSharp.Charting, Version=1.32.3057.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\Common\packages\PDFsharp-MigraDoc-GDI.1.32.4334.0\lib\net20\PdfSharp.Charting.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Windows" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="ZedGraph, Version=5.1.7.430, Culture=neutral, PublicKeyToken=02a83cbd123fcd60, processorArchitecture=MSIL">
|
||||
<HintPath>..\Common\packages\ZedGraph.5.1.7\lib\net35-Client\ZedGraph.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\Common\packages\Microsoft.Net.Native.SharedLibrary-arm.2.0.0\build\Microsoft.Net.Native.SharedLibrary-arm.props')" Text="$([System.String]::Format('$(ErrorText)', '..\Common\packages\Microsoft.Net.Native.SharedLibrary-arm.2.0.0\build\Microsoft.Net.Native.SharedLibrary-arm.props'))" />
|
||||
<Error Condition="!Exists('..\Common\packages\Microsoft.Net.Native.SharedLibrary-arm.2.0.0\build\Microsoft.Net.Native.SharedLibrary-arm.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\Common\packages\Microsoft.Net.Native.SharedLibrary-arm.2.0.0\build\Microsoft.Net.Native.SharedLibrary-arm.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\Common\packages\Microsoft.Net.Native.SharedLibrary-arm.2.0.0\build\Microsoft.Net.Native.SharedLibrary-arm.targets" Condition="Exists('..\Common\packages\Microsoft.Net.Native.SharedLibrary-arm.2.0.0\build\Microsoft.Net.Native.SharedLibrary-arm.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26730.16
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GenesisDisplayTool", "GenesisDisplayTool.csproj", "{DA2961C6-96EF-4D09-AF73-0EAA1E221A5F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
GenesisDisplayTool_V01|Any CPU = GenesisDisplayTool_V01|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{DA2961C6-96EF-4D09-AF73-0EAA1E221A5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DA2961C6-96EF-4D09-AF73-0EAA1E221A5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DA2961C6-96EF-4D09-AF73-0EAA1E221A5F}.GenesisDisplayTool_V01|Any CPU.ActiveCfg = GenesisDisplayTool_V01|Any CPU
|
||||
{DA2961C6-96EF-4D09-AF73-0EAA1E221A5F}.GenesisDisplayTool_V01|Any CPU.Build.0 = GenesisDisplayTool_V01|Any CPU
|
||||
{DA2961C6-96EF-4D09-AF73-0EAA1E221A5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DA2961C6-96EF-4D09-AF73-0EAA1E221A5F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {376F18A2-1394-4421-AD7D-3A477BFA624F}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Printing;
|
||||
using ZedGraph;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GenesisDisplayTool
|
||||
{
|
||||
public partial class GENESIS_DISPLAY_TOOL : Form
|
||||
{
|
||||
private void JsonRxData(object sender, EventArgs e)
|
||||
{
|
||||
String JsonDataType = GetJsonDataType();
|
||||
|
||||
#region Definitions and initializations
|
||||
UInt16 MeterNumber = Constants.Meter1;
|
||||
#endregion
|
||||
#region Get meter index
|
||||
if (rB_JsonMeter1.Checked)
|
||||
MeterNumber = Constants.Meter1;
|
||||
if (rB_JsonMeter2.Checked)
|
||||
MeterNumber = Constants.Meter2;
|
||||
if (rB_JsonMeter3.Checked)
|
||||
MeterNumber = Constants.Meter3;
|
||||
#endregion
|
||||
|
||||
if (Int32.Equals(DisplayOnTab, SelectedTab.Json))
|
||||
{
|
||||
try
|
||||
{
|
||||
String Timestamp = DateTime.Now.ToString(Formats.RawDataDateTimeLogString, this.globalCulture);
|
||||
|
||||
#region Decode command
|
||||
WaitForBackgroundWorkers();
|
||||
if (MassLogging)
|
||||
{
|
||||
switch (MeterNumber)
|
||||
{
|
||||
case Constants.Meter1:
|
||||
//Display.TextboxJsonRxData($"{Timestamp} {CommandInterface1.ReplyCommand(RxStringCmd[Meter])}");
|
||||
Display.LabelJsonRead(CommandInterface1.ReplyCommandLabelText(RxStringCmd[MeterNumber]));
|
||||
CommandInterface1.DecodeHighLevelErrors(RxStringCmd[MeterNumber], DisplayOnTab, JsonDataType);
|
||||
break;
|
||||
|
||||
case Constants.Meter2:
|
||||
//Display.TextboxJsonRxData($"{Timestamp} {CommandInterface2.ReplyCommand(RxStringCmd[Meter])}");
|
||||
Display.LabelJsonRead(CommandInterface2.ReplyCommandLabelText(RxStringCmd[MeterNumber]));
|
||||
CommandInterface2.DecodeHighLevelErrors(RxStringCmd[MeterNumber], DisplayOnTab, JsonDataType);
|
||||
break;
|
||||
|
||||
case Constants.Meter3:
|
||||
//Display.TextboxJsonRxData($"{Timestamp} {CommandInterface3.ReplyCommand(RxStringCmd[Meter])}");
|
||||
Display.LabelJsonRead(CommandInterface3.ReplyCommandLabelText(RxStringCmd[MeterNumber]));
|
||||
CommandInterface3.DecodeHighLevelErrors(RxStringCmd[MeterNumber], DisplayOnTab, JsonDataType);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Display.TextboxJsonRxData($"{Timestamp} {CommandInterface1.ReplyCommand(RxStringCmd[Meter])}");
|
||||
Display.LabelJsonRead(CommandInterface1.ReplyCommandLabelText(RxStringCmd[MeterNumber]));
|
||||
CommandInterface1.DecodeHighLevelErrors(RxStringCmd[MeterNumber], DisplayOnTab, JsonDataType);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error: exception
|
||||
ErrorLog.Log(LogErrReason.Exception(), "JsonRxData() failed", $"0x{ex.HResult.ToString("X", this.globalCulture)}", String.Empty);
|
||||
MessageBox.Show("COMMAND CHANNEL RX-Dectection error!", "Form closing", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,506 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,153 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Printing;
|
||||
using ZedGraph;
|
||||
|
||||
namespace GenesisDisplayTool
|
||||
{
|
||||
|
||||
public enum InitialCrcValue { Zeros, NonZero1 = 0xffff, NonZero2 = 0x1D0F }
|
||||
|
||||
public class Crc16Ccitt
|
||||
{
|
||||
const ushort poly = 4129;
|
||||
ushort[] table = new ushort[256];
|
||||
ushort initialValue = 0;
|
||||
|
||||
public ushort ComputeChecksum(byte[] bytes)
|
||||
{
|
||||
ushort crc = this.initialValue;
|
||||
for (int i = 0; i < bytes.Length; ++i)
|
||||
{
|
||||
crc = (ushort)((crc << 8) ^ table[((crc >> 8) ^ (0xff & bytes[i]))]);
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
public byte[] ComputeChecksumBytes(byte[] bytes)
|
||||
{
|
||||
ushort crc = ComputeChecksum(bytes);
|
||||
return BitConverter.GetBytes(crc);
|
||||
}
|
||||
|
||||
public Crc16Ccitt(InitialCrcValue initialValue)
|
||||
{
|
||||
this.initialValue = (ushort)initialValue;
|
||||
ushort temp, a;
|
||||
for (int i = 0; i < table.Length; ++i)
|
||||
{
|
||||
temp = 0;
|
||||
a = (ushort)(i << 8);
|
||||
for (int j = 0; j < 8; ++j)
|
||||
{
|
||||
if (((temp ^ a) & 0x8000) != 0)
|
||||
{
|
||||
temp = (ushort)((temp << 1) ^ poly);
|
||||
}
|
||||
else
|
||||
{
|
||||
temp <<= 1;
|
||||
}
|
||||
a <<= 1;
|
||||
}
|
||||
table[i] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class MyListExtensions
|
||||
{
|
||||
public static double Mean(this List<double> values)
|
||||
{
|
||||
return values.Count == 0 ? 0 : values.Mean(0, values.Count);
|
||||
}
|
||||
|
||||
public static double Mean(this List<double> values, int start, int end)
|
||||
{
|
||||
double s = 0;
|
||||
|
||||
for (int i = start; i < end; i++)
|
||||
{
|
||||
s += values[i];
|
||||
}
|
||||
|
||||
return s / (end - start);
|
||||
}
|
||||
|
||||
public static double Variance(this List<double> values)
|
||||
{
|
||||
return values.Variance(values.Mean(), 0, values.Count);
|
||||
}
|
||||
|
||||
public static double Variance(this List<double> values, double mean)
|
||||
{
|
||||
return values.Variance(mean, 0, values.Count);
|
||||
}
|
||||
|
||||
public static double Variance(this List<double> values, double mean, int start, int end)
|
||||
{
|
||||
double variance = 0;
|
||||
|
||||
for (int i = start; i < end; i++)
|
||||
{
|
||||
variance += (double)Math.Pow((values[i] - mean), 2);
|
||||
}
|
||||
|
||||
int n = end - start;
|
||||
if (start > 0) n -= 1;
|
||||
|
||||
return variance / (n);
|
||||
}
|
||||
|
||||
public static double StandardDeviation(this List<double> values)
|
||||
{
|
||||
return values.Count == 0 ? 0 : values.StandardDeviation(0, values.Count);
|
||||
}
|
||||
|
||||
public static double StandardDeviation(this List<double> values, int start, int end)
|
||||
{
|
||||
double mean = values.Mean(start, end);
|
||||
double variance = values.Variance(mean, start, end);
|
||||
|
||||
return (double)Math.Sqrt(variance);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class HexadecimalEncoding
|
||||
{
|
||||
public static string ToHexString(string str)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
var bytes = Encoding.Unicode.GetBytes(str);
|
||||
foreach (var t in bytes)
|
||||
{
|
||||
sb.Append(t.ToString("X2"));
|
||||
}
|
||||
|
||||
return sb.ToString(); // returns: "48656C6C6F20776F726C64" for "Hello world"
|
||||
}
|
||||
|
||||
public static string FromHexString(string hexString)
|
||||
{
|
||||
var bytes = new byte[hexString.Length / 2];
|
||||
for (var i = 0; i < bytes.Length; i++)
|
||||
{
|
||||
bytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16);
|
||||
}
|
||||
|
||||
return Encoding.Unicode.GetString(bytes); // returns: "Hello world" for "48656C6C6F20776F726C64"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,539 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace GenesisDisplayTool
|
||||
{
|
||||
|
||||
public class MeanCalculate
|
||||
{
|
||||
public static void ResetProcessingListsTof(ref List<List<double>>[] processingTofUpMean, ref List<List<double>>[] processingTofDownMean, ref List<List<double>>[] processingDifTofMean)
|
||||
{
|
||||
for (UInt16 Path = 0; Path < Constants.NumberOfPaths; Path++)
|
||||
{
|
||||
for (UInt16 Hit = 0; Hit < 8; Hit++)
|
||||
{
|
||||
processingTofUpMean[Path][Hit].Clear();
|
||||
processingTofDownMean[Path][Hit].Clear();
|
||||
processingDifTofMean[Path][Hit].Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void ResetProcessingListsMultihitMean(ref List<double> processingThreeHitsMean, ref List<double> processing8HitsMean, ref List<double>[] processingThreeHitsTotalMean, ref List<double>[] processing8HitsTotalMean)
|
||||
{
|
||||
processingThreeHitsMean.Clear();
|
||||
processing8HitsMean.Clear();
|
||||
for (UInt16 Path = 0; Path < Constants.NumberOfPaths; Path++)
|
||||
{
|
||||
processingThreeHitsTotalMean[Path].Clear();
|
||||
processing8HitsTotalMean[Path].Clear();
|
||||
}
|
||||
}
|
||||
public static void ResetProcessingListsOthersMean(ref List<double>[] processingPulsewidthUpMean, ref List<double>[] processingPulsewidthDownMean, ref List<double>[] processingAmplitudeUpMean, ref List<double>[] processingAmplitudeDownMean, ref List<double>[] processingTemperatureMean, ref List<double>[] processingFlowMean )
|
||||
{
|
||||
for (UInt16 Path = 0; Path < 3; Path++)
|
||||
{
|
||||
processingPulsewidthUpMean[Path].Clear();
|
||||
processingPulsewidthDownMean[Path].Clear();
|
||||
processingAmplitudeUpMean[Path].Clear();
|
||||
processingAmplitudeDownMean[Path].Clear();
|
||||
processingTemperatureMean[Path].Clear();
|
||||
processingFlowMean[Path].Clear();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public static void ResetCalculationResults(ref DecodedData[] decoded)
|
||||
{
|
||||
DecodedData[] temp = new DecodedData[3];
|
||||
temp = decoded;
|
||||
|
||||
for (UInt16 Path = 0; Path<3; Path++ )
|
||||
{
|
||||
temp[Path].PulsewidthDownMean = 0;
|
||||
temp[Path].PulsewidthUpMean = 0;
|
||||
temp[Path].AmpDownMean = 0;
|
||||
temp[Path].AmpUpMean = 0;
|
||||
temp[Path].DifTof3HitsMean = 0;
|
||||
temp[Path].DifTof8HitsMean = 0;
|
||||
temp[Path].TemperatureColdMean = 0;
|
||||
temp[Path].TemperatureHotMean = 0;
|
||||
temp[Path].TofSumOfAllDownMean = 0;
|
||||
temp[Path].TofSumOfAllUpMean = 0;
|
||||
temp[Path].DifTof3HitsMean = 0;
|
||||
temp[Path].DifTof8HitsMean = 0;
|
||||
|
||||
|
||||
|
||||
for (UInt16 Hit = 0; Hit<8; Hit++)
|
||||
{
|
||||
temp[Path].TofDownMean[Hit] = 0;
|
||||
temp[Path].TofUpMean[Hit] = 0;
|
||||
temp[Path].DifTofMean[Hit] = 0;
|
||||
}
|
||||
|
||||
}
|
||||
decoded = temp;
|
||||
}
|
||||
public static void ResetCounters(ref UInt16[] telegramCounterTofMean, ref UInt16[] telegramCounterDifTofMean, ref UInt16[] telegramCounterMultiHitMean, ref UInt16[] telegramCounterOthersMean, ref UInt16[] telegramCounterTemperatureMean, ref UInt16[] telegramCounterFlowMean)
|
||||
{
|
||||
for (UInt16 Path = 0; Path < 3; Path++)
|
||||
{
|
||||
telegramCounterTofMean[Path] = 0;
|
||||
telegramCounterDifTofMean[Path] = 0;
|
||||
telegramCounterMultiHitMean[Path] = 0;
|
||||
telegramCounterOthersMean[Path] = 0;
|
||||
telegramCounterTemperatureMean[Path] = 0;
|
||||
telegramCounterFlowMean[Path] = 0;
|
||||
|
||||
}
|
||||
}
|
||||
public static DecodedData[] Tof(UInt16 inputPath, DecodedData[] inputData, ref UInt16[] telegramCounterTofMean, ref List<List<double>>[] processingTofUpMean, ref List<List<double>>[] processingTofDownMean, UInt16 numberOfValues)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
#region Initial filling
|
||||
if (telegramCounterTofMean[inputPath] < numberOfValues)
|
||||
{
|
||||
#region Add values
|
||||
for (UInt16 Hit = 0; Hit < 8; Hit++)
|
||||
{
|
||||
processingTofUpMean[inputPath][Hit].Add(inputData[inputPath].TofUp[Hit]);
|
||||
processingTofDownMean[inputPath][Hit].Add(inputData[inputPath].TofDown[Hit]);
|
||||
}
|
||||
#endregion
|
||||
#region Calculate first value
|
||||
if(telegramCounterTofMean[inputPath] == numberOfValues-1)
|
||||
{
|
||||
for(UInt16 Hit = 0; Hit< 8; Hit++)
|
||||
{
|
||||
#region Calculate values
|
||||
inputData[inputPath].TofUpMean[Hit] = processingTofUpMean[inputPath][Hit].Mean();
|
||||
inputData[inputPath].TofDownMean[Hit] = processingTofDownMean[inputPath][Hit].Mean();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Counter
|
||||
telegramCounterTofMean[inputPath]++;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region Moving average
|
||||
else
|
||||
{
|
||||
#region Prepare data and calculate
|
||||
for (UInt16 Hit = 0; Hit < 8; Hit++)
|
||||
{
|
||||
#region Remove first element
|
||||
processingTofUpMean[inputPath][Hit].RemoveAt(0);
|
||||
processingTofDownMean[inputPath][Hit].RemoveAt(0);
|
||||
#endregion
|
||||
#region Add last element
|
||||
processingTofUpMean[inputPath][Hit].Add(inputData[inputPath].TofUp[Hit]);
|
||||
processingTofDownMean[inputPath][Hit].Add(inputData[inputPath].TofUp[Hit]);
|
||||
#endregion
|
||||
#region Calculate values
|
||||
inputData[inputPath].TofUpMean[Hit] = processingTofUpMean[inputPath][Hit].Mean();
|
||||
inputData[inputPath].TofDownMean[Hit] = processingTofDownMean[inputPath][Hit].Mean();
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "MeanCalculate.Tof() failed", "0x" + ex.HResult.ToString("X"), inputPath.ToString());
|
||||
#endregion
|
||||
}
|
||||
#region Return data
|
||||
return inputData;
|
||||
#endregion
|
||||
}
|
||||
public static DecodedData[] DifTof(UInt16 inputPath, DecodedData[] inputData, ref UInt16[] telegramCounterDifTofMean, ref List<List<double>>[] processingListDifTofMean, UInt16 numberOfValues)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
#region Initial fill
|
||||
if (telegramCounterDifTofMean[inputPath] < numberOfValues)
|
||||
{
|
||||
#region Fill list
|
||||
for (UInt16 Hit = 0; Hit < 8; Hit++)
|
||||
processingListDifTofMean[inputPath][Hit].Add(inputData[inputPath].DifTof[Hit]);
|
||||
#endregion
|
||||
#region Calculate first value
|
||||
if (telegramCounterDifTofMean[inputPath] == numberOfValues - 1)
|
||||
{
|
||||
for(UInt16 Hit = 0; Hit < 8; Hit++)
|
||||
inputData[inputPath].DifTofMean[Hit] = processingListDifTofMean[inputPath][Hit].Mean();
|
||||
}
|
||||
#endregion
|
||||
#region Counter
|
||||
telegramCounterDifTofMean[inputPath]++;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region Moving average
|
||||
else
|
||||
{
|
||||
for (UInt16 Hit = 0; Hit < 8; Hit++)
|
||||
{
|
||||
#region Remove first element
|
||||
processingListDifTofMean[inputPath][Hit].RemoveAt(0);
|
||||
#endregion
|
||||
#region Add last element
|
||||
processingListDifTofMean[inputPath][Hit].Add(inputData[inputPath].DifTof[Hit]);
|
||||
#endregion
|
||||
#region Calculate values
|
||||
inputData[inputPath].DifTofMean[Hit] = processingListDifTofMean[inputPath][Hit].Mean();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "MeanCalculate.DifTof() failed", "0x" + ex.HResult.ToString("X"), "Path= " + inputPath.ToString());
|
||||
#endregion
|
||||
}
|
||||
#region Return data
|
||||
return inputData;
|
||||
#endregion
|
||||
}
|
||||
public static DecodedData[] Multihit(UInt16 inputPath, DecodedData[] inputData, ref UInt16[] telegramCounterfMultihitMean, ref List<double>[] processingThreeHitsTotal, ref List<double> processingThreeHits, ref List<double>[] processingEightHitsTotal, ref List<double> processingEightHits, UInt16 numberOfValues)
|
||||
{
|
||||
// try
|
||||
// {
|
||||
#region Definitions and initializations
|
||||
double[] ThreeHitsMean = new double[3] { 0, 0, 0 }; // Mean Value over first three hits
|
||||
double[] ThreeHitsTotalMean = new double[3] { 0, 0, 0 }; // Mean Value over N mean values of first three hits
|
||||
double[] EightHitsMean = new double[3] { 0, 0, 0 }; // Mean Value over first three hits
|
||||
double[] EightHitsTotalMean = new double[3] { 0, 0, 0 };
|
||||
#endregion
|
||||
#region Prepare input values
|
||||
#region Fill first three hits
|
||||
processingThreeHits.Add(inputData[inputPath].DifTof[Constants.HIT0]);
|
||||
processingThreeHits.Add(inputData[inputPath].DifTof[Constants.HIT1]);
|
||||
processingThreeHits.Add(inputData[inputPath].DifTof[Constants.HIT2]);
|
||||
#endregion
|
||||
#region Fill first eight hits
|
||||
for (UInt16 Hit = 0; Hit < 8; Hit++)
|
||||
processingEightHits.Add(inputData[inputPath].DifTof[Hit]);
|
||||
#endregion
|
||||
#region Obtain mean value
|
||||
ThreeHitsMean[inputPath] = processingThreeHits.Mean();
|
||||
processingThreeHits.Clear();
|
||||
EightHitsMean[inputPath] = processingEightHits.Mean();
|
||||
processingEightHits.Clear();
|
||||
#endregion
|
||||
#endregion
|
||||
#region Initial filling
|
||||
if (telegramCounterfMultihitMean[inputPath] < numberOfValues)
|
||||
{
|
||||
#region Three/ eight hits
|
||||
processingThreeHitsTotal[inputPath].Add(ThreeHitsMean[inputPath]);
|
||||
processingEightHitsTotal[inputPath].Add(EightHitsMean[inputPath]);
|
||||
#endregion
|
||||
#region First calculation
|
||||
if (telegramCounterfMultihitMean[inputPath] == numberOfValues - 1)
|
||||
{
|
||||
#region Calculate values
|
||||
ThreeHitsTotalMean[inputPath] = processingThreeHitsTotal[inputPath].Mean();
|
||||
EightHitsTotalMean[inputPath] = processingEightHitsTotal[inputPath].Mean();
|
||||
#endregion
|
||||
#region Assign to global data object
|
||||
inputData[inputPath].DifTof3HitsMean = ThreeHitsTotalMean[inputPath];
|
||||
inputData[inputPath].DifTof8HitsMean = EightHitsTotalMean[inputPath];
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region Counter
|
||||
telegramCounterfMultihitMean[inputPath]++;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region Moving average
|
||||
else
|
||||
{
|
||||
#region Remove first element
|
||||
processingThreeHitsTotal[inputPath].RemoveAt(0);
|
||||
processingEightHitsTotal[inputPath].RemoveAt(0);
|
||||
#endregion
|
||||
#region Add last element
|
||||
processingThreeHitsTotal[inputPath].Add(ThreeHitsMean[inputPath]);
|
||||
processingEightHitsTotal[inputPath].Add(EightHitsMean[inputPath]);
|
||||
#endregion
|
||||
#region Calculate values
|
||||
ThreeHitsTotalMean[inputPath] = processingThreeHitsTotal[inputPath].Mean();
|
||||
EightHitsTotalMean[inputPath] = processingEightHitsTotal[inputPath].Mean();
|
||||
#endregion
|
||||
#region Assign to global data object
|
||||
inputData[inputPath].DifTof3HitsMean = ThreeHitsTotalMean[inputPath];
|
||||
inputData[inputPath].DifTof8HitsMean = EightHitsTotalMean[inputPath];
|
||||
#endregion
|
||||
|
||||
}
|
||||
#endregion
|
||||
/* }
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "MeanCalculate.Multihit() failed", "0x" + ex.HResult.ToString("X"), "Path= " + inputPath.ToString());
|
||||
#endregion
|
||||
}*/
|
||||
#region Return data
|
||||
return inputData;
|
||||
#endregion
|
||||
|
||||
}
|
||||
public static DecodedData[] MultihitNoOverallAvg(UInt16 inputPath, DecodedData[] inputData)
|
||||
{
|
||||
try
|
||||
{
|
||||
#region Definitions and initializations
|
||||
double[] ThreeHitsMean = new double[3] { 0, 0, 0 }; // Mean Value over first three hits
|
||||
double[] EightHitsMean = new double[3] { 0, 0, 0 };
|
||||
List<double> ProcessingThreeHits = new List<double>();
|
||||
List<double> ProcessingEightHits = new List<double>();
|
||||
#endregion
|
||||
#region Fill first three hits
|
||||
ProcessingThreeHits.Add(inputData[inputPath].DifTof[Constants.HIT0]);
|
||||
ProcessingThreeHits.Add(inputData[inputPath].DifTof[Constants.HIT1]);
|
||||
ProcessingThreeHits.Add(inputData[inputPath].DifTof[Constants.HIT2]);
|
||||
#endregion
|
||||
#region Fill first eight hits
|
||||
for (UInt16 Hit = 0; Hit < 8; Hit++)
|
||||
ProcessingEightHits.Add(inputData[inputPath].DifTof[Hit]);
|
||||
#endregion
|
||||
#region Obtain mean value
|
||||
ThreeHitsMean[inputPath] = ProcessingThreeHits.Mean();
|
||||
ProcessingThreeHits.Clear();
|
||||
EightHitsMean[inputPath] = ProcessingEightHits.Mean();
|
||||
ProcessingEightHits.Clear();
|
||||
#endregion
|
||||
#region Assign to global data object
|
||||
inputData[inputPath].DifTof3HitsMean = ThreeHitsMean[inputPath];
|
||||
inputData[inputPath].DifTof8HitsMean = EightHitsMean[inputPath];
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "MeanCalculate.MultihitNoOverallAvg() failed", "0x" + ex.HResult.ToString("X"), "Path= " + inputPath.ToString());
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Return data
|
||||
return inputData;
|
||||
#endregion
|
||||
|
||||
}
|
||||
public static DecodedData[] Others(UInt16 inputPath, DecodedData[] inputData, ref UInt16[] telegramCounterOthersMean, ref List<double>[] processingPulsewidthUpMean, ref List<double>[] processingAmplitudeUpMean, ref List<double>[] processingPulsewidthDownMean, ref List<double>[] processingAmplitudeDownMean, UInt16 numberOfValues)
|
||||
{
|
||||
try
|
||||
{
|
||||
#region Definitions and initializations
|
||||
double[] PulsewidthUpMean = new double[3];
|
||||
double[] PulsewidthDownMean = new double[3];
|
||||
double[] AmplitudeUpMean = new double[3];
|
||||
double[] AmplitudeDownMean = new double[3];
|
||||
#endregion
|
||||
#region Initial filling
|
||||
if (telegramCounterOthersMean[inputPath] < numberOfValues)
|
||||
{
|
||||
#region Pulsewidth/ amplitude up
|
||||
processingPulsewidthUpMean[inputPath].Add(inputData[inputPath].PulsewidthUp);
|
||||
processingAmplitudeUpMean[inputPath].Add(inputData[inputPath].AmpUpCalculated);
|
||||
#endregion
|
||||
#region Pulsewidth/ amplitude down
|
||||
processingPulsewidthDownMean[inputPath].Add(inputData[inputPath].PulsewidthDown);
|
||||
processingAmplitudeDownMean[inputPath].Add(inputData[inputPath].AmpDownCalculated);
|
||||
#endregion
|
||||
#region First calculation
|
||||
if (telegramCounterOthersMean[inputPath] == numberOfValues - 1)
|
||||
{
|
||||
#region Calculate values
|
||||
PulsewidthUpMean[inputPath] = processingPulsewidthUpMean[inputPath].Mean();
|
||||
AmplitudeUpMean[inputPath] = processingAmplitudeUpMean[inputPath].Mean();
|
||||
PulsewidthDownMean[inputPath] = processingPulsewidthDownMean[inputPath].Mean();
|
||||
AmplitudeDownMean[inputPath] = processingAmplitudeDownMean[inputPath].Mean();
|
||||
#endregion
|
||||
#region Assign to global object
|
||||
inputData[inputPath].PulsewidthUpMean = PulsewidthUpMean[inputPath];
|
||||
inputData[inputPath].AmpUpMean = AmplitudeUpMean[inputPath];
|
||||
inputData[inputPath].PulsewidthDownMean = PulsewidthDownMean[inputPath];
|
||||
inputData[inputPath].AmpDownMean = AmplitudeDownMean[inputPath];
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region Counter
|
||||
telegramCounterOthersMean[inputPath]++;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region Moving average
|
||||
else
|
||||
{
|
||||
#region Remove first element
|
||||
processingPulsewidthUpMean[inputPath].RemoveAt(0);
|
||||
processingAmplitudeUpMean[inputPath].RemoveAt(0);
|
||||
processingPulsewidthDownMean[inputPath].RemoveAt(0);
|
||||
processingAmplitudeDownMean[inputPath].RemoveAt(0);
|
||||
#endregion
|
||||
#region Add last element
|
||||
processingPulsewidthUpMean[inputPath].Add(inputData[inputPath].PulsewidthUp);
|
||||
processingAmplitudeUpMean[inputPath].Add(inputData[inputPath].AmpUpCalculated);
|
||||
processingPulsewidthDownMean[inputPath].Add(inputData[inputPath].PulsewidthDown);
|
||||
processingAmplitudeDownMean[inputPath].Add(inputData[inputPath].AmpDownCalculated);
|
||||
#endregion
|
||||
#region Calculate values
|
||||
PulsewidthUpMean[inputPath] = processingPulsewidthUpMean[inputPath].Mean();
|
||||
AmplitudeUpMean[inputPath] = processingAmplitudeUpMean[inputPath].Mean();
|
||||
PulsewidthDownMean[inputPath] = processingPulsewidthDownMean[inputPath].Mean();
|
||||
AmplitudeDownMean[inputPath] = processingAmplitudeDownMean[inputPath].Mean();
|
||||
#endregion
|
||||
#region Assign to global data object
|
||||
inputData[inputPath].PulsewidthUpMean = PulsewidthUpMean[inputPath];
|
||||
inputData[inputPath].AmpUpMean = AmplitudeUpMean[inputPath];
|
||||
inputData[inputPath].PulsewidthDownMean = PulsewidthDownMean[inputPath];
|
||||
inputData[inputPath].AmpDownMean = AmplitudeDownMean[inputPath];
|
||||
#endregion
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "MeanCalculate.Others() failed", "0x" + ex.HResult.ToString("X"), "Path= " + inputPath.ToString());
|
||||
#endregion
|
||||
}
|
||||
#region Return data
|
||||
return inputData;
|
||||
#endregion
|
||||
|
||||
}
|
||||
public static double Temperature(UInt16 inputPath, double[] temperatureCold, ref UInt16[] telegramCounterTemperatureMean, ref List<double>[] processingTemperatureMean, UInt16 numberOfValues)
|
||||
{
|
||||
#region Definitions and initializations
|
||||
double TemperatureColdMean = 0;
|
||||
#endregion
|
||||
|
||||
try
|
||||
{
|
||||
#region Initial fill
|
||||
if (telegramCounterTemperatureMean[inputPath] < numberOfValues)
|
||||
{
|
||||
#region Copy data to list
|
||||
processingTemperatureMean[inputPath].Add(temperatureCold[inputPath]);
|
||||
#endregion
|
||||
#region First calculation
|
||||
if(telegramCounterTemperatureMean[inputPath] == numberOfValues-1)
|
||||
{
|
||||
#region Calculate values
|
||||
TemperatureColdMean = processingTemperatureMean[inputPath].Mean();
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region Counter
|
||||
telegramCounterTemperatureMean[inputPath]++;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region Moving average
|
||||
else
|
||||
{
|
||||
#region Remove first element
|
||||
processingTemperatureMean[inputPath].RemoveAt(0);
|
||||
#endregion
|
||||
#region Add last element
|
||||
processingTemperatureMean[inputPath].Add(temperatureCold[inputPath]);
|
||||
#endregion
|
||||
#region Calculate values
|
||||
TemperatureColdMean = processingTemperatureMean[inputPath].Mean();
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "MeanCalculate.Temperature() failed", "0x" + ex.HResult.ToString("X"), "Path= " + inputPath.ToString());
|
||||
#endregion
|
||||
}
|
||||
#region Return data
|
||||
return TemperatureColdMean;
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static DecodedData[] Flow(UInt16 inputPath, DecodedData[] inputDataFlowMean, ref UInt16[] telegramCounterFlowMean, ref List<double>[] processingFlowMean, UInt16 numberOfValues)
|
||||
{
|
||||
#region Definitions and initializations
|
||||
double[] FlowMean = new double[3];
|
||||
#endregion
|
||||
|
||||
try
|
||||
{
|
||||
#region Initial fill
|
||||
if (telegramCounterFlowMean[inputPath] < numberOfValues)
|
||||
{
|
||||
#region Copy data to list
|
||||
processingFlowMean[inputPath].Add(inputDataFlowMean[inputPath].Flow);
|
||||
#endregion
|
||||
#region First calculation
|
||||
if (telegramCounterFlowMean[inputPath] == numberOfValues - 1)
|
||||
{
|
||||
#region Calculate values
|
||||
FlowMean[inputPath] = processingFlowMean[inputPath].Mean();
|
||||
#endregion
|
||||
#region Assign to global object
|
||||
inputDataFlowMean[inputPath].FlowMean = FlowMean[inputPath];
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region Counter
|
||||
telegramCounterFlowMean[inputPath]++;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region Moving average
|
||||
else
|
||||
{
|
||||
#region Remove first element
|
||||
processingFlowMean[inputPath].RemoveAt(0);
|
||||
#endregion
|
||||
#region Add last element
|
||||
processingFlowMean[inputPath].Add(inputDataFlowMean[inputPath].Flow);
|
||||
#endregion
|
||||
#region Calculate values
|
||||
FlowMean[inputPath] = processingFlowMean[inputPath].Mean();
|
||||
#endregion
|
||||
#region Assign to global object
|
||||
inputDataFlowMean[inputPath].FlowMean = FlowMean[inputPath];
|
||||
#endregion
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "MeanCalculate.Flow() failed", "0x" + ex.HResult.ToString("X"), "Path= " + inputPath.ToString());
|
||||
#endregion
|
||||
}
|
||||
#region Return data
|
||||
return inputDataFlowMean;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
@@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Printing;
|
||||
using ZedGraph;
|
||||
|
||||
namespace GenesisDisplayTool
|
||||
{
|
||||
|
||||
public partial class GENESIS_DISPLAY_TOOL : Form
|
||||
{
|
||||
|
||||
public void WaitForBackgroundWorkers()
|
||||
{
|
||||
while
|
||||
(
|
||||
backgroundWorkerTofMean.IsBusy || backgroundWorkerTofMean2.IsBusy || backgroundWorkerTofMean3.IsBusy || backgroundWorkerTofMean4.IsBusy || backgroundWorkerTofMean5.IsBusy || backgroundWorkerTofMean6.IsBusy ||
|
||||
backgroundDifTofMean.IsBusy || backgroundDifTofMean2.IsBusy || backgroundDifTofMean3.IsBusy || backgroundDifTofMean4.IsBusy || backgroundDifTofMean5.IsBusy || backgroundDifTofMean6.IsBusy||
|
||||
backgroundWorkerMultiHitMean.IsBusy || backgroundWorkerMultiHitMean2.IsBusy || backgroundWorkerMultiHitMean3.IsBusy || backgroundWorkerMultiHitMean4.IsBusy || backgroundWorkerMultiHitMean5.IsBusy || backgroundWorkerMultiHitMean6.IsBusy||
|
||||
backgroundStdDev.IsBusy || backgroundStdDev2.IsBusy || backgroundStdDev3.IsBusy || backgroundStdDev4.IsBusy || backgroundStdDev5.IsBusy || backgroundStdDev6.IsBusy||
|
||||
backgroundFlow1.IsBusy || backgroundFlow2.IsBusy || backgroundFlow3.IsBusy || backgroundFlow4.IsBusy || backgroundFlow5.IsBusy || backgroundFlow6.IsBusy
|
||||
)
|
||||
Misc.WaitCondition(true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public static partial class Misc
|
||||
{
|
||||
public static void GarbageCollector(ref int counter)
|
||||
{
|
||||
#region Garbage collector
|
||||
/*
|
||||
counter++;
|
||||
if (counter == 1000)
|
||||
{
|
||||
GC.Collect();
|
||||
counter = 0;
|
||||
}*/
|
||||
#endregion
|
||||
}
|
||||
public static bool OnlyDecimalInString(string data)
|
||||
{
|
||||
return (System.Text.RegularExpressions.Regex.IsMatch(data, @"^[0-9]+(\.[0-9]+)?$"));
|
||||
}
|
||||
|
||||
public static bool OnlyHexInString(string data)
|
||||
{
|
||||
// For C-style hex notation (0xFF) you can use @"\A\b(0[xX])?[0-9a-fA-F]+\b\Z"
|
||||
return System.Text.RegularExpressions.Regex.IsMatch(data, @"\A\b[0-9a-fA-F]+\b\Z");
|
||||
}
|
||||
|
||||
|
||||
public static void WaitCondition(bool condition)
|
||||
{
|
||||
if(condition)
|
||||
Application.DoEvents();
|
||||
}
|
||||
|
||||
|
||||
public static void WaitNSeconds(int seconds)
|
||||
{
|
||||
if (seconds < 1) return;
|
||||
DateTime _desired = DateTime.Now.AddSeconds(seconds);
|
||||
while (DateTime.Now < _desired)
|
||||
{
|
||||
Application.DoEvents();
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
public static void WaitNMilliseconds(int milliseconds)
|
||||
{
|
||||
if (milliseconds < 1) return;
|
||||
DateTime _desired = DateTime.Now.AddMilliseconds(milliseconds);
|
||||
while (DateTime.Now < _desired)
|
||||
{
|
||||
Application.DoEvents();
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void ContextMenuBuilderEventHandler(
|
||||
ZedGraphControl control,
|
||||
ContextMenuStrip menuStrip,
|
||||
Point mousePt,
|
||||
ZedGraphControl.ContextMenuObjectState objState);
|
||||
|
||||
|
||||
public static void MyContextMenuBuilder(ZedGraphControl control, ContextMenuStrip menuStrip, Point mousePt, ZedGraphControl.ContextMenuObjectState objState)
|
||||
{
|
||||
foreach (ToolStripMenuItem item in menuStrip.Items)
|
||||
{
|
||||
if ((string)item.Tag == "save_as")
|
||||
{
|
||||
// remove the menu item
|
||||
menuStrip.Items.Remove(item);
|
||||
// or, just disable the item with this
|
||||
//item.Enabled = false;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (ToolStripMenuItem item in menuStrip.Items)
|
||||
{
|
||||
if ((string)item.Tag == "set_default")
|
||||
{
|
||||
// remove the menu item
|
||||
menuStrip.Items.Remove(item);
|
||||
// or, just disable the item with this
|
||||
//item.Enabled = false;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.IO.Ports; // sr
|
||||
using System.Text; // sr
|
||||
using System.Threading;
|
||||
using System.Reflection;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace GenesisDisplayTool
|
||||
{
|
||||
|
||||
|
||||
static class Program
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Der Haupteinstiegspunkt für die Anwendung.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
|
||||
static void Main()
|
||||
{
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new GENESIS_DISPLAY_TOOL());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
// die einer Assembly zugeordnet sind.
|
||||
[assembly: AssemblyTitle("GenesisDisplayTool")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Sensus GmbH Hannover")]
|
||||
[assembly: AssemblyProduct("GenesisDisplayTool")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
|
||||
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
|
||||
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
|
||||
[assembly: Guid("38be240b-8153-47da-9f0d-81cbb5ce649f")]
|
||||
|
||||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
//
|
||||
// Hauptversion
|
||||
// Nebenversion
|
||||
// Buildnummer
|
||||
// Revision
|
||||
//
|
||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||
// übernehmen, indem Sie "*" eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace GenesisDisplayTool.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GenesisDisplayTool.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace GenesisDisplayTool.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,344 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Printing;
|
||||
using ZedGraph;
|
||||
using System.IO;
|
||||
|
||||
namespace GenesisDisplayTool
|
||||
{
|
||||
public static partial class RawData
|
||||
{
|
||||
public static void DisplayText(String timestamp, String data, CultureInfo culture)
|
||||
{
|
||||
if (GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.InvokeRequired)
|
||||
{
|
||||
GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.Invoke((Action<String, String, CultureInfo>)DisplayText, timestamp, data, culture);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
#region Display in textbox
|
||||
if (!String.IsNullOrEmpty(data))
|
||||
{
|
||||
GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.rtB_RawData_RxData.AppendText($"{data}");
|
||||
GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.rtB_RawData_RxData.ScrollToCaret();
|
||||
if (GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.rtB_RawData_RxData.Text.Length > GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.nUD_Settings_RxDataAutoclear.Value)
|
||||
GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.rtB_RawData_RxData.Clear();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), "RawData.DisplayText() failed", $"0x{ex.HResult.ToString("X", culture)}", "first try/catch (Display in textbox)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
public static void SaveText(String savePath, String timestamp, Boolean loggingEnable, String data, Int32 cyclesToStorage, CultureInfo culture)
|
||||
{
|
||||
|
||||
String _data = data;
|
||||
|
||||
|
||||
#region Save raw data
|
||||
if (Boolean.Equals(loggingEnable, true))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!String.IsNullOrEmpty(_data))
|
||||
{
|
||||
var temp = $"{ timestamp}{ _data}";
|
||||
// if (GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.RawDataToLogCounter > cyclesToStorage)
|
||||
// {
|
||||
Task.Run(() =>
|
||||
{
|
||||
using (StreamWriter sw = File.AppendText(@savePath))
|
||||
{
|
||||
sw.Write(temp);
|
||||
}
|
||||
});
|
||||
GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.SetRawDataToLogCounter(0);
|
||||
// }
|
||||
// else
|
||||
// GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.RawDataToLogCounter++;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), "RawData.SaveText() failed", $"0x{ex.HResult.ToString("X", culture)}", "second try/catch (save raw data)");
|
||||
GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.SetRawLoggingSingleMeterEnable(false);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void DisplayAndSaveRawMeter1(String rxStringDataChannel, String saveDataPathRawMeter1, String timestamp, Int32 autoclear, ref Boolean loggingEnable, ref String dataToLog, Int32 cyclesToStorage)
|
||||
{
|
||||
CultureInfo culture = GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetGlobalCulture();
|
||||
|
||||
try
|
||||
{
|
||||
#region Display in label
|
||||
String display = String.Empty;
|
||||
if (rxStringDataChannel.Count() > 20)
|
||||
display = $"{ rxStringDataChannel.Substring(0, 20)} [...]";
|
||||
else
|
||||
display = rxStringDataChannel;
|
||||
|
||||
GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.l_RawDataMeter1.Text = display;
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), "RawData.DisplayAndSaveRawMeter1() failed", $"0x{ex.HResult.ToString("X", culture)}", String.Empty);
|
||||
return;
|
||||
}
|
||||
|
||||
#region Save raw data
|
||||
if (loggingEnable == true) //LoggingRawEn
|
||||
{
|
||||
try
|
||||
{
|
||||
rxStringDataChannel = rxStringDataChannel.Replace("\n", String.Empty);
|
||||
dataToLog = dataToLog + timestamp + rxStringDataChannel + "\r\n";
|
||||
if (GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetRawDataToLogCounterMeter1() > cyclesToStorage)
|
||||
{
|
||||
String temp = dataToLog;
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
using (StreamWriter sw = File.AppendText(@saveDataPathRawMeter1))
|
||||
{
|
||||
sw.Write(temp);
|
||||
}
|
||||
});
|
||||
dataToLog = String.Empty;
|
||||
GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.SetRawDataToLogCounterMeter1(0);
|
||||
}
|
||||
else
|
||||
GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.SetRawDataToLogCounterMeter1(GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetRawDataToLogCounterMeter1() + 1);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), "RawData.DisplayAndSaveRawMeter1() failed", $"0x{ex.HResult.ToString("X", GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetGlobalCulture())}", "second try/catch (save raw data)");
|
||||
loggingEnable = false; // LoggingRawEn = false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static void DisplayAndSaveRawMeter2(String rxStringDataChannel, String saveDataPathRawMeter2, String timestamp, Int32 autoclear, ref Boolean loggingEnable, ref String dataToLog, Int32 cyclesToStorage)
|
||||
{
|
||||
try
|
||||
{
|
||||
#region Display in label
|
||||
String display = String.Empty;
|
||||
if (rxStringDataChannel.Count() > 20)
|
||||
display = $"{rxStringDataChannel.Substring(0, 20)} [...]";
|
||||
else
|
||||
display = rxStringDataChannel;
|
||||
|
||||
GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.l_RawDataMeter2.Text = display;
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), "RawData.DisplayAndSaveRawMeter2() failed", $"0x{ex.HResult.ToString("X", GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetGlobalCulture())}", String.Empty);
|
||||
return;
|
||||
}
|
||||
|
||||
#region Save raw data
|
||||
if (loggingEnable == true) //LoggingRawEn
|
||||
{
|
||||
try
|
||||
{
|
||||
rxStringDataChannel = rxStringDataChannel.Replace("\n", String.Empty);
|
||||
dataToLog = $"{dataToLog}{timestamp + rxStringDataChannel}\r\n";
|
||||
if (GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetRawDataToLogCounterMeter2() > cyclesToStorage)
|
||||
{
|
||||
|
||||
String temp = dataToLog;
|
||||
Task.Run(() =>
|
||||
{
|
||||
using (StreamWriter sw = File.AppendText(@saveDataPathRawMeter2))
|
||||
{
|
||||
sw.Write(temp);
|
||||
}
|
||||
});
|
||||
dataToLog = String.Empty;
|
||||
GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.SetRawDataToLogCounterMeter2(0);
|
||||
}
|
||||
else
|
||||
GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.SetRawDataToLogCounterMeter2(GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetRawDataToLogCounterMeter2() + 1);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), "RawData.DisplayAndSaveRawMeter2() failed", $"0x{ex.HResult.ToString("X", GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetGlobalCulture())}", "second try/catch (save raw data)");
|
||||
loggingEnable = false; // LoggingRawEn = false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static void DisplayAndSaveRawMeter3(String rxStringDataChannel, String saveDataPathRawMeter3, String timestamp, Int32 autoclear, ref Boolean loggingEnable, ref String dataToLog, Int32 cyclesToStorage)
|
||||
{
|
||||
try
|
||||
{
|
||||
#region Display in label
|
||||
String display = String.Empty;
|
||||
if (rxStringDataChannel.Count() > 20)
|
||||
display = $"{rxStringDataChannel.Substring(0, 20)} [...]";
|
||||
else
|
||||
display = rxStringDataChannel;
|
||||
|
||||
GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.l_RawDataMeter3.Text = display;
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), "RawData.DisplayAndSaveRawMeter3() failed", $"0x{ex.HResult.ToString("X")}", String.Empty);
|
||||
return;
|
||||
}
|
||||
|
||||
#region Save raw data
|
||||
if (loggingEnable == true) //LoggingRawEn
|
||||
{
|
||||
try
|
||||
{
|
||||
rxStringDataChannel = rxStringDataChannel.Replace("\n", String.Empty);
|
||||
dataToLog = dataToLog + timestamp + rxStringDataChannel + "\r\n";
|
||||
if (GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetRawDataToLogCounterMeter3() > cyclesToStorage)
|
||||
{
|
||||
|
||||
String temp = dataToLog;
|
||||
Task.Run(() =>
|
||||
{
|
||||
using (StreamWriter sw = File.AppendText(@saveDataPathRawMeter3))
|
||||
{
|
||||
sw.Write(temp);
|
||||
}
|
||||
});
|
||||
dataToLog = String.Empty;
|
||||
GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.SetRawDataToLogCounterMeter3(0);
|
||||
}
|
||||
else
|
||||
GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.SetRawDataToLogCounterMeter3(GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetRawDataToLogCounterMeter3() + 1);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), "RawData.DisplayAndSaveRawMeter3() failed", $"0x{ex.HResult.ToString("X", GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetGlobalCulture())}", "second try/catch (save raw data)");
|
||||
loggingEnable = false; // LoggingRawEn = false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static void Print(String inputText, Boolean setHeader, PrintDocument docToPrint, Int32 hMargin, Int32 vMargin)
|
||||
{
|
||||
#region Header
|
||||
String PrintHeader0 = "------------------------------SENSUS Hannover GmbH-----------------------------------\n\n";
|
||||
String PrintHeader1 = $" {GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.l_About_Version.Text}\n";
|
||||
String PrintHeader2 = $" {GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.l_About_Author.Text}\n";
|
||||
String PrintHeader3 = DateTime.Now.ToString(" yyyy-MM-dd/ HH:mm:ss\n");
|
||||
String PrintHeader4 = " The content of the raw data-window is shown \n";
|
||||
String PrintHeader5 = "--------------------------------------------------------------------------------------------------\n\n";
|
||||
String PrintHeader = String.Empty;
|
||||
if (setHeader)
|
||||
PrintHeader = $"{PrintHeader0}{PrintHeader1}{PrintHeader2}{PrintHeader3}{PrintHeader4}{PrintHeader5}";
|
||||
#endregion
|
||||
#region Print dialog
|
||||
PrintDocument DocToPrint = new PrintDocument();
|
||||
PrintDialog PrintDialog1 = new PrintDialog();
|
||||
|
||||
PrintDialog1.AllowSomePages = true;
|
||||
PrintDialog1.ShowHelp = true;
|
||||
PrintDialog1.Document = DocToPrint;
|
||||
DialogResult Result = PrintDialog1.ShowDialog();
|
||||
#endregion
|
||||
#region Print settings
|
||||
DocToPrint.PrintPage += delegate (object sender1, PrintPageEventArgs e1)
|
||||
{
|
||||
// e1.Graphics.DrawString(PrintHeader+RxDataBox.Text, new Font("Times New Roman", 12), new SolidBrush(Color.Black), new RectangleF(0, 0, docToPrint.DefaultPageSettings.PrintableArea.Width, docToPrint.DefaultPageSettings.PrintableArea.Height));
|
||||
e1.Graphics.DrawString(PrintHeader + inputText, new Font("Times New Roman", 12), new SolidBrush(Color.Black), new RectangleF(hMargin, vMargin, docToPrint.DefaultPageSettings.PrintableArea.Width, docToPrint.DefaultPageSettings.PrintableArea.Height));
|
||||
};
|
||||
#endregion
|
||||
#region Perform printing
|
||||
if (Result == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
DocToPrint.Print();
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), "RawData.Print() failed", $"0x{ex.HResult.ToString("X", GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetGlobalCulture())}", String.Empty);
|
||||
MessageBox.Show("Printing Error", "Form closing", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static RichTextBox SetTextbox(String RxString, Int32 clearval)
|
||||
{
|
||||
RichTextBox Textbox = new RichTextBox();
|
||||
try
|
||||
{
|
||||
#region Display in textbox
|
||||
Textbox.AppendText(RxString);
|
||||
Textbox.ScrollToCaret();
|
||||
if (Textbox.Text.Length > clearval) // nUD_Settings_RxDataAutoclear.Value
|
||||
Textbox.Clear();
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), "SetTextbox() failed", $"0x{ex.HResult.ToString("X", GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetGlobalCulture())}", "first try/catch (Display in textbox)");
|
||||
}
|
||||
return Textbox;
|
||||
}
|
||||
|
||||
public static void Log(String RxString, DecodedData[] decoded, String saveDataPathRaw, ref Boolean loggingRawEn)
|
||||
{
|
||||
#region Save raw data
|
||||
if (loggingRawEn) // LoggingRawEn
|
||||
{
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
try
|
||||
{
|
||||
using (StreamWriter sw = File.AppendText(@saveDataPathRaw))
|
||||
{
|
||||
RxString = RxString.Replace("\n", String.Empty);
|
||||
sw.WriteLine(decoded[0].RawTimestamp + RxString);
|
||||
//sw.Dispose();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorLog.Log(LogErrReason.Exception(), "Log() failed", $"0x{ex.HResult.ToString("X", GENESIS_DISPLAY_TOOL._GENESIS_DISPLAY_TOOL.GetGlobalCulture())}", "second try/catch (save raw data)");
|
||||
loggingRawEn = false;
|
||||
}
|
||||
//});
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages;
|
||||
using System.Threading.Tasks;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
|
||||
namespace GenesisDisplayTool
|
||||
{
|
||||
|
||||
public class RegisterProperties
|
||||
{
|
||||
/// <summary>
|
||||
/// id of the registers
|
||||
/// </summary>
|
||||
public string id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// type of the stored data
|
||||
/// </summary>
|
||||
public string type { get; set; }
|
||||
|
||||
public Privilege privilege { get; set; }
|
||||
|
||||
public string lvl1 { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,509 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,567 @@
|
||||
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;
|
||||
|
||||
|
||||
|
||||
namespace GenesisDisplayTool
|
||||
{
|
||||
|
||||
public class ReportPages
|
||||
{
|
||||
public static Int32 TitlePage(Int32 pagecounter, String introduction, String title, String date, String operatorName, String serialNo, PdfDocument report, XImage logo, CultureInfo culture)
|
||||
{
|
||||
try
|
||||
{
|
||||
#region Page "TITLEPAGE"
|
||||
#region Prepare data
|
||||
pagecounter++; // Pagenumber not on titlepage
|
||||
report.Info.Title = title;
|
||||
PdfPage pdfPage = report.AddPage();
|
||||
XGraphics Titlepage = XGraphics.FromPdfPage(pdfPage);
|
||||
var formatter = new XTextFormatter(Titlepage);
|
||||
var layoutRectangle = new XRect(1, 1, 1, 1);
|
||||
Titlepage.DrawImage(logo, new XRect(ReportParams.LogoXPos, ReportParams.LogoYPos, ReportParams.LogoXSize, ReportParams.LogoYSize));
|
||||
Titlepage.DrawString($"{title}\n\n\n", ReportParams.font20, XBrushes.Black, new XRect(0, -200, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.Center);
|
||||
Titlepage.DrawString(date, ReportParams.font14, XBrushes.Black, new XRect(0, -100, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.Center);
|
||||
Titlepage.DrawString("by", ReportParams.font12, XBrushes.Black, new XRect(0, -50, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.Center);
|
||||
Titlepage.DrawString(operatorName, ReportParams.font14, XBrushes.Black, new XRect(0, 0, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.Center);
|
||||
Titlepage.DrawString($"Serial number: {serialNo}", ReportParams.font14, XBrushes.Black, new XRect(0, 100, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.Center);
|
||||
formatter.DrawString(introduction, ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.IntroductionXPos, ReportParams.IntroductionYPos, 400, 200), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "ReportPages.TitlePage() failed", $"0x{ex.HResult.ToString("X", culture)}", String.Empty);
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Return value
|
||||
return pagecounter;
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static Int32 Settings(Int32 pagecounter, String textSoftwareVersion, String[] columns, Boolean enable, PdfDocument report, XImage logo, CultureInfo culture)
|
||||
{
|
||||
try
|
||||
{
|
||||
#region Page "SETTINGS"
|
||||
#region Generate page
|
||||
pagecounter++;
|
||||
PdfPage pdfPage = report.AddPage();
|
||||
XGraphics Gp30Settings = XGraphics.FromPdfPage(pdfPage);
|
||||
var formatterGp30Settings = new XTextFormatter(Gp30Settings);
|
||||
var layoutRectangleGp30Settings = new XRect(1, 1, 1, 1);
|
||||
#endregion
|
||||
#region Set Image/ Logo
|
||||
Gp30Settings.DrawImage(logo, new XRect(ReportParams.LogoXPos, ReportParams.LogoYPos, ReportParams.LogoXSize, ReportParams.LogoYSize));
|
||||
#endregion
|
||||
#region Headline1
|
||||
Gp30Settings.DrawString("Settings", ReportParams.font20, XBrushes.Black, new XRect(ReportParams.HeadlineXPos, ReportParams.HeadlineYPos, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopCenter);
|
||||
#endregion
|
||||
#region Headline2 (first)
|
||||
Gp30Settings.DrawString("Software Version", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos, ReportParams.Headline2YPos, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Data
|
||||
formatterGp30Settings.DrawString(textSoftwareVersion, ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region GP30 settings
|
||||
if (enable)
|
||||
{
|
||||
#region Headline2
|
||||
Gp30Settings.DrawString("Values obtained from register readout", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos, ReportParams.Headline2YPos + 150, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Data/ text
|
||||
formatterGp30Settings.DrawString(columns[ReportParams.Column1], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos, ReportParams.StandardTextYPos + 150, 400, 200), XStringFormats.TopLeft);
|
||||
formatterGp30Settings.DrawString(columns[ReportParams.Column2], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + 140, ReportParams.StandardTextYPos + 150, 400, 200), XStringFormats.TopLeft);
|
||||
formatterGp30Settings.DrawString(columns[ReportParams.Column3], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + 190, ReportParams.StandardTextYPos + 150, 400, 200), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region Set page number
|
||||
Gp30Settings.DrawString($"Page {pagecounter.ToString(culture)}", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.PageNumberXPosition, ReportParams.PageNumberYPosition, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.BottomCenter);
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "ReportPages.Settings() failed", $"0x{ex.HResult.ToString("X", culture)}", String.Empty);
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Return values
|
||||
return pagecounter;
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static Int32 DecodedData(Int32 pagecounter, String[] columns, Boolean enable, Boolean enableColumn2, Boolean enableColumn3, Boolean enableColumn4, PdfDocument report, XImage logo, CultureInfo culture)
|
||||
{
|
||||
try
|
||||
{
|
||||
#region Page "MEAN VALUES"
|
||||
if ((enable) && ((enableColumn2) || (enableColumn3) || (enableColumn4)))
|
||||
{
|
||||
#region All PATHs
|
||||
#region Prepare Data
|
||||
pagecounter++;
|
||||
PdfPage pdfPage = report.AddPage();
|
||||
XGraphics XMean = XGraphics.FromPdfPage(pdfPage);
|
||||
var formatterData = new XTextFormatter(XMean);
|
||||
var layoutRectangleData = new XRect(1, 1, 1, 1);
|
||||
Int32 Xoffset = -20;
|
||||
#endregion
|
||||
#region Headline1
|
||||
XMean.DrawString("Decoded Data", ReportParams.font20, XBrushes.Black, new XRect(ReportParams.HeadlineXPos, ReportParams.HeadlineYPos, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopCenter);
|
||||
#endregion
|
||||
#region Set text (First column)
|
||||
if (!enableColumn2)
|
||||
Xoffset = Xoffset + 40;
|
||||
if (!enableColumn3)
|
||||
Xoffset = Xoffset + 40;
|
||||
if (!enableColumn4)
|
||||
Xoffset = Xoffset + 40;
|
||||
formatterData.DrawString(columns[ReportParams.Column1], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + Xoffset, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
Xoffset = Xoffset + 120;
|
||||
#endregion
|
||||
#region Set Image/Logo
|
||||
XMean.DrawImage(logo, new XRect(ReportParams.LogoXPos, ReportParams.LogoYPos, ReportParams.LogoXSize, ReportParams.LogoYSize));
|
||||
#endregion
|
||||
#region Add pagenumber
|
||||
XMean.DrawString($"Page {pagecounter.ToString(culture)}", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.PageNumberXPosition, ReportParams.PageNumberYPosition, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.BottomCenter);
|
||||
#endregion
|
||||
#endregion
|
||||
#region PATH0
|
||||
if (enableColumn2)
|
||||
{
|
||||
Misc.WaitNMilliseconds(100);
|
||||
#region Headline2
|
||||
XMean.DrawString("PATH1", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos + Xoffset, ReportParams.Headline2YPos + 20, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set text
|
||||
formatterData.DrawString(columns[ReportParams.Column2], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + Xoffset, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
Xoffset = Xoffset + 110;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region PATH1
|
||||
if (enableColumn3)
|
||||
{
|
||||
Misc.WaitNMilliseconds(100);
|
||||
#region Headline2
|
||||
XMean.DrawString("PATH2", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos + Xoffset, ReportParams.Headline2YPos + 20, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set text
|
||||
formatterData.DrawString(columns[ReportParams.Column3], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + Xoffset, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
Xoffset = Xoffset + 110;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region PATH2
|
||||
if (enableColumn4)
|
||||
{
|
||||
Misc.WaitNMilliseconds(100);
|
||||
#region Headline2
|
||||
XMean.DrawString("PATH3", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos + Xoffset, ReportParams.Headline2YPos + 20, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set text
|
||||
formatterData.DrawString(columns[ReportParams.Column4], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + Xoffset, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "ReportPages.DecodedData() failed", $"0x{ex.HResult.ToString("X", culture)}", String.Empty);
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Return values
|
||||
return pagecounter;
|
||||
#endregion
|
||||
}
|
||||
public static Int32 DecodedData2(Int32 pagecounter, String[] columns, Boolean enable, Boolean enableColumn2, Boolean enableColumn3, Boolean enableColumn4, PdfDocument report, XImage logo, CultureInfo culture)
|
||||
{
|
||||
try
|
||||
{
|
||||
#region Page "F/H-Protocol"
|
||||
if ((enable) && ((enableColumn2) || (enableColumn3) || (enableColumn4)))
|
||||
{
|
||||
#region All PATHs
|
||||
#region Prepare Data
|
||||
pagecounter++;
|
||||
PdfPage pdfPage = report.AddPage();
|
||||
XGraphics XMean = XGraphics.FromPdfPage(pdfPage);
|
||||
var formatterData = new XTextFormatter(XMean);
|
||||
var layoutRectangleData = new XRect(1, 1, 1, 1);
|
||||
Int32 Xoffset = -20;
|
||||
#endregion
|
||||
#region Headline1
|
||||
XMean.DrawString("Decoded Data", ReportParams.font20, XBrushes.Black, new XRect(ReportParams.HeadlineXPos, ReportParams.HeadlineYPos, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopCenter);
|
||||
#endregion
|
||||
#region Set text (First column)
|
||||
if (!enableColumn2)
|
||||
Xoffset = Xoffset + 40;
|
||||
if (!enableColumn3)
|
||||
Xoffset = Xoffset + 40;
|
||||
if (!enableColumn4)
|
||||
Xoffset = Xoffset + 40;
|
||||
formatterData.DrawString(columns[ReportParams.Column1], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + Xoffset, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
Xoffset = Xoffset + 120;
|
||||
#endregion
|
||||
#region Set Image/Logo
|
||||
XMean.DrawImage(logo, new XRect(ReportParams.LogoXPos, ReportParams.LogoYPos, ReportParams.LogoXSize, ReportParams.LogoYSize));
|
||||
#endregion
|
||||
#region Add pagenumber
|
||||
XMean.DrawString($"Page {pagecounter.ToString(culture)}", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.PageNumberXPosition, ReportParams.PageNumberYPosition, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.BottomCenter);
|
||||
#endregion
|
||||
#endregion
|
||||
#region PATH0
|
||||
if (enableColumn2)
|
||||
{
|
||||
Misc.WaitNMilliseconds(100);
|
||||
#region Headline2
|
||||
XMean.DrawString("PATH1", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos + Xoffset, ReportParams.Headline2YPos + 20, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set text
|
||||
formatterData.DrawString(columns[ReportParams.Column2], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + Xoffset, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
Xoffset = Xoffset + 110;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region PATH1
|
||||
if (enableColumn3)
|
||||
{
|
||||
Misc.WaitNMilliseconds(100);
|
||||
#region Headline2
|
||||
XMean.DrawString("PATH2", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos + Xoffset, ReportParams.Headline2YPos + 20, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set text
|
||||
formatterData.DrawString(columns[ReportParams.Column3], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + Xoffset, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
Xoffset = Xoffset + 110;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region PATH2
|
||||
if (enableColumn4)
|
||||
{
|
||||
Misc.WaitNMilliseconds(100);
|
||||
#region Headline2
|
||||
XMean.DrawString("PATH3", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos + Xoffset, ReportParams.Headline2YPos + 20, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set text
|
||||
formatterData.DrawString(columns[ReportParams.Column4], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + Xoffset, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "ReportPages.DecodedData() failed", $"0x{ex.HResult.ToString("X", culture)}", String.Empty);
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Return values
|
||||
return pagecounter;
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static Int32 Maingraph(Int32 pagecounter, String mainGraphTitle, ZedGraphControl graph, Boolean enable, PdfDocument report, XImage logo, CultureInfo culture)
|
||||
{
|
||||
try
|
||||
{
|
||||
#region Page "MAIN GRAPH"
|
||||
if (enable)
|
||||
{
|
||||
#region Prepare data
|
||||
pagecounter++;
|
||||
PdfPage pdfPage = report.AddPage();
|
||||
XGraphics XDecodedDataMainGraph = XGraphics.FromPdfPage(pdfPage);
|
||||
var formatterMainGraph = new XTextFormatter(XDecodedDataMainGraph);
|
||||
var layoutRectangleMainGraph = new XRect(1, 1, 1, 1);
|
||||
#endregion
|
||||
#region Headline1
|
||||
XDecodedDataMainGraph.DrawString("Main Graph", ReportParams.font20, XBrushes.Black, new XRect(ReportParams.HeadlineXPos, ReportParams.HeadlineYPos, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopCenter);
|
||||
#endregion
|
||||
#region Headline2
|
||||
XDecodedDataMainGraph.DrawString(mainGraphTitle, ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos, ReportParams.Headline2YPos, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set Image/Logo
|
||||
XImage Image0 = graph.MasterPane.GetImage();
|
||||
XDecodedDataMainGraph.DrawImage(Image0, new XRect(ReportParams.ImageXPos, ReportParams.ImageYPos, ReportParams.ImageXSize, ReportParams.ImageYSize));
|
||||
XDecodedDataMainGraph.DrawImage(logo, new XRect(ReportParams.LogoXPos, ReportParams.LogoYPos, ReportParams.LogoXSize, ReportParams.LogoYSize));
|
||||
#endregion
|
||||
#region Add pagenumber
|
||||
XDecodedDataMainGraph.DrawString($"Page {pagecounter.ToString(culture)}", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.PageNumberXPosition, ReportParams.PageNumberYPosition, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.BottomCenter);
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "ReportPages.Maingraph() failed", $"0x{ex.HResult.ToString("X", culture)}", String.Empty);
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Return value
|
||||
return pagecounter;
|
||||
#endregion;
|
||||
}
|
||||
|
||||
public static Int32 StdDeviationPath0(Int32 pagecounter, String[] columns, ZedGraphControl graphPath0, Boolean enable, PdfDocument report, XImage logo, CultureInfo culture)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
#region Standard deviation PATH0
|
||||
#region Prepare Page
|
||||
pagecounter++;
|
||||
PdfPage pdfPage = report.AddPage();
|
||||
XGraphics StdDev0 = XGraphics.FromPdfPage(pdfPage);
|
||||
var formatterStdDev0 = new XTextFormatter(StdDev0);
|
||||
var layoutStdDev0 = new XRect(1, 1, 1, 1);
|
||||
#endregion
|
||||
#region Headline1
|
||||
StdDev0.DrawString("Standard Deviation", ReportParams.font20, XBrushes.Black, new XRect(ReportParams.HeadlineXPos, ReportParams.HeadlineYPos, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopCenter);
|
||||
#endregion
|
||||
#region Headline2
|
||||
StdDev0.DrawString("Standard Deviation PATH1", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos, ReportParams.Headline2YPos, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set image
|
||||
XImage ImageStdDev0 = graphPath0.MasterPane.GetImage(1080, 640, 600, true);
|
||||
StdDev0.DrawImage(logo, new XRect(ReportParams.LogoXPos, ReportParams.LogoYPos, ReportParams.LogoXSize, ReportParams.LogoYSize));
|
||||
StdDev0.DrawImage(ImageStdDev0, new XRect(ReportParams.ImageXPos, ReportParams.ImageYPos, ReportParams.ImageXSize, ReportParams.ImageYSize));
|
||||
#endregion
|
||||
Misc.WaitNMilliseconds(100);
|
||||
#region Add data
|
||||
formatterStdDev0.DrawString(columns[ReportParams.Column1], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + 20, ReportParams.StandardTextYPos + 250, 400, 200), XStringFormats.TopLeft);
|
||||
formatterStdDev0.DrawString(columns[ReportParams.Column2], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + 100, ReportParams.StandardTextYPos + 250, 400, 200), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set pagenumber
|
||||
StdDev0.DrawString($"Page {pagecounter.ToString(culture)}", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.PageNumberXPosition, ReportParams.PageNumberYPosition, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.BottomCenter);
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "ReportPages.StdDeviationPath0() failed", $"0x{ex.HResult.ToString("X", culture)}", String.Empty);
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Return value
|
||||
return pagecounter;
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static Int32 StdDeviationPath1(Int32 pagecounter, String[] columns, ZedGraphControl graphPath1, Boolean enable, PdfDocument report, XImage logo, CultureInfo culture)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
#region Standard deviation PATH0
|
||||
#region Prepare Page
|
||||
pagecounter++;
|
||||
PdfPage pdfPage = report.AddPage();
|
||||
XGraphics StdDev1 = XGraphics.FromPdfPage(pdfPage);
|
||||
var formatterStdDev1 = new XTextFormatter(StdDev1);
|
||||
var layoutStdDev1 = new XRect(1, 1, 1, 1);
|
||||
#endregion
|
||||
#region Headline1
|
||||
StdDev1.DrawString("Standard Deviation", ReportParams.font20, XBrushes.Black, new XRect(ReportParams.HeadlineXPos, ReportParams.HeadlineYPos, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopCenter);
|
||||
#endregion
|
||||
#region Headline2
|
||||
StdDev1.DrawString("Standard Deviation PATH2", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos, ReportParams.Headline2YPos, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set image
|
||||
XImage ImageStdDev1 = graphPath1.MasterPane.GetImage(1080, 640, 600, true);
|
||||
StdDev1.DrawImage(logo, new XRect(ReportParams.LogoXPos, ReportParams.LogoYPos, ReportParams.LogoXSize, ReportParams.LogoYSize));
|
||||
StdDev1.DrawImage(ImageStdDev1, new XRect(ReportParams.ImageXPos, ReportParams.ImageYPos, ReportParams.ImageXSize, ReportParams.ImageYSize));
|
||||
#endregion
|
||||
Misc.WaitNMilliseconds(100);
|
||||
#region Add data
|
||||
formatterStdDev1.DrawString(columns[ReportParams.Column1], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + 20, ReportParams.StandardTextYPos + 250, 400, 200), XStringFormats.TopLeft);
|
||||
formatterStdDev1.DrawString(columns[ReportParams.Column3], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + 100, ReportParams.StandardTextYPos + 250, 400, 200), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set pagenumber
|
||||
StdDev1.DrawString($"Page {pagecounter.ToString(culture)}", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.PageNumberXPosition, ReportParams.PageNumberYPosition, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.BottomCenter);
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), $"ReportPages.StdDeviationPath1() failed", $"0x{ex.HResult.ToString("X", culture)}", String.Empty);
|
||||
#endregion
|
||||
}
|
||||
#region Return value
|
||||
return pagecounter;
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static Int32 StdDeviationPath2(Int32 pagecounter, String[] columns, ZedGraphControl graphPath2, Boolean enable, PdfDocument report, XImage logo, CultureInfo culture)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
#region Standard deviation PATH2
|
||||
#region Prepare Page
|
||||
pagecounter++;
|
||||
PdfPage pdfPage = report.AddPage();
|
||||
XGraphics StdDev2 = XGraphics.FromPdfPage(pdfPage);
|
||||
var formatterStdDev2 = new XTextFormatter(StdDev2);
|
||||
var layoutStdDev2 = new XRect(1, 1, 1, 1);
|
||||
#endregion
|
||||
#region Headline1
|
||||
StdDev2.DrawString("Standard Deviation", ReportParams.font20, XBrushes.Black, new XRect(ReportParams.HeadlineXPos, ReportParams.HeadlineYPos, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopCenter);
|
||||
#endregion
|
||||
#region Headline2
|
||||
StdDev2.DrawString("Standard Deviation PATH3", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos, ReportParams.Headline2YPos, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set image
|
||||
XImage ImageStdDev2 = graphPath2.MasterPane.GetImage(1080, 640, 600, true);
|
||||
StdDev2.DrawImage(logo, new XRect(ReportParams.LogoXPos, ReportParams.LogoYPos, ReportParams.LogoXSize, ReportParams.LogoYSize));
|
||||
StdDev2.DrawImage(ImageStdDev2, new XRect(ReportParams.ImageXPos, ReportParams.ImageYPos, ReportParams.ImageXSize, ReportParams.ImageYSize));
|
||||
#endregion
|
||||
Misc.WaitNMilliseconds(100);
|
||||
#region Add data
|
||||
formatterStdDev2.DrawString(columns[ReportParams.Column1], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + 20, ReportParams.StandardTextYPos + 250, 400, 200), XStringFormats.TopLeft);
|
||||
formatterStdDev2.DrawString(columns[ReportParams.Column4], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + 100, ReportParams.StandardTextYPos + 250, 400, 200), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set pagenumber
|
||||
StdDev2.DrawString($"Page {pagecounter.ToString(culture)}", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.PageNumberXPosition, ReportParams.PageNumberYPosition, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.BottomCenter);
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "ReportPages.StdDeviationPath2() failed", $"0x{ex.HResult.ToString("X", culture)}", String.Empty);
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Return value
|
||||
return pagecounter;
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static Int32 MeanValues(Int32 pagecounter, String[] columns, Boolean enable, Boolean enableColumn2, Boolean enableColumn3, Boolean enableColumn4, PdfDocument report, XImage logo, CultureInfo culture)
|
||||
{
|
||||
try
|
||||
{
|
||||
#region Page "MEAN VALUES"
|
||||
if ((enable) && ((enableColumn2) || (enableColumn3) || (enableColumn4)))
|
||||
{
|
||||
#region All PATHs
|
||||
#region Prepare Data
|
||||
pagecounter++;
|
||||
PdfPage pdfPage = report.AddPage();
|
||||
XGraphics XMean = XGraphics.FromPdfPage(pdfPage);
|
||||
var formatterData = new XTextFormatter(XMean);
|
||||
var layoutRectangleData = new XRect(1, 1, 1, 1);
|
||||
Int32 Xoffset = 0;
|
||||
#endregion
|
||||
#region Headline1
|
||||
XMean.DrawString("Mean Values", ReportParams.font20, XBrushes.Black, new XRect(ReportParams.HeadlineXPos, ReportParams.HeadlineYPos, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopCenter);
|
||||
#endregion
|
||||
#region Set text (First column)
|
||||
if (!enableColumn2)
|
||||
Xoffset = Xoffset + 40;
|
||||
if (!enableColumn3)
|
||||
Xoffset = Xoffset + 40;
|
||||
if (!enableColumn4)
|
||||
Xoffset = Xoffset + 40;
|
||||
formatterData.DrawString(columns[ReportParams.Column1], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + Xoffset, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
Xoffset = Xoffset + 100;
|
||||
#endregion
|
||||
#region Set Image/Logo
|
||||
XMean.DrawImage(logo, new XRect(ReportParams.LogoXPos, ReportParams.LogoYPos, ReportParams.LogoXSize, ReportParams.LogoYSize));
|
||||
#endregion
|
||||
#region Add pagenumber
|
||||
XMean.DrawString($"Page {pagecounter.ToString()}", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.PageNumberXPosition, ReportParams.PageNumberYPosition, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.BottomCenter);
|
||||
#endregion
|
||||
#endregion
|
||||
Misc.WaitNMilliseconds(100);
|
||||
#region PATH0
|
||||
if (enableColumn2)
|
||||
{
|
||||
#region Headline2
|
||||
XMean.DrawString("PATH1", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos + Xoffset, ReportParams.Headline2YPos + 20, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set text
|
||||
formatterData.DrawString(columns[ReportParams.Column2], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + Xoffset, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
Xoffset = Xoffset + 100;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
Misc.WaitNMilliseconds(100);
|
||||
#region PATH1
|
||||
if (enableColumn3)
|
||||
{
|
||||
#region Headline2
|
||||
XMean.DrawString("PATH2", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos + Xoffset, ReportParams.Headline2YPos + 20, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set text
|
||||
formatterData.DrawString(columns[ReportParams.Column3], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + Xoffset, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
Xoffset = Xoffset + 100;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
Misc.WaitNMilliseconds(100);
|
||||
#region PATH2
|
||||
if (enableColumn4)
|
||||
{
|
||||
#region Headline2
|
||||
XMean.DrawString("PATH3", ReportParams.font12, XBrushes.Black, new XRect(ReportParams.Headline2XPos + Xoffset, ReportParams.Headline2YPos + 20, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
#region Set text
|
||||
formatterData.DrawString(columns[ReportParams.Column4], ReportParams.fontStandard, XBrushes.Black, new XRect(ReportParams.StandardTextXPos + Xoffset, ReportParams.StandardTextYPos, 400, 200), XStringFormats.TopLeft);
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#region Error
|
||||
ErrorLog.Log(LogErrReason.Exception(), "ReportPages.MeanValues() failed", $"0x{ex.HResult.ToString("X")}", String.Empty);
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Return values
|
||||
return pagecounter;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,696 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
//using System.Data.SQLite;
|
||||
using ZedGraph;
|
||||
|
||||
namespace GenesisDisplayTool
|
||||
{
|
||||
public class dataaccess
|
||||
{
|
||||
public string startupPath;
|
||||
/*
|
||||
public dataaccess(string StartupPath,int Index)
|
||||
{
|
||||
startupPath = StartupPath;
|
||||
switch (Index)
|
||||
{
|
||||
case 0: ConnectMaingraph();
|
||||
break;
|
||||
case 1: ConnectStdDevPath0();
|
||||
break;
|
||||
case 2: ConnectStdDevPath1();
|
||||
break;
|
||||
case 3: ConnectStdDevPath2();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
insertData(1,2,1.2);
|
||||
insertData(1, 3, 1.3);
|
||||
insertData(1, 8, 1.9);
|
||||
insertData(1, 10, 1.0);
|
||||
insertData(1, 2, 0);
|
||||
|
||||
insertData(2, 10, 1.0);
|
||||
insertData(2, 2, 0);
|
||||
|
||||
var tmp = getData(1);
|
||||
tmp.AddRange(getData(2));
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
//const string dataSourceMaingraph = "SQL_Maingraph.db";
|
||||
//const string dataSourceStdDevPath0 = "SQL_StdDevNull.db";
|
||||
//const string dataSourceStdDevPath1 = "SQL_StdDevOne.db";
|
||||
//const string dataSourceStdDevPath2 = "SQL_StdDevTwo.db";
|
||||
|
||||
//SQLiteConnection connectionMaingraph;
|
||||
//SQLiteConnection connectionStdDevPath0;
|
||||
//SQLiteConnection connectionStdDevPath1;
|
||||
//SQLiteConnection connectionStdDevPath2;
|
||||
|
||||
//public void ConnectMaingraph()
|
||||
//{
|
||||
// if (connectionMaingraph != null)
|
||||
// {
|
||||
// connectionMaingraph.Close();
|
||||
// }
|
||||
|
||||
// System.IO.File.Delete(System.IO.Path.Combine(startupPath, dataSourceMaingraph));
|
||||
// connectionMaingraph = new SQLiteConnection();
|
||||
// connectionMaingraph.ConnectionString = "Data Source=" + dataSourceMaingraph;
|
||||
// connectionMaingraph.Open();
|
||||
|
||||
// using (SQLiteCommand commandMaingraph = new SQLiteCommand(connectionMaingraph))
|
||||
// {
|
||||
// // Erstellen der Tabelle, sofern diese noch nicht existiert.
|
||||
// // command.CommandText = "CREATE TABLE IF NOT EXISTS graphdata ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, lineid INteger,x INteger, y real );";
|
||||
// commandMaingraph.CommandText = "CREATE TABLE IF NOT EXISTS graphdata (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, x INteger, PATH0 real, PATH1 real, PATH2 real);";
|
||||
// commandMaingraph.ExecuteNonQuery();
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
//public void ConnectStdDevPath0()
|
||||
//{
|
||||
// if (connectionStdDevPath0 != null)
|
||||
// {
|
||||
// connectionStdDevPath0.Close();
|
||||
// }
|
||||
|
||||
// System.IO.File.Delete(System.IO.Path.Combine(startupPath, dataSourceStdDevPath0));
|
||||
// connectionStdDevPath0 = new SQLiteConnection();
|
||||
// connectionStdDevPath0.ConnectionString = "Data Source=" + dataSourceStdDevPath0;
|
||||
// connectionStdDevPath0.Open();
|
||||
|
||||
// using (SQLiteCommand commandStdDev0 = new SQLiteCommand(connectionStdDevPath0))
|
||||
// {
|
||||
// // Erstellen der Tabelle, sofern diese noch nicht existiert.
|
||||
// // command.CommandText = "CREATE TABLE IF NOT EXISTS graphdata ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, lineid INteger,x INteger, y real );";
|
||||
// commandStdDev0.CommandText = "CREATE TABLE IF NOT EXISTS graphdataStdDevPath0 (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, x INteger, HIT0 real, HIT1 real, HIT2 real, HIT3 real, HIT4 real, HIT5 real, HIT6 real, HIT7 real, THREEHITS real, EIGHTHITS real);";
|
||||
// commandStdDev0.ExecuteNonQuery();
|
||||
// }
|
||||
//}
|
||||
|
||||
//public void ConnectStdDevPath1()
|
||||
//{
|
||||
// if (connectionStdDevPath1 != null)
|
||||
// {
|
||||
// connectionStdDevPath1.Close();
|
||||
// }
|
||||
|
||||
// System.IO.File.Delete(System.IO.Path.Combine(startupPath, dataSourceStdDevPath1));
|
||||
// connectionStdDevPath1 = new SQLiteConnection();
|
||||
// connectionStdDevPath1.ConnectionString = "Data Source=" + dataSourceStdDevPath1;
|
||||
// connectionStdDevPath1.Open();
|
||||
|
||||
// using (SQLiteCommand commandStdDev1 = new SQLiteCommand(connectionStdDevPath1))
|
||||
// {
|
||||
// // Erstellen der Tabelle, sofern diese noch nicht existiert.
|
||||
// // command.CommandText = "CREATE TABLE IF NOT EXISTS graphdata ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, lineid INteger,x INteger, y real );";
|
||||
// commandStdDev1.CommandText = "CREATE TABLE IF NOT EXISTS graphdataStdDevPath1 (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, x INteger, HIT0 real, HIT1 real, HIT2 real, HIT3 real, HIT4 real, HIT5 real, HIT6 real, HIT7 real, THREEHITS real, EIGHTHITS real);";
|
||||
// commandStdDev1.ExecuteNonQuery();
|
||||
// }
|
||||
//}
|
||||
|
||||
//public void ConnectStdDevPath2()
|
||||
//{
|
||||
|
||||
// if (connectionStdDevPath2 != null)
|
||||
// {
|
||||
// connectionStdDevPath2.Close();
|
||||
// }
|
||||
|
||||
// System.IO.File.Delete(System.IO.Path.Combine(startupPath, dataSourceStdDevPath2));
|
||||
// connectionStdDevPath2 = new SQLiteConnection();
|
||||
// connectionStdDevPath2.ConnectionString = "Data Source=" + dataSourceStdDevPath2;
|
||||
// connectionStdDevPath2.Open();
|
||||
|
||||
// using (SQLiteCommand commandStdDev2 = new SQLiteCommand(connectionStdDevPath2))
|
||||
// {
|
||||
// // Erstellen der Tabelle, sofern diese noch nicht existiert.
|
||||
// // command.CommandText = "CREATE TABLE IF NOT EXISTS graphdata ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, lineid INteger,x INteger, y real );";
|
||||
// commandStdDev2.CommandText = "CREATE TABLE IF NOT EXISTS graphdataStdDevPath2 (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, x INteger, HIT0 real, HIT1 real, HIT2 real, HIT3 real, HIT4 real, HIT5 real, HIT6 real, HIT7 real, THREEHITS real, EIGHTHITS real);";
|
||||
// commandStdDev2.ExecuteNonQuery();
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
/*
|
||||
public void insertData(int lineid , int x, double y)
|
||||
{
|
||||
using (SQLiteCommand command = new SQLiteCommand(connection))
|
||||
{
|
||||
// Erstellen der Tabelle, sofern diese noch nicht existiert.
|
||||
command.CommandText = "INSERT INTO graphdata (id, lineid, x,y) VALUES(NULL, "+ lineid+ ", "+ x + ", " +y.ToString().Replace(",",".") +")";
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
//public void insertData(double x, double PATH0, double PATH1, double PATH2)
|
||||
//{
|
||||
// using (SQLiteCommand commandMaingraph = new SQLiteCommand(connectionMaingraph))
|
||||
// {
|
||||
// // Erstellen der Tabelle, sofern diese noch nicht existiert.
|
||||
// //command.CommandText = "INSERT INTO graphdata (id, x,y) VALUES(NULL, " + x + ", " + y.ToString().Replace(",", ".") + ")";
|
||||
// commandMaingraph.CommandText = "INSERT INTO graphdata (id, x, PATH0, PATH1, PATH2) VALUES(NULL, " + x + ", " + PATH0.ToString().Replace(",", ".") + "," + PATH1.ToString().Replace(",", ".") + "," + PATH2.ToString().Replace(",", ".") + ")";
|
||||
// commandMaingraph.ExecuteNonQuery();
|
||||
// }
|
||||
//}
|
||||
|
||||
//public void insertDataStdDevPath0(int x, double[] HITS, double THREEHITS, double EIGHTHITS)
|
||||
//{
|
||||
// using (SQLiteCommand commandStdDevPath0 = new SQLiteCommand(connectionStdDevPath0))
|
||||
// {
|
||||
// // Erstellen der Tabelle, sofern diese noch nicht existiert.
|
||||
// //command.CommandText = "INSERT INTO graphdata (id, x,y) VALUES(NULL, " + x + ", " + y.ToString().Replace(",", ".") + ")";
|
||||
// commandStdDevPath0.CommandText = "INSERT INTO graphdataStdDevPath0 (id, x, HIT0, HIT1, HIT2, HIT3, HIT4, HIT5, HIT6, HIT7, THREEHITS, EIGHTHITS) VALUES(NULL, " + x + ", " +
|
||||
// HITS[0].ToString().Replace(",", ".") + "," + HITS[1].ToString().Replace(",", ".") + "," + HITS[2].ToString().Replace(",", ".") + "," + HITS[3].ToString().Replace(",", ".") + "," +
|
||||
// HITS[4].ToString().Replace(",", ".") + "," + HITS[5].ToString().Replace(",", ".") + "," + HITS[6].ToString().Replace(",", ".") + "," + HITS[7].ToString().Replace(",", ".") + "," +
|
||||
// THREEHITS.ToString().Replace(",", ".") + "," + EIGHTHITS.ToString().Replace(",", ".") + ")";
|
||||
// commandStdDevPath0.ExecuteNonQuery();
|
||||
// }
|
||||
//}
|
||||
|
||||
//public void insertDataStdDevPath1(int x, double[] HITS, double THREEHITS, double EIGHTHITS)
|
||||
//{
|
||||
// using (SQLiteCommand commandStdDevPath1 = new SQLiteCommand(connectionStdDevPath1))
|
||||
// {
|
||||
// // Erstellen der Tabelle, sofern diese noch nicht existiert.
|
||||
// //command.CommandText = "INSERT INTO graphdata (id, x,y) VALUES(NULL, " + x + ", " + y.ToString().Replace(",", ".") + ")";
|
||||
// commandStdDevPath1.CommandText = "INSERT INTO graphdataStdDevPath1 (id, x, HIT0, HIT1, HIT2, HIT3, HIT4, HIT5, HIT6, HIT7, THREEHITS, EIGHTHITS) VALUES(NULL, " + x + ", " +
|
||||
// HITS[0].ToString().Replace(",", ".") + "," + HITS[1].ToString().Replace(",", ".") + "," + HITS[2].ToString().Replace(",", ".") + "," + HITS[3].ToString().Replace(",", ".") + "," +
|
||||
// HITS[4].ToString().Replace(",", ".") + "," + HITS[5].ToString().Replace(",", ".") + "," + HITS[6].ToString().Replace(",", ".") + "," + HITS[7].ToString().Replace(",", ".") + "," +
|
||||
// THREEHITS.ToString().Replace(",", ".") + "," + EIGHTHITS.ToString().Replace(",", ".") + ")";
|
||||
// commandStdDevPath1.ExecuteNonQuery();
|
||||
// }
|
||||
//}
|
||||
|
||||
//public void insertDataStdDevPath2(int x, double[] HITS, double THREEHITS, double EIGHTHITS)
|
||||
//{
|
||||
// using (SQLiteCommand commandStdDevPath2 = new SQLiteCommand(connectionStdDevPath2))
|
||||
// {
|
||||
// // Erstellen der Tabelle, sofern diese noch nicht existiert.
|
||||
// //command.CommandText = "INSERT INTO graphdata (id, x,y) VALUES(NULL, " + x + ", " + y.ToString().Replace(",", ".") + ")";
|
||||
// commandStdDevPath2.CommandText = "INSERT INTO graphdataStdDevPath2 (id, x, HIT0, HIT1, HIT2, HIT3, HIT4, HIT5, HIT6, HIT7, THREEHITS, EIGHTHITS) VALUES(NULL, " + x + ", " +
|
||||
// HITS[0].ToString().Replace(",", ".") + "," + HITS[1].ToString().Replace(",", ".") + "," + HITS[2].ToString().Replace(",", ".") + "," + HITS[3].ToString().Replace(",", ".") + "," +
|
||||
// HITS[4].ToString().Replace(",", ".") + "," + HITS[5].ToString().Replace(",", ".") + "," + HITS[6].ToString().Replace(",", ".") + "," + HITS[7].ToString().Replace(",", ".") + "," +
|
||||
// THREEHITS.ToString().Replace(",", ".") + "," + EIGHTHITS.ToString().Replace(",", ".") + ")";
|
||||
// commandStdDevPath2.ExecuteNonQuery();
|
||||
// }
|
||||
//}
|
||||
|
||||
public void flushData()
|
||||
{
|
||||
|
||||
/*
|
||||
using (SQLiteCommand command = new SQLiteCommand(connection))
|
||||
{
|
||||
command.CommandText = "DELETE FROM graphdata";
|
||||
// command.CommandText = "DROP TABLE graphdata";
|
||||
command.ExecuteNonQuery();
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
// ConnectMaingraph();
|
||||
// ConnectStdDevPath0();
|
||||
// ConnectStdDevPath1();
|
||||
// ConnectStdDevPath2();
|
||||
//using (SQLiteCommand command = new SQLiteCommand(connection))
|
||||
//{
|
||||
// //command.CommandText = "DROP TABLE graphdata;";
|
||||
// // command.CommandText = "DELETE FROM TABLE graphdata;";
|
||||
// //command.CommandText = "DELETE FROM graphdata WHERE id>-1";
|
||||
// /* command.CommandText = "SET sql_safe_updates=0";
|
||||
// command.ExecuteNonQuery();
|
||||
// command.CommandText = "TRUNCATE [TABLE] graphdata";
|
||||
// // command.CommandText = "DROP TABLE graphdata";*/
|
||||
|
||||
// // command.CommandText = "DROP TABLE graphdata";
|
||||
// command.ExecuteNonQuery();
|
||||
|
||||
|
||||
//}
|
||||
}
|
||||
/*
|
||||
|
||||
public List<Tuple<int, double>> getMultiData(int lineid)
|
||||
{
|
||||
var retData = new List<Tuple<int, double>>();
|
||||
using (SQLiteCommand command = new SQLiteCommand(connectionMaingraph))
|
||||
{
|
||||
command.CommandText = "SELECT x,y FROM graphdata where lineid = " + lineid + " ORDER BY id DESC";
|
||||
|
||||
using (SQLiteDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
retData.Add(Tuple.Create(int.Parse(reader[0].ToString()), double.Parse(reader[1].ToString())));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return retData;
|
||||
}
|
||||
|
||||
|
||||
public double getDataStdDevPath0(int x, UInt16 HIT)
|
||||
{
|
||||
double retData = 0;
|
||||
using (SQLiteCommand commandStdDevPath0 = new SQLiteCommand(connectionStdDevPath0))
|
||||
{
|
||||
|
||||
//command.CommandText = "SELECT y FROM graphdata where x = " + x;
|
||||
|
||||
switch (HIT)
|
||||
{
|
||||
case Constants.HIT0:
|
||||
commandStdDevPath0.CommandText = "SELECT HIT0 FROM graphdataStdDevPath0 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT1:
|
||||
commandStdDevPath0.CommandText = "SELECT HIT1 FROM graphdataStdDevPath0 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT2:
|
||||
commandStdDevPath0.CommandText = "SELECT HIT2 FROM graphdataStdDevPath0 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT3:
|
||||
commandStdDevPath0.CommandText = "SELECT HIT3 FROM graphdataStdDevPath0 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT4:
|
||||
commandStdDevPath0.CommandText = "SELECT HIT4 FROM graphdataStdDevPath0 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT5:
|
||||
commandStdDevPath0.CommandText = "SELECT HIT5 FROM graphdataStdDevPath0 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT6:
|
||||
commandStdDevPath0.CommandText = "SELECT HIT6 FROM graphdataStdDevPath0 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT7:
|
||||
commandStdDevPath0.CommandText = "SELECT HIT7 FROM graphdataStdDevPath0 where x = " + x;
|
||||
break;
|
||||
case 8:
|
||||
commandStdDevPath0.CommandText = "SELECT THREEHITS FROM graphdataStdDevPath0 where x = " + x;
|
||||
break;
|
||||
case 9:
|
||||
commandStdDevPath0.CommandText = "SELECT EIGHTHITS FROM graphdataStdDevPath0 where x = " + x;
|
||||
break;
|
||||
default: return 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
object val = commandStdDevPath0.ExecuteScalar();
|
||||
if (val != null)
|
||||
retData = double.Parse(val.ToString());
|
||||
|
||||
|
||||
}
|
||||
return retData;
|
||||
}
|
||||
public double getDataStdDevPath1(int x, UInt16 HIT)
|
||||
{
|
||||
double retData = 0;
|
||||
using (SQLiteCommand commandStdDevPath1 = new SQLiteCommand(connectionStdDevPath1))
|
||||
{
|
||||
|
||||
//command.CommandText = "SELECT y FROM graphdata where x = " + x;
|
||||
|
||||
switch (HIT)
|
||||
{
|
||||
case Constants.HIT0:
|
||||
commandStdDevPath1.CommandText = "SELECT HIT0 FROM graphdataStdDevPath1 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT1:
|
||||
commandStdDevPath1.CommandText = "SELECT HIT1 FROM graphdataStdDevPath1 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT2:
|
||||
commandStdDevPath1.CommandText = "SELECT HIT2 FROM graphdataStdDevPath1 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT3:
|
||||
commandStdDevPath1.CommandText = "SELECT HIT3 FROM graphdataStdDevPath1 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT4:
|
||||
commandStdDevPath1.CommandText = "SELECT HIT4 FROM graphdataStdDevPath1 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT5:
|
||||
commandStdDevPath1.CommandText = "SELECT HIT5 FROM graphdataStdDevPath1 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT6:
|
||||
commandStdDevPath1.CommandText = "SELECT HIT6 FROM graphdataStdDevPath1 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT7:
|
||||
commandStdDevPath1.CommandText = "SELECT HIT7 FROM graphdataStdDevPath1 where x = " + x;
|
||||
break;
|
||||
case 8:
|
||||
commandStdDevPath1.CommandText = "SELECT THREEHITS FROM graphdataStdDevPath1 where x = " + x;
|
||||
break;
|
||||
case 9:
|
||||
commandStdDevPath1.CommandText = "SELECT EIGHTHITS FROM graphdataStdDevPath1 where x = " + x;
|
||||
break;
|
||||
default: return 0;
|
||||
|
||||
}
|
||||
|
||||
object val = commandStdDevPath1.ExecuteScalar();
|
||||
if (val != null)
|
||||
retData = double.Parse(val.ToString());
|
||||
|
||||
|
||||
}
|
||||
return retData;
|
||||
}
|
||||
public double getDataStdDevPath2(int x, UInt16 HIT)
|
||||
{
|
||||
double retData = 0;
|
||||
using (SQLiteCommand commandStdDevPath2 = new SQLiteCommand(connectionStdDevPath2))
|
||||
{
|
||||
|
||||
//command.CommandText = "SELECT y FROM graphdata where x = " + x;
|
||||
|
||||
switch (HIT)
|
||||
{
|
||||
case Constants.HIT0:
|
||||
commandStdDevPath2.CommandText = "SELECT HIT0 FROM graphdataStdDevPath2 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT1:
|
||||
commandStdDevPath2.CommandText = "SELECT HIT1 FROM graphdataStdDevPath2 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT2:
|
||||
commandStdDevPath2.CommandText = "SELECT HIT2 FROM graphdataStdDevPath2 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT3:
|
||||
commandStdDevPath2.CommandText = "SELECT HIT3 FROM graphdataStdDevPath2 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT4:
|
||||
commandStdDevPath2.CommandText = "SELECT HIT4 FROM graphdataStdDevPath2 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT5:
|
||||
commandStdDevPath2.CommandText = "SELECT HIT5 FROM graphdataStdDevPath2 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT6:
|
||||
commandStdDevPath2.CommandText = "SELECT HIT6 FROM graphdataStdDevPath2 where x = " + x;
|
||||
break;
|
||||
case Constants.HIT7:
|
||||
commandStdDevPath2.CommandText = "SELECT HIT7 FROM graphdataStdDevPath2 where x = " + x;
|
||||
break;
|
||||
case 8:
|
||||
commandStdDevPath2.CommandText = "SELECT THREEHITS FROM graphdataStdDevPath2 where x = " + x;
|
||||
break;
|
||||
case 9:
|
||||
commandStdDevPath2.CommandText = "SELECT EIGHTHITS FROM graphdataStdDevPath2 where x = " + x;
|
||||
break;
|
||||
default: return 0;
|
||||
|
||||
}
|
||||
|
||||
object val = commandStdDevPath2.ExecuteScalar();
|
||||
if (val != null)
|
||||
retData = double.Parse(val.ToString());
|
||||
|
||||
|
||||
}
|
||||
return retData;
|
||||
}
|
||||
|
||||
public PointPairList getDataStdDevNewPath0(int x, UInt16 HIT, UInt16 range)
|
||||
{
|
||||
PointPairList retData = new PointPairList();
|
||||
|
||||
using (SQLiteCommand commandStdDevPath0 = new SQLiteCommand(connectionStdDevPath0))
|
||||
{
|
||||
|
||||
//command.CommandText = "SELECT y FROM graphdata where x = " + x;
|
||||
|
||||
for (int i = 0; i < range; i++)
|
||||
{
|
||||
|
||||
switch (HIT)
|
||||
{
|
||||
case Constants.HIT0:
|
||||
commandStdDevPath0.CommandText = "SELECT HIT0 FROM graphdataStdDevPath0 where x = " + (x + i);
|
||||
break;
|
||||
case Constants.HIT1:
|
||||
commandStdDevPath0.CommandText = "SELECT HIT1 FROM graphdataStdDevPath0 where x = " + (x + i);
|
||||
break;
|
||||
case Constants.HIT2:
|
||||
commandStdDevPath0.CommandText = "SELECT HIT2 FROM graphdataStdDevPath0 where x = " + (x + i);
|
||||
break;
|
||||
case Constants.HIT3:
|
||||
commandStdDevPath0.CommandText = "SELECT HIT3 FROM graphdataStdDevPath0 where x = " + (x + i);
|
||||
break;
|
||||
case Constants.HIT4:
|
||||
commandStdDevPath0.CommandText = "SELECT HIT4 FROM graphdataStdDevPath0 where x = " + (x + i);
|
||||
break;
|
||||
case Constants.HIT5:
|
||||
commandStdDevPath0.CommandText = "SELECT HIT5 FROM graphdataStdDevPath0 where x = " + (x + i);
|
||||
break;
|
||||
case Constants.HIT6:
|
||||
commandStdDevPath0.CommandText = "SELECT HIT6 FROM graphdataStdDevPath0 where x = " + (x + i);
|
||||
break;
|
||||
case Constants.HIT7:
|
||||
commandStdDevPath0.CommandText = "SELECT HIT7 FROM graphdataStdDevPath0 where x = " + (x + i);
|
||||
break;
|
||||
case 8:
|
||||
commandStdDevPath0.CommandText = "SELECT THREEHITS FROM graphdataStdDevPath0 where x = " + (x + i);
|
||||
break;
|
||||
case 9:
|
||||
commandStdDevPath0.CommandText = "SELECT EIGHTHITS FROM graphdataStdDevPath0 where x = " + (x + i);
|
||||
break;
|
||||
default: return null;
|
||||
|
||||
}
|
||||
|
||||
object val = commandStdDevPath0.ExecuteScalar();
|
||||
if (val != null)
|
||||
retData.Add((int)(x + i), double.Parse(val.ToString()));
|
||||
|
||||
}
|
||||
}
|
||||
return retData;
|
||||
}
|
||||
public PointPairList getDataStdDevNewPath1(int x, UInt16 HIT, UInt16 range)
|
||||
{
|
||||
PointPairList retData = new PointPairList();
|
||||
|
||||
using (SQLiteCommand commandStdDevPath1 = new SQLiteCommand(connectionStdDevPath1))
|
||||
{
|
||||
|
||||
//command.CommandText = "SELECT y FROM graphdata where x = " + x;
|
||||
|
||||
for (int i = 0; i < range; i++)
|
||||
{
|
||||
|
||||
switch (HIT)
|
||||
{
|
||||
case Constants.HIT0:
|
||||
commandStdDevPath1.CommandText = "SELECT HIT0 FROM graphdataStdDevPath1 where x = " + (x + i);
|
||||
break;
|
||||
case Constants.HIT1:
|
||||
commandStdDevPath1.CommandText = "SELECT HIT1 FROM graphdataStdDevPath1 where x = " + (x + i);
|
||||
break;
|
||||
case Constants.HIT2:
|
||||
commandStdDevPath1.CommandText = "SELECT HIT2 FROM graphdataStdDevPath1 where x = " + (x + i);
|
||||
break;
|
||||
case Constants.HIT3:
|
||||
commandStdDevPath1.CommandText = "SELECT HIT3 FROM graphdataStdDevPath1 where x = " + (x + i);
|
||||
break;
|
||||
case Constants.HIT4:
|
||||
commandStdDevPath1.CommandText = "SELECT HIT4 FROM graphdataStdDevPath1 where x = " + (x + i);
|
||||
break;
|
||||
case Constants.HIT5:
|
||||
commandStdDevPath1.CommandText = "SELECT HIT5 FROM graphdataStdDevPath1 where x = " + (x + i);
|
||||
break;
|
||||
case Constants.HIT6:
|
||||
commandStdDevPath1.CommandText = "SELECT HIT6 FROM graphdataStdDevPath1 where x = " + (x + i);
|
||||
break;
|
||||
case Constants.HIT7:
|
||||
commandStdDevPath1.CommandText = "SELECT HIT7 FROM graphdataStdDevPath1 where x = " + (x + i);
|
||||
break;
|
||||
case 8:
|
||||
commandStdDevPath1.CommandText = "SELECT THREEHITS FROM graphdataStdDevPath1 where x = " + (x + i);
|
||||
break;
|
||||
case 9:
|
||||
commandStdDevPath1.CommandText = "SELECT EIGHTHITS FROM graphdataStdDevPath1 where x = " + (x + i);
|
||||
break;
|
||||
default: return null;
|
||||
|
||||
}
|
||||
|
||||
object val = commandStdDevPath1.ExecuteScalar();
|
||||
if (val != null)
|
||||
retData.Add((int)(x + i), double.Parse(val.ToString()));
|
||||
|
||||
}
|
||||
}
|
||||
return retData;
|
||||
}
|
||||
public PointPairList getDataStdDevNewPath2(int x, UInt16 HIT, UInt16 range)
|
||||
{
|
||||
PointPairList retData = new PointPairList();
|
||||
|
||||
using (SQLiteCommand commandStdDevPath2 = new SQLiteCommand(connectionStdDevPath2))
|
||||
{
|
||||
|
||||
//command.CommandText = "SELECT y FROM graphdata where x = " + x;
|
||||
|
||||
for (int i = 0; i < range; i++)
|
||||
{
|
||||
|
||||
switch (HIT)
|
||||
{
|
||||
case Constants.HIT0:
|
||||
commandStdDevPath2.CommandText = "SELECT HIT0 FROM graphdataStdDevPath2 where x = " + (x+i);
|
||||
break;
|
||||
case Constants.HIT1:
|
||||
commandStdDevPath2.CommandText = "SELECT HIT1 FROM graphdataStdDevPath2 where x = " + (x+i);
|
||||
break;
|
||||
case Constants.HIT2:
|
||||
commandStdDevPath2.CommandText = "SELECT HIT2 FROM graphdataStdDevPath2 where x = " + (x+i);
|
||||
break;
|
||||
case Constants.HIT3:
|
||||
commandStdDevPath2.CommandText = "SELECT HIT3 FROM graphdataStdDevPath2 where x = " + (x+i);
|
||||
break;
|
||||
case Constants.HIT4:
|
||||
commandStdDevPath2.CommandText = "SELECT HIT4 FROM graphdataStdDevPath2 where x = " + (x+i);
|
||||
break;
|
||||
case Constants.HIT5:
|
||||
commandStdDevPath2.CommandText = "SELECT HIT5 FROM graphdataStdDevPath2 where x = " + (x+i);
|
||||
break;
|
||||
case Constants.HIT6:
|
||||
commandStdDevPath2.CommandText = "SELECT HIT6 FROM graphdataStdDevPath2 where x = " + (x+i);
|
||||
break;
|
||||
case Constants.HIT7:
|
||||
commandStdDevPath2.CommandText = "SELECT HIT7 FROM graphdataStdDevPath2 where x = " + (x+i);
|
||||
break;
|
||||
case 8:
|
||||
commandStdDevPath2.CommandText = "SELECT THREEHITS FROM graphdataStdDevPath2 where x = " + (x+i);
|
||||
break;
|
||||
case 9:
|
||||
commandStdDevPath2.CommandText = "SELECT EIGHTHITS FROM graphdataStdDevPath2 where x = " + (x+i);
|
||||
break;
|
||||
default: return null;
|
||||
|
||||
}
|
||||
|
||||
object val = commandStdDevPath2.ExecuteScalar();
|
||||
if (val != null)
|
||||
retData.Add((int)(x + i), double.Parse(val.ToString()));
|
||||
|
||||
}
|
||||
}
|
||||
return retData;
|
||||
}
|
||||
public PointPairList getDataNew(int x, UInt16 Path, UInt16 number)
|
||||
{
|
||||
PointPairList retData = new PointPairList();
|
||||
using (SQLiteCommand commandMaingraph = new SQLiteCommand(connectionMaingraph))
|
||||
{
|
||||
|
||||
//command.CommandText = "SELECT y FROM graphdata where x = " + x;
|
||||
|
||||
for (int i = 0; i < number; i++)
|
||||
{
|
||||
switch (Path)
|
||||
{
|
||||
case Constants.PATH0:
|
||||
commandMaingraph.CommandText = "SELECT PATH0 FROM graphdata where x = " + (x + i);
|
||||
break;
|
||||
case Constants.PATH1:
|
||||
commandMaingraph.CommandText = "SELECT PATH1 FROM graphdata where x = " + (x + i);
|
||||
break;
|
||||
case Constants.PATH2:
|
||||
commandMaingraph.CommandText = "SELECT PATH2 FROM graphdata where x = " + (x + i);
|
||||
break;
|
||||
default: break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
object val = commandMaingraph.ExecuteScalar();
|
||||
if (val != null)
|
||||
retData.Add(x+i,double.Parse(val.ToString()));
|
||||
}
|
||||
|
||||
/*
|
||||
using (SQLiteDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
|
||||
while(reader.Read())
|
||||
retData = Double.Parse(reader[0].ToString());
|
||||
// retData = double.Parse(reader[0].ToString());
|
||||
|
||||
|
||||
}*/
|
||||
// }
|
||||
// return retData;
|
||||
// }
|
||||
//public double getData(int x, UInt16 Path)
|
||||
//{
|
||||
// double retData = 0;
|
||||
// using (SQLiteCommand commandMaingraph = new SQLiteCommand(connectionMaingraph))
|
||||
// {
|
||||
|
||||
// //command.CommandText = "SELECT y FROM graphdata where x = " + x;
|
||||
|
||||
// switch (Path)
|
||||
// {
|
||||
// case Constants.PATH0:
|
||||
// commandMaingraph.CommandText = "SELECT PATH0 FROM graphdata where x = " + x;
|
||||
// break;
|
||||
// case Constants.PATH1:
|
||||
// commandMaingraph.CommandText = "SELECT PATH1 FROM graphdata where x = " + x;
|
||||
// break;
|
||||
// case Constants.PATH2:
|
||||
// commandMaingraph.CommandText = "SELECT PATH2 FROM graphdata where x = " + x;
|
||||
// break;
|
||||
|
||||
// }
|
||||
|
||||
// object val = commandMaingraph.ExecuteScalar();
|
||||
// if (val != null)
|
||||
// retData = double.Parse(val.ToString());
|
||||
|
||||
// /*
|
||||
// using (SQLiteDataReader reader = command.ExecuteReader())
|
||||
// {
|
||||
|
||||
// while(reader.Read())
|
||||
// retData = Double.Parse(reader[0].ToString());
|
||||
// // retData = double.Parse(reader[0].ToString());
|
||||
|
||||
|
||||
// }*/
|
||||
// }
|
||||
// return retData;
|
||||
//}
|
||||
/*
|
||||
public List<Tuple<int,double>> getData(int lineid)
|
||||
{
|
||||
var retData = new List<Tuple<int, double>>();
|
||||
using (SQLiteCommand command = new SQLiteCommand(connection))
|
||||
{
|
||||
command.CommandText = "SELECT x,y FROM graphdata where lineid = " + lineid + " ORDER BY id DESC";
|
||||
|
||||
using (SQLiteDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
retData.Add(Tuple.Create(int.Parse(reader[0].ToString()), double.Parse(reader[1].ToString())));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return retData;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Net.Native.SharedLibrary-arm" version="2.0.0" targetFramework="net461" developmentDependency="true" />
|
||||
<package id="Microsoft.Office.Interop.Word" version="15.0.4797.1003" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="11.0.1" targetFramework="net461" />
|
||||
<package id="NLog" version="4.5.6" targetFramework="net461" />
|
||||
<package id="PDFsharp-MigraDoc-GDI" version="1.32.4334.0" targetFramework="net461" />
|
||||
<package id="ZedGraph" version="5.1.7" targetFramework="net461" />
|
||||
</packages>
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
gwbasic mpstneu
|
||||
exit
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user