diff --git a/Elwig/Dialogs/DeliveryConfirmationsDialog.xaml.cs b/Elwig/Dialogs/DeliveryConfirmationsDialog.xaml.cs index 071c08a..eceb179 100644 --- a/Elwig/Dialogs/DeliveryConfirmationsDialog.xaml.cs +++ b/Elwig/Dialogs/DeliveryConfirmationsDialog.xaml.cs @@ -93,7 +93,7 @@ namespace Elwig.Dialogs { """) .ToListAsync(); - using var doc = Document.Merge(list.Select(m => new DeliveryConfirmation(Context, Year, m, deliveries.Where(d => d.Delivery.MgNr == m.MgNr)))); ; + using var doc = Document.Merge(list.Select(m => new DeliveryConfirmation(Context, Year, m, deliveries.Where(d => d.Delivery.MgNr == m.MgNr).ToList()))); ; await doc.Generate(new Progress(v => { ProgressBar.Value = v; })); diff --git a/Elwig/Documents/Document.cshtml.cs b/Elwig/Documents/Document.cshtml.cs index ab2a5ca..c7d17e8 100644 --- a/Elwig/Documents/Document.cshtml.cs +++ b/Elwig/Documents/Document.cshtml.cs @@ -80,13 +80,14 @@ namespace Elwig.Documents { if (this is MergedDocument m) { var pdf = new TempFile("pdf"); var tmpHtmls = new List(); - var n = 0; + var n = m.Documents.Count(); + int i = 0; foreach (var doc in m.Documents) { var tmpHtml = new TempFile("html"); await File.WriteAllTextAsync(tmpHtml.FilePath, await doc.Render(), Utils.UTF8); tmpHtmls.Add(tmpHtml); - n++; - progress?.Report(50.0 * n / m.Documents.Count()); + i++; + progress?.Report(50.0 * i / n); } progress?.Report(50.0); await Pdf.Convert(tmpHtmls.Select(f => f.FilePath), pdf.FilePath, new Progress(v => progress?.Report(50.0 + v / 2))); diff --git a/Elwig/Documents/Pdf.cs b/Elwig/Documents/Pdf.cs index 3eb704a..377cafb 100644 --- a/Elwig/Documents/Pdf.cs +++ b/Elwig/Documents/Pdf.cs @@ -50,7 +50,7 @@ namespace Elwig.Documents { progress?.Report(parts[0] / (double)parts[1]); } else if (line.StartsWith("success:")) { var m = Regex.Match(line, @"\(([0-9, ]+)\)"); - return m.Groups[1].Value.Split(", ").Select(n => int.Parse(n)); + return m.Groups[1].Value.Split(", ").Select(int.Parse); } } }