Note that I changed the order to first connect, then present the window. This avoids a (theoretical) race condition where the handler is not yet setup but the window is shown.
Note that I changed the order to first connect, then present the window. This avoids a (theoretical) race condition where the handler is not yet setup but the window is shown.