Posted 16 years ago
by Anurodh Ora
Hi,
We have following requirement.
1) We have two pages say Page1 and Page2.
2) We get user input from Page1 and then click Next to go on Page2.
3) Page2 has some labels with content "Step #(Number of step) Succeeded" initially grayed out.
4) As soon as we click on Page1 Next button we should get into an intense background function which talks to server for number of times times and each time a step succeeds it should show page2 with that particular step label changed to black color.
5) Application should be blocked till the function exits.
For above scenario. We are doing following things.
1) Check on page selection changed event if new page is Page2 we call a function say IntenseWorkerFunction() (which typically refreshes Page2 label contents when a server step succeeds like label1.Foreground = Brushes.Black;)
2) Calling Dispatcher.BeginInvoke() to update UI of Page2.
Problem:
1) After clicking on Next on Page1 the application hangs (Page2 do not get showed up)
2) After all the server functionality gets over, that is IntenseWorkerFunction() finishes then only Page2 shows up.
3) In the function we need to validate controls value of earlier wizard pages. using background thread we need to call Dispatcher.Invoke (as background thread do not get access to UI thread elements) and there are various controls which are used so performance is also an issue. So how to get values from wizard pages in BackGroundWorker is also a question.
4) Avoiding BackgroundWorker and just updating UI using Dispatcher.BeginInvoke() also did not work as the Page2 is shown only when all the processing of IntenseWorkerFunction() gets completed.
To summarize we need following:
On Page1 Next click call a sync function to process user inputs provided on Page1 and update UI of Page2 simultaneously with each user input verification from server(that takes time). How to achieve this efficiently without using BackgroundWorker class.
Note : Using Dispatcher.BeginInvoke() to update Page2 UI did not work, as Page2 only shows up when all the operations are done.
Thanks and Regards,
Anurodh
[Modified at 11/21/2008 02:20 AM]
[Modified at 11/21/2008 05:51 AM]
[Modified at 11/21/2008 06:15 AM]
[Modified at 11/21/2008 06:20 AM]
[Modified at 11/21/2008 06:43 AM]
[Modified at 11/21/2008 06:50 AM]
[Modified at 11/21/2008 07:19 AM]
[Modified at 11/23/2008 06:34 AM]
We have following requirement.
1) We have two pages say Page1 and Page2.
2) We get user input from Page1 and then click Next to go on Page2.
3) Page2 has some labels with content "Step #(Number of step) Succeeded" initially grayed out.
4) As soon as we click on Page1 Next button we should get into an intense background function which talks to server for number of times times and each time a step succeeds it should show page2 with that particular step label changed to black color.
5) Application should be blocked till the function exits.
For above scenario. We are doing following things.
1) Check on page selection changed event if new page is Page2 we call a function say IntenseWorkerFunction() (which typically refreshes Page2 label contents when a server step succeeds like label1.Foreground = Brushes.Black;)
2) Calling Dispatcher.BeginInvoke() to update UI of Page2.
Problem:
1) After clicking on Next on Page1 the application hangs (Page2 do not get showed up)
2) After all the server functionality gets over, that is IntenseWorkerFunction() finishes then only Page2 shows up.
3) In the function we need to validate controls value of earlier wizard pages. using background thread we need to call Dispatcher.Invoke (as background thread do not get access to UI thread elements) and there are various controls which are used so performance is also an issue. So how to get values from wizard pages in BackGroundWorker is also a question.
4) Avoiding BackgroundWorker and just updating UI using Dispatcher.BeginInvoke() also did not work as the Page2 is shown only when all the processing of IntenseWorkerFunction() gets completed.
To summarize we need following:
On Page1 Next click call a sync function to process user inputs provided on Page1 and update UI of Page2 simultaneously with each user input verification from server(that takes time). How to achieve this efficiently without using BackgroundWorker class.
Note : Using Dispatcher.BeginInvoke() to update Page2 UI did not work, as Page2 only shows up when all the operations are done.
Thanks and Regards,
Anurodh
[Modified at 11/21/2008 02:20 AM]
[Modified at 11/21/2008 05:51 AM]
[Modified at 11/21/2008 06:15 AM]
[Modified at 11/21/2008 06:20 AM]
[Modified at 11/21/2008 06:43 AM]
[Modified at 11/21/2008 06:50 AM]
[Modified at 11/21/2008 07:19 AM]
[Modified at 11/23/2008 06:34 AM]