Application Life Cycle In Universal Windows App Basic - Part 1

Introduction

Windows Store Application life cycle is an entirely different life cycle compared to Win32 application (Ex: Windows 7 OS application). The following are the changes:

  1. Windows Store app always singleton application.
  2. Install the app via Self-contained APPX package.

Windows store application 3 different states are available. Application is always in any one of the following state:

  1. Running
  2. Not Running
  3. Suspended

Application Object

Application object is an interface between OS and the Windows store app, each app has its own application object and is just a receiver object (state of the application) & controls the application life cycle and based on the received input application it will act.

Operating System

Operating system sends the message to the application object based on the user input or decides itself (OS Intelligence) what message is sent to the application (application object).

Operating System

OS Intelligence:

  1. OS itself has to decide what to do when the OS Memory is full or running less power mode. In this type of situation, the OS sends the termination message to the application.

  2. If application is running, the user want to open another application, in this transition period.

    1. OS first sends the Suspend message to the application currently visible in the screen. (If the application receives the suspend message, store the application information within some seconds (we will see in Part2)).

    2. Next, the OS sends the launching event (Running state) message to the new application, which lets user open the app.

Launching Application Object

In main function, creating the application object & this object is singleton and is passed to the Application. Start function.

Launching Application Object

Passing (p) => new App () pass as the call back function ApplicationInitializationCallback, request to the initialization of the application object (singleton object).

ApplicationInitializationCallback: It first creates the main thread of the application, main thread starts creating the main installation part (CoreWindow, Dispatcher)

ApplicationInitializationCallback

CoreWindow: CoreWindow class first call CreateNewView to create the CoreViewObject & sets the bounds of the Windows (Window start position and Size).

Dispatcher: CoreDispatcher initializes the event handler handling the Mouse and Keyboard event.

Dispatcher

Core Application (App) has created, thread checked the ActivationKind & initialized the value and raised the OnLaunched event.

ActivationKind: This property has used to find the application launch way (Launch, search, share target lot of methods available to launch the application).

ActivationKind

Check the create a Frame window and assign it to the current window object.

create a Frame window

window object

PreviousExecutionState Find the application state in previous mode initial launch and it should be in NotRunning mode.

Window.Current.Activate () The app must call this method within 15 seconds, otherwise the application will be terminated. This is the default case but we can avoid that.

Summary Flow Application Object:

Summary Flow Application Object

Up Next
    Ebook Download
    View all
    Learn
    View all