El nuevo hilo sigue bloqueando el hilo de la interfaz de usuario
Cuando se hace clic en un botón, comienzo un Thead separado que es poblar una cuadrícula y hacer algo con un control del navegador web. Pero cuando se hace clic en el botón, el nuevo hilo parece no estar separado, ya que la interfaz de usuario se está congelando hasta que se termina el nuevo hilo.
Aquí el código:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
FindCustomerLocation()
e.Handled = True
End Sub
Private Sub FindCustomerLocation()
Dim Findcontractor_Thread As New Thread(AddressOf FindContractor_ThreadExecute)
Findcontractor_Thread.Priority = ThreadPriority.AboveNormal
Findcontractor_Thread.Start()
End Sub
Delegate Sub FindContractorDelegate(ByVal igGrid As Infragistics.Windows.DataPresenter.XamDataGrid, ByVal webbrowser As Controls.WebBrowser)
Private Sub FindContractor_ThreadExecute()
Dim threadControls(1) As Object
threadControls(0) = Me.XamDataGrid1
threadControls(1) = Me.WebBrowserMap
Dim m As FindContractorDelegate = AddressOf FindContractor_WorkingThread
Me.Dispatcher.BeginInvoke(m, threadControls)
End Sub
Private Sub FindContractor_WorkingThread()
Mouse.OverrideCursor = Cursors.Wait
'Do something...
Mouse.OverrideCursor = Nothing
End Sub
¿Qué estoy haciendo mal?
Gracias neils