No messagebox appears at upload1_Uploaded when async

0
0

private async void upload1_Uploaded(object sender, UploadedEventArgs e)
{
await ProcessUploadAsync(e);
MessageBox.Show(“Upload completed…”);
}

 

When upload is completed, the messagebox only shows when a user clicks, resizes or otherwise does something else on the screen.

I’ve tried many many different approaches (eval, timer, client side js) but nothing works (all of these only works after user action).

I’m stuck on this, does anyone have any suggestions?

  • You must to post comments
0
0

Hi,

Looks like you have WebSockets disabled? you can verify that by checking the Console in DevTools or checking Application.IsWebSocket.

If that’s the case, you’ll need to do the following modifications:

private async void upload1_Uploaded(object sender, UploadedEventArgs e)
{
Application.StartPolling(100);
await ProcessUploadAsync(e);
Application.Update(this, () =>
{
MessageBox.Show("Upload completed…");

Application.EndPolling();
});
}

HTH,
Alaa

  • Alaa (ITG)
  • conradv
    strange, I added in web.config but still Application.IsWebSocket = false
  • Luca (ITG)
    It’s not a Wisej.NET issue, we can’t enable WebSocket when it’s not supported or installed.
  • conradv
    “we can’t enable WebSocket when it’s not supported or installed” this is a standard windows 2019 server install with IIS, nothing is disabled or omitted what would be missing that needs to be installed?
  • conradv
    you were right, Web Sockets needs a separate install in the IIS server roles and is not installed by default… everything now works so many thanks!
0
0

You need to use Application.Update()
Documentation: https://docs.wisej.com/api/wisej.web/general/application#update-context-action

You could do it like this:
private async void upload1_Uploaded(object sender, UploadedEventArgs e)
{
await ProcessUploadAsync(e);
MessageBox.Show(“Upload completed…”);
Application.Update(this);
}

But ideally, you would put the MessageBox call inside the Application.Update() call to insure that the UI is updated when the call ends.

private async void upload1_Uploaded(object sender, UploadedEventArgs e)
{
await ProcessUploadAsync(e);
Application.Update(this, () => { MessageBox.Show(“Upload completed…”); });

}

  • conradv
    looks like some good solutions but it still requires a user action to show the message…
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.