70-511 · Question #143
You develop a Windows Presentation Foundation (WPF) application. This application is used to output data trends to customer service representatives. A data trend analysis is performed in a function…
The correct answer is B. Use ThreadPool.QueueUserWorkltem to invoke UpdateData. See the full explanation below for the reasoning.
Question
You develop a Windows Presentation Foundation (WPF) application. This application is used to output data trends to customer service representatives. A data trend analysis is performed in a function named UpdateTrendData. The trend analysis is a long-running process. The application contains the following code segment. Class MainWindow Private Sub UpdateData(By Val arg As Object) Dim data As Double = UpdateTrendData() ... End Sub End Class UpdateData is currently invoked on the UI thread when the form is first displayed. You need to process the data in a manner that does not cause the UI to freeze. What should you do?
Options
- AUse ThreadPool.SetMaxThreads(2,2) and invoke UpdateData.
- BUse ThreadPool.QueueUserWorkltem to invoke UpdateData.
- CUse Me.Dispatcher.BeginInvoke to invoke UpdateData passing in the priority of Normal.
- DUse Me.Dispatcher.BeginInvoke to invoke UpdateData passing in the priority of Background.
How the community answered
(35 responses)- A6% (2)
- B74% (26)
- C14% (5)
- D6% (2)
Community Discussion
No community discussion yet for this question.