Closed phollyer closed 1 year ago
Seems a MAUI thing, have you tried to run the navigation on the UI dispatcher?
MauiControls.Application.Current?.Dispatcher.Dispatch(() => Navigation.PushAsync<OtherPage>());
Thanks, that's exactly what I need. I'll update the question on Microsoft Q&A so that it references Maui.
I asked this on Microsoft Q&A because I thought it was more of a Maui issue but was re-directed here.
I'm building a mobile and desktop app with Maui + MauiReactor that communicates with my server over Websockets. I have this working fine.
My problem is that if I try to Navigate to another page when I receive a Websocket reply with
await Navigation.pushAsync<NewPage>();
I get the following error:I understand why this happening, just not how best to handle it.
I can display a button after the message has been received, which the user can click to navigate which is obviously performing the navigaton on the UI thread due to the button click, but this feels really clunky. Is it possible to raise the process onto the UI thread so that I can programmatically navigate automatically?
My use case is as follows:
User starts the app, navigates to the sign in page, and enters credentials
Credentials get sent to my server over a websocket
Websocket reply confirms credentials and supplies a session token
Now I need to navigate to another page based on the current state of their profile settings i.e. if incomplete, go to profile page, if complete go back home. I would like this to be automatic without forcing the user to click a button to navigate.