OK, I have been trying the wiki demo, and just not getting results.
In the demo, the code specifically passes an htmlbox as a parameter, and then updates the UI. My process has to update multiple controls on the screen when done. So I am not sure if it is necessary to pass the objects around. I call a long running web service, about 10 seconds, and want responsiveness from the UI. I have attempted to put the code from the demo in, but it recycles the site. I know the question is a bit general right now, but how exactly does the system know when the web service is done? Here is one attempt at this code. On my production server it recycles and shuts the web site down. On the development machine, it actually retrieves the files from the web service and updates the UI, but VaultFileSearchTaskCompleted is never hit, and when I exit the browser the asp.net server errors completely. Just not quite getting the code.
Public Delegate Sub VaultFileSearch_Delegate(ByVal AppSettingsDevelopment As String, ByVal VaultSearchTest As String)
Public Sub VaultFileSearchTaskCompleted(ByVal R As IAsyncResult)
Me.Update()
End Sub
Public Sub VaultFileSearch(ByVal AppSettingsDevelopment As String, ByVal VaultSearchTest As String)
Dim ds As New DataSet
Dim OS As New OneSpotService.WS
' Long running task on this line.
ds = OS.SharepointGetFiles(GetSessionVariables.UserID, VaultSearchTest)
If ds Is Nothing Then
MessageBox.Show("No search results were returned.", _
"No Files Available", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
SyncLoadSyncFilesIntoList(ds.Tables(0))
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
End Sub
Private Sub btnVaultSearchFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnVaultSearchFiles.Click
Timer1.Start()
Dim d As VaultFileSearch_Delegate
Dim h1 As IAsyncResult
d = New VaultFileSearch_Delegate(AddressOf VaultFileSearch)
h1 = d.BeginInvoke(AppSettings("Development"), txtVaultSearch.Text, New AsyncCallback(AddressOf VaultFileSearchTaskCompleted), Nothing)
End Sub