All, I'm working on an asp.net app.
I have (C#) pdf page validator that evaluates the number of pages in a pdf file and compares it to the number entered on a form (the form will create an xml file used to configure an order).
My problem is that the process to run the validator against a large pdf file takes long enough that I would need to run it on a separate thread; but I can't seem to update / reference controls on the main UI Thread. The last thing I tried was the following.
I have also tried this
David Pimental
(US, Oh)
I have (C#) pdf page validator that evaluates the number of pages in a pdf file and compares it to the number entered on a form (the form will create an xml file used to configure an order).
My problem is that the process to run the validator against a large pdf file takes long enough that I would need to run it on a separate thread; but I can't seem to update / reference controls on the main UI Thread. The last thing I tried was the following.
Code:
Task taskA = Task.Factory.StartNew(() => DoSomeWork(5000));
taskA.Wait();
I have also tried this
Code:
MainThread = SynchronizationContext.Current;
if (MainThread == null) MainThread = new SynchronizationContext();
MainThread.Send((object state) =>
{
//pdfPageStatus.Text = pdfPages.ToString() + " pages in PDF File Uploaded";
pdfPageStatus.Text = " pages in PDF File Uploaded";
pdfPageStatus.ForeColor = Color.Blue;
}, null);
David Pimental
(US, Oh)