Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial work on the new fast splash screen #186

Merged
merged 13 commits into from
Nov 19, 2024
Merged

Initial work on the new fast splash screen #186

merged 13 commits into from
Nov 19, 2024

Conversation

dotMorten
Copy link
Owner

@dotMorten dotMorten commented Sep 24, 2024

Fixes #87

Usage:

public SimpleSplashScreen Splash { get; }
public App()
{
    Splash = SimpleSplashScreen.ShowDefaultSplashScreen(); // Shows splashscreen with closest matching scale from app manifest.
    this.InitializeComponent();
}

In MainWindow when your window has loaded, call
MyApp.Splash.Hide(); (with optional timespan parameter to fade out)

There's also an option to just specify an image path and not rely on app manifest (unpackaged apps would need that):
SimpleSplashScreen.ShowSplashScreenImage(full_path_to_image);

@Sergio0694
Copy link

Small tip: granted, this will never be as fast as the UWP splash screen, but should be able to at least improve this a tiny bit more if you disable the XAML generated splash screen, and show your custom splash screen before anything else. That is, before even loading any WinAppSDK/WinUI bit of code, creating the App instance, anything. Might help a tiny bit 🙂

@dotMorten
Copy link
Owner Author

@Sergio0694 it does make a little difference. Not a whole lot though. But for completeness sake, I updated the functional test app to show both ways

@Sergio0694
Copy link

Yeah, that's the best we can do from here. The ideal way would be to just do what UWP does, where the OS shows the splash screen and the window before any of the app even runs, but of course that requires OS support and isn't an option 😅

@dotMorten
Copy link
Owner Author

It's still pretty responsive with a sub-second launch time on my machine. Well before you start thinking "did I click it"?

@dotMorten dotMorten marked this pull request as ready for review September 24, 2024 23:30
@Sergio0694
Copy link

Yup, I mean I haven't seen this in action but I believe it looks completely acceptable. Was just saying that sadly there's only so much you can do without OS support. The UWP splash screen has a bunch of advantages like:

  • It's even faster
  • It reuses the same window frame as the app, meaning it'll always exact match the size and position
  • Will smoothly fade out
  • The OS can automatically suppress it if the app activates in less than ~400ms after launch, meaning if your app is fast enough (or when it's running on a fast machine), you'll skip the splash screen entirely to get an even smoother experience, with no flickering, and dynamically adjusting at every launch

That said, that was just me thinking out loud, and I'm sure this custom splash screen will already be useful to folks looking for something like this. Great job! 🙂

@dotMorten dotMorten merged commit 746753a into main Nov 19, 2024
1 check passed
@dotMorten dotMorten deleted the SplashScreen branch November 19, 2024 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Native SplashScreen
2 participants