private async Task RunParsingAsync() { if (File.Exists(PatternText) == false) { DialogService.MsgBox($"Шаблон не найден {PatternText}"); return; } IsWait = true; try { _cts = new CancellationTokenSource(); CancellationToken token = _cts.Token; var progressindicator = new Progress <ProgressIndicate>(ReportProgress); await Task.Run(() => { XmlToXLS xtx = new XmlToXLS(); xtx.PathPDF = PathPDF; xtx.PathExcel = PathExcel; xtx.IsExtractToPDF = IsExtractPDF; xtx.IsExtractToExcel = IsExtractExcel; xtx.IsUnionXMLs = IsUnionXML; xtx.ParsingXMLToXLS(PatternText, PathXml, XSLText, progressindicator, token); }); } finally { ReportProgress(); IsWait = false; } }
private async Task DeleteAllAsync() { if (Directory.Exists(PathXml) == false) { DialogService.MsgBox($"Каталог не найден {PathXml}"); return; } IsWait = true; try { _cts = new CancellationTokenSource(); CancellationToken token = _cts.Token; var progressindicator = new Progress <ProgressIndicate>(ReportProgress); await Task.Run(() => { XmlToXLS xtx = new XmlToXLS(); xtx.DeleteAll(PathXml, progressindicator, token, "*.xml"); }); } finally { ReportProgress(); IsWait = false; } }
private async Task RunUnzipAllAsync() { if (Directory.Exists(PathZip) == false) { return; } if (Directory.Exists(PathXml) == false) { Directory.CreateDirectory(PathXml); } ; IsWait = true; try { _cts = new CancellationTokenSource(); CancellationToken token = _cts.Token; var progressindicator = new Progress <ProgressIndicate>(ReportProgress); await Task.Run(() => { XmlToXLS xtx = new XmlToXLS(); xtx.UnZipAll(PathZip, PathXml, progressindicator, token); xtx.UnZipAll(PathXml, PathXml, progressindicator, token); }); } finally { ReportProgress(); IsWait = false; } }