From 6d377b8aa72f7367658e0bb6fc88fd36e4c8584d Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Sat, 15 Feb 2020 12:21:00 +0100 Subject: [PATCH] Ok demo mode... --- LPA/LPA.csproj | 4 +- LPA/MainForm.cs | 58 ++++++++++++++++++++++++++- LPA/{demo => reports}/DemoA4.rdlc | 0 LPA/{demo => reports}/DemoLetter.rdlc | 0 4 files changed, 59 insertions(+), 3 deletions(-) rename LPA/{demo => reports}/DemoA4.rdlc (100%) rename LPA/{demo => reports}/DemoLetter.rdlc (100%) diff --git a/LPA/LPA.csproj b/LPA/LPA.csproj index b2d47f6..44c95bc 100644 --- a/LPA/LPA.csproj +++ b/LPA/LPA.csproj @@ -170,10 +170,10 @@ - + Always - + Always diff --git a/LPA/MainForm.cs b/LPA/MainForm.cs index 7780771..83b5fb8 100644 --- a/LPA/MainForm.cs +++ b/LPA/MainForm.cs @@ -38,7 +38,14 @@ namespace LPA /// /// File conf x setup code /// - protected string qSetFilePath = "queueSetup.json"; + protected string qSetFilePath + { + get + { + string answ = demoMode ? "queueSetupDemo.json" : "queueSetup.json"; + return answ; + } + } /// /// Configurazione CORRENTE delle code di stampa (coda --> printer disponibile) /// @@ -462,7 +469,55 @@ namespace LPA /// private void printDemoToolStripMenuItem_Click(object sender, EventArgs e) { + string rawData = ""; + string filePath = ""; // leggo da file locale e chiamo procedura di stampa! + if (demoMode) + { + // se ho stampe in coda --> verifico code gestite + foreach (var coda in queueSetupConf) + { + filePath = $"{baseDir}demo\\{coda.Key}.json"; + rawData = File.ReadAllText(filePath); + if (!string.IsNullOrEmpty(rawData)) + { + // deserializzo + List report2print = JsonConvert.DeserializeObject>(rawData); + if (report2print != null) + { + // aggiorno contatore... + coda.Value.NumWaiting = report2print.Count; + // verifico sia RUNNING... + if (coda.Value.isRunning) + { + // verifico non ci sia veto print.. + DateTime adesso = DateTime.Now; + if (vetoPrint < adesso) + { + vetoPrint = adesso.AddSeconds(300); + foreach (var item in report2print) + { + reportPrinter rPrint = new reportPrinter(); + bool fatto = false; + bool fattoPdf = false; + // se ho almeno 1 stampa --> lancio! + queueConf confCoda = listQueue.Find(conf => conf.name == coda.Key); + if (confCoda != null) + { + fatto = rPrint.printReport(confCoda.template, confCoda.rdsName, localReportPath, coda.Value.Printer, item.rdsTable, confCoda.deviceInfoParam, true); + } + } + vetoPrint = adesso; + } + } + } + } + } + + + } + + } private void btnDemo_Click(object sender, EventArgs e) @@ -480,6 +535,7 @@ namespace LPA btnDemo.Text = demoMode ? "Exit Demo" : "Demo"; setupButtons(); // aggiorno code... + setupQueuePrinter(); refreshQueueAvail(); } diff --git a/LPA/demo/DemoA4.rdlc b/LPA/reports/DemoA4.rdlc similarity index 100% rename from LPA/demo/DemoA4.rdlc rename to LPA/reports/DemoA4.rdlc diff --git a/LPA/demo/DemoLetter.rdlc b/LPA/reports/DemoLetter.rdlc similarity index 100% rename from LPA/demo/DemoLetter.rdlc rename to LPA/reports/DemoLetter.rdlc