Protokolll inhalt erweitert

This commit is contained in:
Husky
2018-07-14 15:57:50 +02:00
parent 2ee98ea823
commit 85607e926c
12 changed files with 134 additions and 90 deletions

View File

@@ -111,10 +111,11 @@ namespace SanSystem
private void btn_get_temp_Click(object sender, EventArgs e)
{
ITemperature temperature = TempCAN.TemperaturBuilder.Temperatur(TempCAN.TemperaturSchnittstellen.TINKERFORGE);
double temperatur = temperature.GetTemperatur();
string message = "";
double temperatur = temperature.GetTemperatur(out message);
inliner.TempAusen = temperatur;
if (!message.Equals("")) MessageBox.Show(message);
txt_temp_aussen.Update();
}
@@ -163,7 +164,7 @@ namespace SanSystem
string ordner = _tdateiname[_tdateiname.Length - 2];
newClient.DownloadFile(Path.Combine(destinationPath, ordner, dateiname), file);
//client.DeleteFile(file);
newClient.DeleteFile(file);
}
}
@@ -177,7 +178,7 @@ namespace SanSystem
private void btn_transfer_ftp_Click(object sender, EventArgs e)
{
filenames.Clear();
if (MessageBox.Show("Bitte stellen Sie sicher, dass der Server antwortet und dass nur die Dateien vorhanden sind!", "WARNUNG", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop) == DialogResult.OK)
if (MessageBox.Show("Bitte stellen Sie sicher, dass der Server antwortet und dass nur die Dateien vorhanden sind!, Bitte beachten Sie, dass das fenster einfrieren kann", "WARNUNG", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop) == DialogResult.OK)
{
DownloadFromUV();
}
@@ -199,25 +200,8 @@ 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.FrmOptions options = new BerichtGen.FrmOptions("", "", "","", grunddaten,bilderO);
options.ShowDialog();
}
private static ChartControl getGraph(string csvFile)
private static ChartControl getGraph(List<UVcsvStrukture> input)
{
Size size = new Size(600, 400);
@@ -245,21 +229,16 @@ namespace SanSystem
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)
foreach (UVcsvStrukture 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);
temperaturChart.Points.Add(counter, pars.Temperatur);
druckChart.Points.Add(counter, pars.Druck);
counter++;
}
temperaturChart.YAxis = axis;
druckChart.YAxis = axis0;
@@ -295,24 +274,32 @@ namespace SanSystem
return chartControl;
}
private void btn_create_graph_Click(object sender, EventArgs e)
{
Stopwatch watch = new Stopwatch();
private bool AccessCSV()
{
string myPath = Path.Combine(destinationPath, "Trend");
if (!Directory.Exists(myPath))
return false;
IEnumerable<string> files = Directory.EnumerateFiles(myPath, "*.csv", SearchOption.AllDirectories);
ChartControl chart = getGraph(files.Last());
if (chart == null) MessageBox.Show("Konnte CSV nicht finden!");
List<UVcsvStrukture> struktures = HelpFunktion.ParseCSVFile(files.Last());
inliner.AnfangAushaertung = struktures.Select(x => x.Zeitstempel).Min();
inliner.EndeAushaertung = struktures.Select(x => x.Zeitstempel).Max();
ChartControl chart = getGraph(struktures);
if (chart == null) return false;
else
chart.SaveImage(Path.Combine(destinationPath, "linerGraph.jpg"));
watch.Stop();
MessageBox.Show((watch.ElapsedTicks) + " s");
return true;
}
private void btn_create_protokol_Click(object sender, EventArgs e)
{
if(!AccessCSV())
{
MessageBox.Show("Warnung, es wurden keine Daten von der Anlage geladen, Grafik konnte nicht erstellt werden");
}
Hashtable hashtable = inliner.MakeProtokoll(destinationPath);
DirectoryInfo directory = Directory.GetParent(destinationPath);
string speicherpfad = directory.FullName;