Hi,
when a button is clicked i start a seperate thead which is population a grid and does something with a webbrowser-control. But when the button is click the new thread seems not to be seperate, cause the UI is freezing until the new thread is done.
Here the code:
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
What I'm doing wrong?
Thanks, Neils