Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SplashScreen class

Applies to Windows and Windows Phone

Provides a dismissal event and image location information for the app's splash screen.

Syntax


/* For information about creating or accessing this object, see Remarks. */

Attributes

[Version(0x06020000)]

Members

The SplashScreen class has these types of members:

Events

The SplashScreen class has these events.

EventDescription
Dismissed Fires when the app's splash screen is dismissed.

 

Properties

The SplashScreen class has these properties.

PropertyAccess typeDescription

ImageLocation

Read-onlyThe coordinates of the app's splash screen image relative to the window.

 

Remarks

Access this object from your app's activated event handler by using the SplashScreen property on the event object that is passed into your handler.

For JavaScript

Respond to onactivated events in your activated event handler. To learn how to respond to activated events, see How to activate an app.

If you notice a flicker during the transition to your extended splash screen, add onload="" on your <img> tag like this: <img id="extendedSplashImage" src="/images/splash-sdk.png" alt="Splash screen image" onload="" />. This helps prevent flickering by making the system wait until your image has been rendered before it switches to your extended splash screen.

Additionally, if you use fragment loading to load an extended splash screen page, you may still notice a flicker between when the Windows splash screen is dismissed and when your page is displayed. You see this flicker because fragment loading begins to load your imitation splash screen page asynchronously, before the onactivated event handler finishes executing. You can prevent this unsightly flicker by avoiding the use of fragment loading to load your extended splash screen page (as demonstrated by the Splash screen sample). When your additional loading tasks are complete (also as demonstrated by the Splash screen sample) you can then navigate to your app’s main page. Alternatively, if you wish to continue the use of fragment loading in your extended splash screen page, you can also prevent the flicker by getting an activation deferral and responding to onactivated events asynchronously. Get a deferral for an activated event by calling the activatedOperation.getDeferral method.

For C#/C++/VB

Respond to Activated events by overloading the corresponding activated event handler method. For example, use OnLaunched to respond to ActivationKind.Launch activation events. To learn how to respond to activated events, see How to activate an app.

If you notice a flicker during the transition to your extended splash screen, see the Troubleshooting section in Guidelines and checklist for splash screens for help.

The SplashScreen property is available on all Windows.ApplicationModel.Activation classes.

Examples

The Splash screen sample demonstrates how to retrieve a SplashScreen object in its activated event handler, when the app launches.


function activated(eventObject) {
    if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) {
        // Retrieve splash screen object
        splash = eventObject.detail.splashScreen;

        // Retrieve the window coordinates of the splash screen image.
        SdkSample.coordinates = splash.imageLocation;

        // Register an event handler to be executed when the splash screen has been dismissed.
        splash.addEventListener("dismissed", onSplashScreenDismissed, false);

        // Create and display the extended splash screen using the splash screen object.
        ExtendedSplash.show(splash);

        // Listen for window resize events to reposition the extended splash screen image accordingly.
        // This is important to ensure that the extended splash screen is formatted properly in response to snapping, unsnapping, rotation, etc...
        window.addEventListener("resize", onResize, false);

        // Use setPromise to indicate to the system that the splash screen must not be torn down
        // until after processAll and navigate complete asynchronously.
        eventObject.setPromise(WinJS.UI.processAll().then(function () {
            // Navigate to either the first scenario or to the last running scenario
            // before suspension or termination.
            var url = WinJS.Application.sessionState.lastUrl || scenarios[0].url;
            return WinJS.Navigation.navigate(url);
        }));
    }
}

// Register your activated event handler
WinJS.Application.addEventListener("activated", activated, false);

You can use the object passed to your activated event handler to get information about the activated event. In the example, the object contains information about a launch activation and is either a webUILaunchActivatedEventArgs (JavaScript) or a LaunchActivatedEventArgs (C#/C++/VB) object, depending on the programming language. The Kind property on this object lets you distinguish between different types of activation (like ActivationKind.launch or ActivationKind.search).

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8

Namespace

Windows.ApplicationModel.Activation
Windows::ApplicationModel::Activation [C++]

Metadata

Windows.winmd

See also

Windows.ApplicationModel.Activation classes
Splash screen sample
App activate and suspend using WinJS sample
App activated, resume, and suspend using the WRL sample
JavaScript
Quickstart: Adding a splash screen
How to activate an app
How to extend the splash screen
C#/C++/VB
Quickstart: Adding a splash screen
How to activate an app
How to extend the splash screen

 

 

Show:
© 2014 Microsoft