Replies: 2 comments
-
The issue with the old style of navigating to the MainViewModel (via the constructor of the ShellViewModel) is that it's not async and as such can't be awaited. The NavigateAsync() method takes a parameter - you should use this callback to navigate to the MainViewModel and this should keep the splash visible until that navigation is completed. |
Beta Was this translation helpful? Give feedback.
-
@nickrandolph Do you mean the parameter for initialNavigate? My use case is that I need to call NavigateAsync to display the Splashscreen (I assume that's what it does), and initialize the host so I can do things like initialize my database, etc. How would I use the parameter to then later have it go to the main page? Just another NavigateAsync? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a new Uno app using the latest template and the startup code ends with:
Host = await builder.NavigateAsync<Shell>();
Which seems to briefly display the splash and then it navigates to the home page (in the ShellViewModel).
My question is, how can I delay the navigation to the home page, so I can display the splash while I'm doing other things in the startup code, like opening database, etc?
I have tried to make the call to
await Navigator.NavigateViewModelAsync<MainViewModel>(this);
at a later time, but what happens is the splash is displayed briefly, but whenbuilder.NavigateAsync
above is completed, then the splash is removed and a blank screen is displayed until I trigger the call toNavigateViewModelAsync<MainViewModel>
. I basically want to display the splash until I'm done with all initialization.Beta Was this translation helpful? Give feedback.
All reactions