Merge remote-tracking branch 'origin/fix_databindings'

# Conflicts:
#	SanSystem/UCInliner.cs
This commit is contained in:
Husky
2018-07-11 19:24:43 +02:00
20 changed files with 927 additions and 21 deletions

View File

@@ -12,6 +12,8 @@ using System.Diagnostics;
using System.IO;
using SanShared;
using FluentFTP;
using System.Collections;
using Syncfusion.Windows.Forms.Chart;
namespace SanSystem
{
@@ -196,5 +198,124 @@ namespace SanSystem
}
}
}
private void button1_Click(object sender, EventArgs e)
{
Hashtable grunddaten = new Hashtable()
{
{"KL_Wetter","Trocken" }
};
List<BilderObject> bilderO = new List<BilderObject>();
bilderO.Add(new BilderObject()
{
ImgID = 1,
Kommentar = "TestBild",
Path = @"C:\Users\Damian\Desktop\SanVerwaltung\SanSystem\bin\Debug\projekte\18-850\SW01-SW02\Schachtanbindung\4d0a1627-bd51-48d6-a27e-a4c6691b02d2.jpg"
});
BerichtGen.Options options = new BerichtGen.Options("", "", "", grunddaten,bilderO);
options.ShowDialog();
}
private static ChartControl getGraph(string csvFile)
{
Size size = new Size(600, 400);
ChartControl chartControl = new ChartControl();
chartControl.Size = size;
ChartAxis axis = chartControl.PrimaryYAxis;
ChartAxis axis0 = new ChartAxis(ChartOrientation.Vertical);
ChartAxis axis1 = new ChartAxis(ChartOrientation.Vertical);
ChartAxisLayout layout1 = new ChartAxisLayout();
ChartAxisLayout layout2 = new ChartAxisLayout();
chartControl.Axes.Add(axis0);
chartControl.Axes.Add(axis1);
layout1.Spacing = 12;
layout2.Spacing = 12;
layout1.Axes.Add(axis);
layout2.Axes.Add(axis0);
layout2.Axes.Add(axis1);
chartControl.ChartArea.YLayouts.Add(layout1);
chartControl.ChartArea.YLayouts.Add(layout2);
ChartSeries temperaturChart = new ChartSeries("Temperatur", ChartSeriesType.Line);
ChartSeries druckChart = new ChartSeries("Druck", ChartSeriesType.Line);
if (!File.Exists(csvFile)) return null;
string[] input = File.ReadAllLines(csvFile);
int counter = 0;
foreach (string pars in input)
{
string[] parts = pars.Split(',');
if (parts[0].Equals("Group1") || parts[1].Equals("(END)")) continue;
double temperatur = double.Parse(parts[1].Replace('.', ','));
double druck = double.Parse(parts[2].Replace('.', ','));
temperaturChart.Points.Add(counter, temperatur);
druckChart.Points.Add(counter, druck);
counter++;
}
temperaturChart.YAxis = axis;
druckChart.YAxis = axis0;
axis.Title = "°C";
axis.TitleFont = new Font("Segeo UI", 14F);
axis0.Title = "[bar]";
axis0.TitleFont = new Font("Segeo UI", 14F);
chartControl.LegendsPlacement = ChartPlacement.Outside;
chartControl.LegendPosition = ChartDock.Bottom;
chartControl.LegendAlignment = ChartAlignment.Center;
chartControl.Title.Visible = false;
ChartAxis chartAxis = new ChartAxis();
chartAxis.Orientation = ChartOrientation.Horizontal;
chartAxis.Range = new MinMaxInfo(0, 6, 1);
chartAxis.DrawGrid = false;
chartAxis.LineType.Width = 1F;
chartAxis.LineType.ForeColor = Color.Black;
chartControl.Axes.Add(chartAxis);
chartControl.Series.Add(temperaturChart);
chartControl.Series.Add(druckChart);
chartControl.Skins = Skins.Metro;
axis1.OpposedPosition = true;
axis.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift;
axis0.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift;
axis1.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift;
return chartControl;
}
private void btn_create_graph_Click(object sender, EventArgs e)
{
Stopwatch watch = new Stopwatch();
string myPath = Path.Combine(destinationPath, "Trend");
IEnumerable<string> files = Directory.EnumerateFiles(myPath, "*.csv", SearchOption.AllDirectories);
ChartControl chart = getGraph(files.Last());
if (chart == null) MessageBox.Show("Konnte CSV nicht finden!");
else
chart.SaveImage(Path.Combine(destinationPath, "linerGraph.jpg"));
watch.Stop();
MessageBox.Show((watch.ElapsedTicks) + " s");
}
private void btn_create_protokol_Click(object sender, EventArgs e)
{
Hashtable hashtable = inliner.MakeProtokoll(destinationPath);
BerichtGen.Options options = new BerichtGen.Options("JUME", "liner_einbau.docx", "./", hashtable, new List<BilderObject>());
options.ShowDialog();
}
}
}