Forum  Commercial Foru...  Commercial Foru...  Long Running Process - Asynchronous With Timer
Previous Previous
 
Next Next
New Post 2/4/2012 8:01 PM
Unresolved
  derekmhart@yahoo.com
717 posts
1st Level Poster


Long Running Process - Asynchronous With Timer 

I am going to have a VWG button that does a long process, could be up to 30 seconds...

I am definitely not going to do this synchronously, making the user wait, and possibly locking the browser if the user clicks.

1) Is there some clever way to do this asynchronously, or is there really no way to release the web site from being held up? Is there a way to run the SQL stored procedure, but to let go if it and run asynchronously? I know this is an ADO.NET question, but a quick answer would be appreciated.
2) This way seems to be a hassle, but do I need to do the following... the user clicks the button, which updates some flag in the database. The flag is connected to by a timer process, which is actually a Windows Service (which I already have set up doing other things in this VWG website). The timer process picks up the database functionality that needs to be processed and runs it. This is where the long stored procedure runs. Back on the client, what occurred is a timer starts running, waiting for the database to update this flag to finished. The timer pulls the information back into the VWG screen when it is ready.
   a) As a side note, I would enjoy a cool animated graphic to run for the user. What do you think? A GIF file?

 
New Post 2/5/2012 11:22 AM
  palli
11824 posts
1st Level Poster




Re: Long Running Process - Asynchronous With Timer 

Hi Derek,

I wrote an article about this subject a while ago here, where you can see what options you have in Visual WebGui.

If you do not need actual reports on the progress of the long running process, then GIFs are of course the most convenient form of animations, one that you just place there and don't have to worry about it.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 2/5/2012 11:45 PM
  derekmhart@yahoo.com
717 posts
1st Level Poster


Re: Long Running Process - Asynchronous With Timer 
Modified By derekmhart@yahoo.com  on 2/6/2012 4:03:58 AM)

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

 

 

 
New Post 2/6/2012 9:26 AM
  palli
11824 posts
1st Level Poster




Re: Long Running Process - Asynchronous With Timer 

Hi Derek,

The Button sample wouldn't help in your case, as your UI would be equally stuck for the whole time of the long running process, which is not what you want, as I understand.

The wiki sample you reference would probably be the closest to what you want, without reverting to comet technology. To make it work, you can try referencing the Gizmox.WebGUI.Forms.Themes and build again.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 2/6/2012 10:37 AM
  palli
11824 posts
1st Level Poster




Re: Long Running Process - Asynchronous With Timer 

Hi again Derek,

Regarding the ImageResource problem, you may also want to try removing all references to Gizmox assemblies and then readd them. This happened on one of my projects just now, which had Gizmox.WebGUI.Forms.Themes already reference, but removing the references, uppering privateversion and readd the references fixed it.

Sounds like the good ol' HintPath problem that surfaces from time to time in Visual Studio.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  Commercial Foru...  Commercial Foru...  Long Running Process - Asynchronous With Timer
CompanionKit Bottom
.NET Web, Cloud and Mobile application delivery platform | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2011 Visual WebGui®       Visual WebGui weblog on ASP.NET Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS