Display dialog on all Sessions

I’m trying to display a WebDialog on all connected sessions at once.
I have a dictionary in App that holds the connected users Identifier and Remote Address.
In App I have a method that should execute another method that is on a WebPage(wp_Admin in this case) for all active sessions.

If I do this…

  Dim i as Integer
  For i = 0 to activeSessions.Count-1
    App.SessionWithIdentifier(activeSessions.Key(i), activeSessions.Value(activeSessions.Key(i))).wp_Admin.globalMsgDialog(logLevel, message)

…and there are two connected sessions. The WebDialog gets displayed on one session only. Not once, but as many times as there are sessions in the Dictionary.
If I instead change the WebDialog to a simple MsgBox…it works.

I’m getting something wrong aren’t I? :slight_smile:

Create a method Session.globalMsgDialog(logLevel as integer, message as string):

dim sc as new WebSessionContext(me) wp_admin.globalMsgDialog(logLevel, message)

I suspect that your code in wp_Admin.globalMsgDialog needs the right Session on the stack.

Thank you Brad. It made no difference though :confused:

In the LR there’s an example that does something similar. It changes the currentpage on all sessions.
Could it be modified to display my WebDialog for all Sessions?

// Loop through all sessions and have them display a new
// ExceptionPage.
For i As Integer = 0 To App.SessionCount - 1
  // Without creating a WebSessionContext here, creating
  // the page would fail triggering a SessionNotAvailableException.
  Dim context As New WebSessionContext(App.SessionAtIndex(i))
  // Because we have a context, we can create a new
  // ExceptionPage and assign it to the session.
  context.Session.CurrentPage = New ExceptionPage

This works: context.Session.MsgBox(message)
This does not: context.Session.displayDialog(message) <- displayDialog is a method in Session that creates a new WebDialog and displays it.

I’m on 2013r3.3

This thread seems relevant. I even posted in it :stuck_out_tongue:
I’ll take a look…


As pointed out here: https://forum.xojo.com/3541-solved-need-assistance-with-websessioncontext
The WebDialog can’t be created in code. It needs to be dragged to the WebPage and then displayed.
Thanks again Brad for taking the time help out! :slight_smile: