public static void MakeChartsAndPDF(CalculationProfiler calculationProfiler, string resultPath) { Exception innerException = null; var t = new Thread(() => { try { SqlResultLoggingService srls = new SqlResultLoggingService(resultPath); CalcParameterLogger cpl = new CalcParameterLogger(srls); InputDataLogger idl = new InputDataLogger(Array.Empty <IDataSaverBase>()); var calcParameters = cpl.Load(); Logger.Info("Checking for charting parameters"); if (!calcParameters.IsSet(CalcOption.MakePDF) && !calcParameters.IsSet(CalcOption.MakeGraphics)) { Logger.Info("No charts wanted"); return; } calculationProfiler.StartPart(Utili.GetCurrentMethodAndClass() + " - Charting"); using (FileFactoryAndTracker fileFactoryAndTracker = new FileFactoryAndTracker(resultPath, "Name", idl)) { calculationProfiler.StartPart(Utili.GetCurrentMethodAndClass() + " - Chart Generator RunAll"); ChartCreationParameters ccp = new ChartCreationParameters(144, 1600, 1000, false, calcParameters.CSVCharacter, new DirectoryInfo(resultPath)); var cg = new ChartGeneratorManager(calculationProfiler, fileFactoryAndTracker, ccp); cg.Run(resultPath); calculationProfiler.StopPart(Utili.GetCurrentMethodAndClass() + " - Chart Generator RunAll"); if (calcParameters.IsSet(CalcOption.MakePDF)) { calculationProfiler.StartPart(Utili.GetCurrentMethodAndClass() + " - PDF Creation"); Logger.ImportantInfo( "Creating the PDF. This will take a really long time without any progress report..."); MigraPDFCreator mpc = new MigraPDFCreator(calculationProfiler); mpc.MakeDocument(resultPath, "", false, false, calcParameters.CSVCharacter, fileFactoryAndTracker); calculationProfiler.StopPart(Utili.GetCurrentMethodAndClass() + " - PDF Creation"); } } Logger.Info("Finished making the charts"); calculationProfiler.StopPart(Utili.GetCurrentMethodAndClass() + " - Charting"); CalculationDurationFlameChart cdfc = new CalculationDurationFlameChart(); cdfc.Run(calculationProfiler, resultPath, "CalcManager"); } catch (Exception ex) { innerException = ex; Logger.Exception(ex); } }); t.SetApartmentState(ApartmentState.STA); t.Start(); t.Join(); if (innerException != null) { Logger.Error("Exception during the PDF creation!"); Logger.Exception(innerException); throw innerException; } }
public void MakeDocumentTestFull() { var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass()); var name = cs.StartHousehold(1, GlobalConsts.CSVCharacter, LoadTypePriority.All, null, x => x.ApplyOptionDefault(OutputFileDefault.All)); CalculationProfiler cp = new CalculationProfiler(); ChartCreationParameters ccp = new ChartCreationParameters(144, 1600, 1000, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir)); using (FileFactoryAndTracker fft = cs.GetFileTracker()) { var cg = new ChartGeneratorManager(cp, fft, ccp); Logger.Info("Making picture"); cg.Run(cs.DstDir); Logger.Info("finished picture"); MigraPDFCreator mpc = new MigraPDFCreator(cp); mpc.MakeDocument(cs.DstDir, name + ".test", false, false, GlobalConsts.CSVCharacter, fft); } //cs.CleanUp(1); }
public void MakeFullPDFDocumentTest() { //const bool blub = true; //// doesn't work on the testing server somehow //if (blub) // return; Config.ReallyMakeAllFilesIncludingBothSums = true; var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass()); var name = cs.StartHousehold(1, GlobalConsts.CSVCharacter, LoadTypePriority.Mandatory, null, x => { x.ApplyOptionDefault(OutputFileDefault.All); x.CarpetPlotWidth = 7; x.Disable(CalcOption.MakeGraphics); x.Disable(CalcOption.MakePDF); }); CalculationProfiler cp = new CalculationProfiler(); ChartCreationParameters ccp = new ChartCreationParameters(144, 1600, 1000, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir)); using (var fft = cs.GetFileTracker()) { var cg = new ChartGeneratorManager(cp, fft, ccp); Logger.Info("Making picture"); cg.Run(cs.DstDir); Logger.Info("finished picture"); MigraPDFCreator mpc = new MigraPDFCreator(cp); mpc.MakeDocument(cs.DstDir, name + ".test", false, true, GlobalConsts.CSVCharacter, fft); } Thread.Sleep(5000); cs.CleanUp(); #pragma warning restore CS0162 // Unreachable code detected #pragma warning restore VSD0020 // The condition is a constant and thus unnecessary. #pragma warning restore S2583 // Conditions should not unconditionally evaluate to "true" or to "false" #pragma warning restore RECS0110 // Condition is always 'true' or always 'false' }
public void MakeDocumentTest() { var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass()); var name = cs.StartHousehold(1, GlobalConsts.CSVCharacter, LoadTypePriority.Mandatory, null, x => { x.Enable(CalcOption.TotalsPerLoadtype); x.Enable(CalcOption.HouseholdContents); }); CalculationProfiler cp = new CalculationProfiler(); ChartCreationParameters ccp = new ChartCreationParameters(144, 1600, 1000, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir)); using (var fft = cs.GetFileTracker()) { var cg = new ChartGeneratorManager(cp, fft, ccp); Logger.Info("Making picture"); cg.Run(cs.DstDir); Logger.Info("finished picture"); MigraPDFCreator mpc = new MigraPDFCreator(cp); mpc.MakeDocument(cs.DstDir, name + ".test", false, false, GlobalConsts.CSVCharacter, fft); } cs.CleanUp(1); }