WiseJ Start Task Async

0
0

Hi everyone.

I’ve started using the StartTask function, it works well in terms of async.

Code i use:

Application.StartPolling(1000)
Application.StartTask(Function()
Try

Catch ex As Exception

End Try
End Function)
Application.Update(Me)
Application.EndPolling()

However, for some reason, when i execute this, the form doesnt update, i need to click in something to make the form or page update, to fix this i had to add a timer always enabled with the:
Me.Refresh() and Me.Update() , however this is not the best option to fix this error. Can someone help me please? Basically it gets stuck until i clikc with the mouse or hover a control, or resize the chrome etc.

  • You must to post comments
0
0

Hi Ruben,

Background tasks are completely separated from the session and the user that started them. They are simply threads running on their own without any knowledge of the session that started them.
This is why you’ll need to update the application to reflect any changes or updates done in a background task.

For this, Wisej has the “Application.Update()” method.
However, in order for it to work correctly, you’ll have to add the method INSIDE the Application.StartTask() method.

Otherwise, when the task is finished doing its thing, it won’t get reflected back to the client.

You can find out more info in our documentation : Wisej Documentation | Updating UI Using Background Tasks

HTH,
Alaa

  • ruben ribeiro
    So, all i have to do is add the Application.Update(Me) inside of the start task?
  • Alaa (ITG)
    Yes sir!
  • ruben ribeiro
    No “fim” da task mas dentro da funcao Start Task , certo?
  • ruben ribeiro
    Application.StartTask(Function() Try Catch ex As Exception End Try Application.Update(Me) End Function)
  • ruben ribeiro
    Still not working for me sir i added Application.Update(Me) at the top of the End Function inside the start task, not working, just like what i have sent above
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.