I have some code that i run in a background thread in a winforms app, but i need to convert it for an Asp.Net app...
Code:tmr.Start() ' Timers don't work in Asp.Net thread = New Threading.Thread(AddressOf DoWork, 20971520) thread.IsBackground = True thread.Start()Code:Private Sub DoWork() Dim game As New Game Application.DoEvents() ' Application DoEvents doesn't work in Asp.Net n = game.createNew2() End SubBasically, I need to run the background thread with an increased stack size, then when it's completed, I need to update the ui.Code:Private Sub tmr_tick(sender As Object, e As EventArgs) Handles tmr.Tick If Not thread.IsAlive Then ' this doesn't work properly tmr.Stop() ' update ui here ' etc End If End Sub
This is a VS2019 app, so any improvements using async tasks and await would be appreciated...




Reply With Quote