I am opening new window and would like to avoid freezing while background task is executed.
But after task is finished pdfviewer is not refreshed and report displayed.
window is updated if it is clicked on it ?!
this is contents of form load:
private async void winReportViewer_Load(object sender, EventArgs e)
{
this.Text = “Please wait generating report …”;
MemoryStream rptOutStream = new MemoryStream();
rptOutStream = await(Task.Run(() => CreateReport()));
rptOutStream.Position = 0;
this.pdfView.PdfStream = rptOutStream;
this.pdfView.Refresh(); // does nothng
this.Text = “Report generated”; //is not updated
this.Refresh(); //also does nothing
}
Hi Dino,
Best way is to use Application.Update(this)
More details there : https://docs.wisej.com/docs/concepts/background-tasks#update-the-ui
Best,
Kevin(ITG)
Please login first to submit.