DeliveryConfirmationsDialog: small fixes
This commit is contained in:
@ -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<double>(v => {
|
||||
ProgressBar.Value = v;
|
||||
}));
|
||||
|
@ -80,13 +80,14 @@ namespace Elwig.Documents {
|
||||
if (this is MergedDocument m) {
|
||||
var pdf = new TempFile("pdf");
|
||||
var tmpHtmls = new List<TempFile>();
|
||||
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<double>(v => progress?.Report(50.0 + v / 2)));
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user