I'm using windows template studio
to create my app, and want to add a extended splash screen
refered Display a splash screen for more time.
For the code write in App.xaml.cs
in windows template studio, they use ActivationService
. I don't know how to add the extended splash
properly.
Is any one can help?
How to add extended splash to windows template studio?
You could try to edit ActivationService
like the follow
public async Task ActivateAsync(object activationArgs)
{
if (IsInteractive(activationArgs))
{
// Initialize things like registering background task before the app is loaded
await InitializeAsync();
if ((activationArgs as LaunchActivatedEventArgs).PreviousExecutionState != ApplicationExecutionState.Running)
{
bool loadState = ((activationArgs as LaunchActivatedEventArgs).PreviousExecutionState == ApplicationExecutionState.Terminated);
ExtendedSplash extendedSplash = new ExtendedSplash((activationArgs as LaunchActivatedEventArgs).SplashScreen, loadState);
var rootFrame = new Frame();
rootFrame.Content = extendedSplash;
Window.Current.Content = rootFrame;
}
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (Window.Current.Content == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
Window.Current.Content = _shell?.Value ?? new Frame();
}
}
await HandleActivationAsync(activationArgs);
_lastActivationArgs = activationArgs;
if (IsInteractive(activationArgs))
{
// Ensure the current window is active
Window.Current.Activate();
// Tasks after activation
await StartupAsync();
}
}
ExtendedSplash
void DismissExtendedSplash()
{
// Navigate to mainpage
rootFrame.Navigate(typeof(ShellPage));
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}