KlassenDLL im Main integriert

This commit is contained in:
HuskyTeufel
2022-04-20 14:59:34 +02:00
parent 70ec1019cd
commit d2537d1a75
122 changed files with 16199 additions and 1165 deletions

View File

@@ -0,0 +1,236 @@
using SanShared;
using Syncfusion.DocIO.DLS;
using Syncfusion.DocToPDFConverter;
using Syncfusion.Pdf;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BerichtGen
{
class Bericht
{
private List<Image> _listImages;
/// <summary>
/// Erstellt
/// </summary>
/// <param name="source">Die zuverwendete Vorlagenname</param>
/// <param name="savepath">Pfad zum Speichern</param>
/// <param name="filename"></param>
/// <param name="daten"></param>
/// <param name="bilderObjects">Zur zeit ohne Implementierung</param>
/// <param name="tableContents">Für Tabellen anzeige</param>
/// <param name="erzeugeDOC">Ein doc datei soll erzeugt werden</param>
/// <param name="erzeugePDF">Ein Pdf datei soll erzeugt werden</param>
public void Erzeuge(string source, string savepath,string filename, Hashtable daten,List<BilderObject> bilderObjects,DataTable tableContents, bool erzeugeDOC = false , bool erzeugePDF = true)
{
if (bilderObjects != null)
{
_listImages = new List<Image>();
foreach (BilderObject current in bilderObjects)
{
Image image = Image.FromFile(current.Path);
_listImages.Add(ResizeImage(image, CalculateImageSizeForDocument(image.Height, image.Width)));
image.Dispose();
}
}
WordDocument wordDocument = new WordDocument(source);
string[] fieldnames = null;
string[] fieldvalues = null;
if(fieldnames == null || fieldvalues == null)
{
fieldnames = new string[daten.Count];
fieldvalues = new string[daten.Count];
}
uint counter = 0;
foreach(DictionaryEntry hashtable in daten)
{
fieldnames[counter] = hashtable.Key.ToString();
if (hashtable.Value == null)
{
fieldvalues[counter] = "";
}
else
{
fieldvalues[counter] = hashtable.Value.ToString();
}
counter++;
}
wordDocument.MailMerge.MergeImageField += new MergeImageFieldEventHandler(MailMerge_MergeImageField);
if (tableContents != null)
wordDocument.MailMerge.ExecuteGroup(tableContents);
wordDocument.MailMerge.Execute(fieldnames, fieldvalues);
IWParagraph iWParagraph = null;
var x = wordDocument.Sections;
foreach(IWSection section in wordDocument.Sections)
{
IWParagraphCollection paragraphs = section.Paragraphs;
foreach(IWParagraph item2 in paragraphs)
{
if (item2.Text.StartsWith("@WeitereBilder")) {
iWParagraph = item2;
if(bilderObjects.Count > 0)
{
//section.ChildEntities.Clear();
iWParagraph.Text = "Bilddokumentation der Sanierung";
iWParagraph.AppendBreak(BreakType.LineBreak);
IWTable wTable = section.Body.AddTable();
wTable.ResetCells(1, 2);
wTable.TableFormat.IsAutoResized = true;
wTable.TableFormat.IsBreakAcrossPages = false;
wTable.TableFormat.Borders.BorderType = BorderStyle.Dot;
WTableRow wTableRow = wTable.Rows[0];
bool flag = false;
int num = -1;
foreach (BilderObject foto in bilderObjects)
{
if (num == -1)
num++;
if (flag)
{
wTableRow = wTable.AddRow();
flag = false;
}
int index = 1;
if (num % 2 == 0)
{
index = 0;
flag = false;
}
else
{
flag = true;
}
iWParagraph = wTableRow.Cells[index].AddParagraph();
Image image2 = _listImages[num];
if (image2 != null)
{
iWParagraph.AppendPicture(image2);
if (foto != null)
{
iWParagraph.AppendBreak(BreakType.LineBreak);
IWTextRange wTextRange = iWParagraph.AppendText(foto.Kommentar);
wTextRange.CharacterFormat.FontName = "Arial";
wTextRange.CharacterFormat.FontSize = 10f;
}
}
num++;
}
}
else
{
iWParagraph.Text = "";
}
break;
}
}
}
if(erzeugeDOC)
wordDocument.Save(Path.Combine(savepath,string.Format("{0}.doc",filename)), Syncfusion.DocIO.FormatType.Doc);
if (erzeugePDF)
{
string speichername = Path.Combine(savepath, string.Format("{0}.pdf", filename));
DocToPDFConverter docToPDFConverter = new DocToPDFConverter();
PdfDocument pdf = docToPDFConverter.ConvertToPDF(wordDocument);
try
{
pdf.Save(speichername);
}
catch
{
}
finally
{
//pdf.Dispose();
}
}
}
private readonly double _cmPixel = 0.393700787;
private readonly int _dpi = 120;
private readonly double _imgWidthCmMax = 8.0;
private Size CalculateImageSizeForDocument(int height, int width)
{
double num = (double)height / (double)width;
double num2 = this._imgWidthCmMax * num;
int h = (int)(num2 * _cmPixel * (double)_dpi);
int w = (int)(_imgWidthCmMax * _cmPixel * (double)_dpi);
return new Size(w, h);
}
private Image ResizeImage(Image image, Size size)
{
int width = image.Width;
int height = image.Height;
float num = (float)size.Width / (float)width;
float num2 = (float)size.Height / (float)height;
float num3 = (num2 < num) ? num2 : num;
int width2 = (int)((float)width * num3);
int height2 = (int)((float)height * num3);
Bitmap bitmap = new Bitmap(width2, height2);
try
{
bitmap.SetResolution(120f, 120f);
Graphics graphics = Graphics.FromImage(bitmap);
graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
graphics.DrawImage(image, 0, 0, width2, height2);
graphics.Dispose();
}
catch(Exception)
{
}
finally
{
System.GC.Collect();
}
return bitmap;
}
private void MailMerge_MergeImageField(object sender, MergeImageFieldEventArgs args)
{
if(args.FieldName == "UVImageTemp" || args.FieldName == "UVImageDruck" || args.FieldName == "UVImageSpeed")
{
string source = args.FieldValue.ToString();
if (!File.Exists(source)) return;
args.Image = Image.FromFile(source);
}
}
}
}

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BerichtGen
{
public class BerichtWorker
{
public static Image resizeImage(Image imgToResize, Size size)
{
int width = imgToResize.Width;
int height = imgToResize.Height;
float scale = 0f;
float newWidth = 0f;
float newHeight = 0f;
newWidth = (float)size.Width / (float)width;
newHeight = (float)size.Height / (float)height;
scale = ((!(newHeight < newWidth)) ? newWidth : newHeight);
int width2 = (int)((float)width * scale);
int height2 = (int)((float)height * scale);
Bitmap bitmap = new Bitmap(width2, height2);
Graphics graphics = Graphics.FromImage(bitmap);
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.DrawImage(imgToResize, 0, 0, width2, height2);
graphics.Dispose();
return bitmap;
}
}
}

View File

@@ -0,0 +1,136 @@
namespace BerichtGen
{
partial class FrmOptions
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btn_start = new System.Windows.Forms.Button();
this.cb_doc = new System.Windows.Forms.CheckBox();
this.cb_pdf = new System.Windows.Forms.CheckBox();
this.rb_yes = new System.Windows.Forms.RadioButton();
this.rb_no = new System.Windows.Forms.RadioButton();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// btn_start
//
this.btn_start.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btn_start.Location = new System.Drawing.Point(374, 12);
this.btn_start.Name = "btn_start";
this.btn_start.Size = new System.Drawing.Size(91, 74);
this.btn_start.TabIndex = 0;
this.btn_start.Text = "Bericht erzeugen";
this.btn_start.UseVisualStyleBackColor = true;
this.btn_start.Click += new System.EventHandler(this.btn_start_Click);
//
// cb_doc
//
this.cb_doc.AutoSize = true;
this.cb_doc.Enabled = false;
this.cb_doc.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cb_doc.Location = new System.Drawing.Point(6, 12);
this.cb_doc.Name = "cb_doc";
this.cb_doc.Size = new System.Drawing.Size(173, 24);
this.cb_doc.TabIndex = 1;
this.cb_doc.Text = "DOC datei erzeugen";
this.cb_doc.UseVisualStyleBackColor = true;
//
// cb_pdf
//
this.cb_pdf.AutoSize = true;
this.cb_pdf.Checked = true;
this.cb_pdf.CheckState = System.Windows.Forms.CheckState.Checked;
this.cb_pdf.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cb_pdf.Location = new System.Drawing.Point(6, 35);
this.cb_pdf.Name = "cb_pdf";
this.cb_pdf.Size = new System.Drawing.Size(131, 24);
this.cb_pdf.TabIndex = 2;
this.cb_pdf.Text = "PDF erzeugen";
this.cb_pdf.UseVisualStyleBackColor = true;
//
// rb_yes
//
this.rb_yes.AutoSize = true;
this.rb_yes.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.rb_yes.Location = new System.Drawing.Point(221, 62);
this.rb_yes.Name = "rb_yes";
this.rb_yes.Size = new System.Drawing.Size(39, 24);
this.rb_yes.TabIndex = 3;
this.rb_yes.TabStop = true;
this.rb_yes.Text = "ja";
this.rb_yes.UseVisualStyleBackColor = true;
//
// rb_no
//
this.rb_no.AutoSize = true;
this.rb_no.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.rb_no.Location = new System.Drawing.Point(266, 62);
this.rb_no.Name = "rb_no";
this.rb_no.Size = new System.Drawing.Size(57, 24);
this.rb_no.TabIndex = 4;
this.rb_no.TabStop = true;
this.rb_no.Text = "nein";
this.rb_no.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(2, 62);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(202, 20);
this.label1.TabIndex = 5;
this.label1.Text = "Nach dem erzeugen öffnen";
//
// FrmOptions
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(477, 97);
this.Controls.Add(this.label1);
this.Controls.Add(this.rb_no);
this.Controls.Add(this.rb_yes);
this.Controls.Add(this.cb_pdf);
this.Controls.Add(this.cb_doc);
this.Controls.Add(this.btn_start);
this.Name = "FrmOptions";
this.Text = "Options";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btn_start;
private System.Windows.Forms.CheckBox cb_doc;
private System.Windows.Forms.CheckBox cb_pdf;
private System.Windows.Forms.RadioButton rb_yes;
private System.Windows.Forms.RadioButton rb_no;
private System.Windows.Forms.Label label1;
}
}

View File

@@ -0,0 +1,107 @@
using SanShared;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BerichtGen
{
/// <summary>
///
/// </summary>
public partial class FrmOptions : Form
{
Thread generateProtokollThread;
Hashtable grundDaten;
string firma;
string vorlage;
string speicherpfad;
string source;
string filename;
bool hidden = false;
List<BilderObject> bilderObjects;
DataTable tableContent = null;
/// <summary>
///
/// </summary>
/// <param name="firma"></param>
/// <param name="vorlage"></param>
/// <param name="speicherpfad"></param>
/// <param name="filename"></param>
/// <param name="grunddaten"></param>
/// <param name="bilderObjects"></param>
/// <param name="tableContent"></param>
public FrmOptions(string firma, string vorlage, string speicherpfad, string filename, Hashtable grunddaten, List<BilderObject> bilderObjects, DataTable tableContent = null, bool hidden = false)
{
InitializeComponent();
Dongle dongle = new Dongle(60);
Trace.WriteLine("FrmOptions: " + dongle.SyncfusionKey);
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense(dongle.SyncfusionKey);
dongle.CleanDongle();
this.firma = firma;
this.vorlage = vorlage;
this.speicherpfad = speicherpfad;
this.grundDaten = grunddaten;
this.bilderObjects = bilderObjects;
this.tableContent = tableContent;
this.source = Path.Combine("documents", firma, vorlage);
this.filename = filename;
this.hidden = hidden;
if(hidden)
{
GenerateBericht();
}
}
void Gen()
{
Bericht bericht = new Bericht();
bericht.Erzeuge(source, speicherpfad,filename, grundDaten, bilderObjects, tableContent,cb_doc.Checked,cb_pdf.Checked);
}
private void GenerateBericht()
{
generateProtokollThread = new Thread(Gen);
generateProtokollThread.IsBackground = true;
generateProtokollThread.Start();
while (generateProtokollThread.IsAlive)
{
}
if (rb_yes.Checked && cb_pdf.Checked && !hidden)
{
string pfad = Path.Combine(speicherpfad, string.Format("{0}.pdf", filename));
Process process = new Process();
process.StartInfo.FileName = "explorer";
process.StartInfo.Arguments = pfad;
//** Verbuggt
FrmPDFViewer frmPDFViewer = new FrmPDFViewer(pfad);
frmPDFViewer.ShowDialog();
}
}
private void btn_start_Click(object sender, EventArgs e)
{
GenerateBericht();
this.Close();
}
}
}

View File

@@ -0,0 +1,120 @@
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
<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" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</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" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,97 @@
namespace BerichtGen
{
partial class FrmPDFViewer
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
Syncfusion.Windows.Forms.PdfViewer.MessageBoxSettings messageBoxSettings1 = new Syncfusion.Windows.Forms.PdfViewer.MessageBoxSettings();
Syncfusion.Windows.PdfViewer.PdfViewerPrinterSettings pdfViewerPrinterSettings1 = new Syncfusion.Windows.PdfViewer.PdfViewerPrinterSettings();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmPDFViewer));
Syncfusion.Windows.Forms.PdfViewer.TextSearchSettings textSearchSettings1 = new Syncfusion.Windows.Forms.PdfViewer.TextSearchSettings();
this.pdfViewerControl = new Syncfusion.Windows.Forms.PdfViewer.PdfViewerControl();
this.SuspendLayout();
//
// pdfViewerControl
//
this.pdfViewerControl.CursorMode = Syncfusion.Windows.Forms.PdfViewer.PdfViewerCursorMode.SelectTool;
this.pdfViewerControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.pdfViewerControl.EnableContextMenu = true;
this.pdfViewerControl.EnableNotificationBar = true;
this.pdfViewerControl.HorizontalScrollOffset = 0;
this.pdfViewerControl.IsBookmarkEnabled = false;
this.pdfViewerControl.IsTextSearchEnabled = false;
this.pdfViewerControl.IsTextSelectionEnabled = false;
this.pdfViewerControl.Location = new System.Drawing.Point(0, 0);
this.pdfViewerControl.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
messageBoxSettings1.EnableNotification = true;
this.pdfViewerControl.MessageBoxSettings = messageBoxSettings1;
this.pdfViewerControl.MinimumZoomPercentage = 50;
this.pdfViewerControl.Name = "pdfViewerControl";
this.pdfViewerControl.PageBorderThickness = 1;
pdfViewerPrinterSettings1.PageOrientation = Syncfusion.Windows.PdfViewer.PdfViewerPrintOrientation.Auto;
pdfViewerPrinterSettings1.PageSize = Syncfusion.Windows.PdfViewer.PdfViewerPrintSize.ActualSize;
pdfViewerPrinterSettings1.PrintLocation = ((System.Drawing.PointF)(resources.GetObject("pdfViewerPrinterSettings1.PrintLocation")));
pdfViewerPrinterSettings1.ShowPrintStatusDialog = true;
this.pdfViewerControl.PrinterSettings = pdfViewerPrinterSettings1;
this.pdfViewerControl.ReferencePath = null;
this.pdfViewerControl.ScrollDisplacementValue = 0;
this.pdfViewerControl.ShowHorizontalScrollBar = true;
this.pdfViewerControl.ShowToolBar = true;
this.pdfViewerControl.ShowVerticalScrollBar = true;
this.pdfViewerControl.Size = new System.Drawing.Size(851, 922);
this.pdfViewerControl.SpaceBetweenPages = 8;
this.pdfViewerControl.TabIndex = 0;
this.pdfViewerControl.Text = "pdfViewerControl1";
textSearchSettings1.CurrentInstanceColor = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(255)))), ((int)(((byte)(171)))), ((int)(((byte)(64)))));
textSearchSettings1.HighlightAllInstance = true;
textSearchSettings1.OtherInstanceColor = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(254)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
this.pdfViewerControl.TextSearchSettings = textSearchSettings1;
this.pdfViewerControl.VerticalScrollOffset = 0;
this.pdfViewerControl.VisualStyle = Syncfusion.Windows.Forms.PdfViewer.VisualStyle.Default;
this.pdfViewerControl.ZoomMode = Syncfusion.Windows.Forms.PdfViewer.ZoomMode.FitPage;
//
// FrmPDFViewer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.ClientSize = new System.Drawing.Size(851, 922);
this.Controls.Add(this.pdfViewerControl);
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.Name = "FrmPDFViewer";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "FrmPDFViewer";
this.Load += new System.EventHandler(this.FrmPDFViewer_Load);
this.ResumeLayout(false);
}
#endregion
private Syncfusion.Windows.Forms.PdfViewer.PdfViewerControl pdfViewerControl;
}
}

View File

@@ -0,0 +1,34 @@
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;
namespace BerichtGen
{
/// <summary>
///
/// </summary>
public partial class FrmPDFViewer : Form
{
string pfad;
/// <summary>
///
/// </summary>
/// <param name="pfad"></param>
public FrmPDFViewer(string pfad)
{
InitializeComponent();
this.pfad = pfad;
}
private void FrmPDFViewer_Load(object sender, EventArgs e)
{
pdfViewerControl.Load(pfad);
}
}
}

View File

@@ -0,0 +1,127 @@
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
<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" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</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" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="pdfViewerPrinterSettings1.PrintLocation" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0
dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJh
d2luZy5Qb2ludEYCAAAAAXgBeQAACwsCAAAAAAAAAAAAAAAL
</value>
</data>
</root>

View File

@@ -0,0 +1,121 @@
using SanShared;
using Syncfusion.Windows.Forms.Chart;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BerichtGen
{
/// <summary>
///
/// </summary>
public static class makeGraphic
{
private static ChartControl getGraph(List<UVcsvStrukture> input, string type)
{
Size size = new Size(400, 300);
ChartControl chartControl = new ChartControl();
chartControl.Size = size;
ChartAxis axis = chartControl.PrimaryYAxis;
ChartAxisLayout layout1 = new ChartAxisLayout();
layout1.Spacing = 12;
layout1.Axes.Add(axis);
chartControl.ChartArea.YLayouts.Add(layout1);
ChartSeries mychart = new ChartSeries(type, ChartSeriesType.Line);
int counter = 0;
foreach (UVcsvStrukture pars in input)
{
if (type.Equals("Temperatur"))
mychart.Points.Add(counter, pars.Temperatur);
else if (type.Equals("Druck"))
mychart.Points.Add(counter, pars.Druck);
else if (type.Equals("Geschwindigkeit"))
mychart.Points.Add(counter, pars.Geschwindigkeit);
else
throw new Exception("Kein gültiger Aufruf");
counter++;
}
mychart.YAxis = axis;
switch (type)
{
case "Temperatur":
axis.Title = "°C";
break;
case "Druck":
axis.Title = "[mbar]";
break;
case "Geschwindigkeit":
axis.Title = "[cm]";
break;
}
axis.TitleFont = new Font("Segeo UI", 14F);
chartControl.LegendsPlacement = ChartPlacement.Outside;
chartControl.LegendPosition = ChartDock.Bottom;
chartControl.LegendAlignment = ChartAlignment.Center;
chartControl.Title.Visible = false;
chartControl.Series.Add(mychart);
chartControl.Skins = Skins.Metro;
axis.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift;
return chartControl;
}
/// <summary>
/// Erstellt die Drucksverlauf kurve
/// </summary>
/// <param name="struktures"></param>
/// <param name="destinationPath"></param>
/// <returns></returns>
public static bool GetGraphics(List<UVcsvStrukture> struktures,string destinationPath)
{
Dongle dongle = new Dongle(60);
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense(dongle.SyncfusionKey);
dongle.CleanDongle();
ChartControl tempChart = getGraph(struktures, "Temperatur");
if (tempChart == null) return false;
else
tempChart.SaveImage(Path.Combine(destinationPath, "linerGraph_temp.jpg"));
ChartControl druckChart = getGraph(struktures, "Druck");
if (druckChart == null) return false;
else
druckChart.SaveImage(Path.Combine(destinationPath, "linerGraph_druck.jpg"));
ChartControl speedChart = getGraph(struktures, "Geschwindigkeit");
if (speedChart == null) return false;
else
speedChart.SaveImage(Path.Combine(destinationPath, "linerGraph_speed.jpg"));
return true;
}
}
}