OK, I have used the timer process before, but I am not sure on the best way to use it.
The way I have used it before was by updating a SQL Server database with a flag, so the timer knows where to look each time the tick event fires to see if the process is complete.
But with my current scenario, I could udpate a flag, but the data I am gathering from SQL Server just needs to be returned in a dataset. I don't really need to write the dataset to a SQL table. But I understand that that might be a good way to do this, have the timer check the database for the flag, and then when the data is ready, it is sitting in SQL Server. Fairly simple.
But what if I just want to return the dataset in code only? Which of these methods applies in the best way? (and the easiest way... not getting into this comet technology)
Also, would love to try this project:
http://wiki.visualwebgui.com/pages/index.php/HtmlBox_CodeSample_-_Asynchronous_loading_of_contents
But it errors out:
Server Error in '/' Application.
Could not resolve skin resource of type 'ImageResource'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Gizmox.WebGUI.Forms.Skins.SkinException: Could not resolve skin resource of type 'ImageResource'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
[SkinException: Could not resolve skin resource of type 'ImageResource'.]
Gizmox.WebGUI.Server.Preload.ProcessRequest(HostContext objHostContext) +1645
Gizmox.WebGUI.Hosting.HostHttpHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context) +106
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
|
Also, I saw the following code. I am trying to grasp if this could handle my scenario. So let's see... the PerformDelay(10000, 10) routine is what would run my long running SQL Server process. I guess in the PerformDelay process I need to at some point update the blnProcessing flag. And is that it? Then the code would update the UI (in this case updating the button text to Done)?
Imports Gizmox.WebGUI.Forms
Public Class UpdateButton
Inherits Button
Private blnProcessing As Boolean = False
Protected Overrides Sub FireEvent(ByVal objEvent As Gizmox.WebGUI.Common.Interfaces.IEvent)
If objEvent.Type = "Click" Then
If Not blnProcessing Then
' First time here, set button's text, and then fire click again
blnProcessing = True
Me.Text = "Working..."
Me.InvokeMethodWithId("Events_Click", True)
Else
' Already updated, now it's time to process
MyBase.FireEvent(objEvent)
Me.Text = "Done"
Me.blnProcessing = False
End If
End If
MyBase.FireEvent(objEvent)
End Sub
End Class
The testing form had one such custom button and the following code:
Imports Gizmox.WebGUI.Forms
Imports Gizmox.WebGUI.Common
Public Class Form1
Private Sub UpdateButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UpdateButton1.Click
PerformDelay(10000, 10)
End Sub
Private Sub PerformDelay(ByVal intDelay As Integer, ByVal intTimes As Integer)
For a As Integer = 1 To intTimes
Dim s As String = ""
For j As Integer = 0 To intDelay
s += "a"
Next
Next
End Sub
End Class