public void Client_PostTemplateAsync() { var dataSources = new Dictionary <string, DataSource>() { { "MANF_DATA_2009", new XmlDataSource(File.OpenRead(SampleTemplatesFolder + @"\Manufacturing.xml")) } }; var templateFilePath = SampleTemplatesFolder + @"\Manufacturing.docx"; var outputFilePath = SampleTemplatesFolder + @"\AsyncOutput.pdf"; using (var templateFile = File.OpenRead(templateFilePath)) { var report = new ReportPdf(uri, templateFile); report.Process(dataSources); while (report.GetStatus() == Report.Status.Working) { Thread.Sleep(100); } if (report.GetStatus() == Report.Status.Ready) { File.WriteAllBytes(outputFilePath, report.GetReport()); report.Delete(); } } }
public static void Request7() { var dataSources = new Dictionary<string, DataSource>() { {"MANF_DATA_2009", new XmlDataSource(File.OpenRead(SampleTemplatesFolder + @"\Manufacturing.xml"))} }; var templateFilePath = SampleTemplatesFolder + @"\Manufacturing.docx"; var outputFilePath = string.Format(@"{0}\AsyncOutput{1}.pdf", SampleTemplatesFolder, rnd.Next()); using (var templateFile = File.OpenRead(templateFilePath)) { var report = new ReportPdf(uri, templateFile); report.Process(dataSources); while (report.GetStatus() == Report.Status.Working) Thread.Sleep(100); if (report.GetStatus() == Report.Status.Ready) { File.WriteAllBytes(outputFilePath, report.GetReport()); report.Delete(); } } }