dotMorten / WinUIEx

WinUI Extensions
https://dotmorten.github.io/WinUIEx
MIT License
582 stars 37 forks source link

Would it be possible to have a Maui splash screen sample? #66

Open veikkoeeva opened 2 years ago

veikkoeeva commented 2 years ago

Hi!

I started learning a bit of Maui and got stuck with the idea of creating a splash screen worth start debugging. Alas it seem to be a bit complicated to start from that route, and so found this library of yours.

I read https://dotmorten.github.io/WinUIEx/concepts/Maui.html but I'm not sure how could I use it to create https://github.com/dotMorten/WinUIEx/blob/main/docs/concepts/Splashscreen.md on a Maui app (any page for static, video, lottie whatever example, what there is).

Would it be possible to have a sample for this? Regardless, sponsored coffee for the the benefit of the larger community. :)

dotMorten commented 2 years ago

It's on my list to figure out as well, but just haven't gotten that far just yet. I'll follow up here once I get a chance to wrap my head around it. What I've done so far is to just use a SplashPage in the main maui window, and then redirect to the shell page once loading is done - not quite a splashscreen but got the job done and worked the same on all platforms. An alternative is to just hide the main window (minimize + hide from taskbar) using the window extensions in WinUIEx, then re-enable once splash screen is done showing.

Also thank you so much for the coffee! Much appreciated!

veikkoeeva commented 2 years ago

No problem! I also noticed I was imprecise, I was specifically going for WinUI. Well, I suppose I skip that for now and doodle around other things!

Also noticed https://github.com/microsoft/WindowsAppSDK/discussions/500 and https://github.com/dotnet/maui/issues/3870#issuecomment-1040742487 now. Ah, so, it's maybe the custom page until something official appears. I edited and added here for the benefit of others who may stumble here.

breenbob commented 1 year ago

I think if the SplashScreen window subclass didn't expect the Window type parameter for the subsequent Window to be launched, you could easily use the approach taken here for a Maui app WinUI splash screen...

This approach immediately shows a splash screen Window in the WinUI App.xaml.cs constructor, then when app fully launches it creates and activates the main window in OnLaunched, which in Maui terms happens automatically in OnLaunched anyway, so no need to even override that?