SlideShare uma empresa Scribd logo
1 de 34
WinRT Apps
Building Apps for Windows Phone 8.1 Jump Start
NotRunning Running
sealed partial class App : Application
{
/// <summary>
/// Invoked when the application is launched normally by the end user.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override async void OnLaunched(LaunchActivatedEventArgs e)
{
// How did the app exit the last time it was run (if at all)
ApplicationExecutionState previousState = e.PreviousExecutionState;
// What kind of launch is this?
ActivationKind activationKind = e.Kind;
// ...
NotRunning
Running
Suspended
Terminated
ClosedByUser
Launch
File
Protocol
VoiceCommand
Etc.
App is suspended
All code stopped
No timers tick
No events fire
Process still alive and in memory
Code has a chance to respond
(next slide)
sealed partial class App : Application
{
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
private async void OnSuspending(object sender, SuspendingEventArgs e)
{
// Ask for a deferral if you need to do async work
var deferral = e.SuspendingOperation.GetDeferral();
// TODO: whatever async work you need to do when suspending
deferral.Complete(); // Then mark the deferral complete
}
Same app is resumed
Same process, same
memory so values of
variables are intact
All code runs
Code has a chance to
respond...
Launch Back Switcher
sealed partial class App : Application
{
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
this.Resuming += OnResuming;
}
private void OnResuming(object sender, object e)
{
// TODO: whatever you need to do to resume your app
}
http://bit.ly/w8Resuming
Running
Terminated
App Data Local Folder
(or roaming folder for Data)
12:38
12:38
Jim Jones
Tel: 0111 222 333
Bob Brown
Tel: 0444 555 666
Arthur Abbott
Tel: 0777 888 999
CONTACTS
all 12:38
12:38
Work
Tel: 0111 222 333
Home
Tel: 0444 555 666
Email
jim@jones.com
CONTACTS
Jim Jones
12:38
CONTACTS
Add Phone
Mobile Phone
Phone type
Phone number
0888 777
State
Data
24
25
26
LoadState(
Parameter,
null /* dictionary */
);
27
SaveState(
dictionary
);
LoadState(
Parameter,
null /*dictionary*/
);
28
SaveState(
dictionary
);
LoadState(
parameter,
dictionary
);
29
SaveState(
dictionary
);
LoadState(
Parameter,
dictionary
);
30
...
...
31
http://aka.ms/Tsatr4
©2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics and other product names are or may be registered trademarks and/or trademarks in the
U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft
must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after
the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Mais conteúdo relacionado

Semelhante a 07 windows runtime app lifecycle

Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Frédéric Harper
 
Commenting in Agile Development
Commenting in Agile DevelopmentCommenting in Agile Development
Commenting in Agile Development
Jan Rybák Benetka
 
Androidの本当にあった怖い話
Androidの本当にあった怖い話Androidの本当にあった怖い話
Androidの本当にあった怖い話
Yusuke Yamamoto
 

Semelhante a 07 windows runtime app lifecycle (20)

23 silverlight apps on windows phone 8.1
23   silverlight apps on windows phone 8.123   silverlight apps on windows phone 8.1
23 silverlight apps on windows phone 8.1
 
How i learned to stop worrying and love the logs
How i learned to stop worrying and love the logsHow i learned to stop worrying and love the logs
How i learned to stop worrying and love the logs
 
11 background tasks and multitasking
11   background tasks and multitasking11   background tasks and multitasking
11 background tasks and multitasking
 
The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]
 
TDC 2015 SP - O ciclo de vida de aplicações UWP
TDC 2015 SP - O ciclo de vida de aplicações UWP TDC 2015 SP - O ciclo de vida de aplicações UWP
TDC 2015 SP - O ciclo de vida de aplicações UWP
 
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGI
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGIPhpconf 2013 - Agile Telephony Applications with PAMI and PAGI
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGI
 
Drools BeJUG 2010
Drools BeJUG 2010Drools BeJUG 2010
Drools BeJUG 2010
 
IoT Best practices
 IoT Best practices IoT Best practices
IoT Best practices
 
Session #6 loaders and adapters
Session #6  loaders and adaptersSession #6  loaders and adapters
Session #6 loaders and adapters
 
Ideal Deployment In .NET World
Ideal Deployment In .NET WorldIdeal Deployment In .NET World
Ideal Deployment In .NET World
 
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
 
Developing in android
Developing in androidDeveloping in android
Developing in android
 
Commenting in Agile Development
Commenting in Agile DevelopmentCommenting in Agile Development
Commenting in Agile Development
 
Windows Azure - Cloud Service Development Best Practices
Windows Azure - Cloud Service Development Best PracticesWindows Azure - Cloud Service Development Best Practices
Windows Azure - Cloud Service Development Best Practices
 
Session4 J2ME Mobile Information Device Profile(MIDP) Events
Session4 J2ME Mobile Information Device Profile(MIDP) EventsSession4 J2ME Mobile Information Device Profile(MIDP) Events
Session4 J2ME Mobile Information Device Profile(MIDP) Events
 
Flow based programming in golang
Flow based programming in golangFlow based programming in golang
Flow based programming in golang
 
Androidの本当にあった怖い話
Androidの本当にあった怖い話Androidの本当にあった怖い話
Androidの本当にあった怖い話
 
Фоновые задачи и многозадачность для Windows Phone
Фоновые задачи и многозадачность для Windows PhoneФоновые задачи и многозадачность для Windows Phone
Фоновые задачи и многозадачность для Windows Phone
 
Cool Stuff Your App Can Do
Cool Stuff Your App Can DoCool Stuff Your App Can Do
Cool Stuff Your App Can Do
 
J Unit
J UnitJ Unit
J Unit
 

Mais de WindowsPhoneRocks

Mais de WindowsPhoneRocks (20)

3 554
3 5543 554
3 554
 
22 universal apps for windows
22   universal apps for windows22   universal apps for windows
22 universal apps for windows
 
21 app packaging, monetization and publication
21   app packaging, monetization and publication21   app packaging, monetization and publication
21 app packaging, monetization and publication
 
20 tooling and diagnostics
20   tooling and diagnostics20   tooling and diagnostics
20 tooling and diagnostics
 
19 programming sq lite on windows phone 8.1
19   programming sq lite on windows phone 8.119   programming sq lite on windows phone 8.1
19 programming sq lite on windows phone 8.1
 
17 camera, media, and audio in windows phone 8.1
17   camera, media, and audio in windows phone 8.117   camera, media, and audio in windows phone 8.1
17 camera, media, and audio in windows phone 8.1
 
16 interacting with user data contacts and appointments
16   interacting with user data contacts and appointments16   interacting with user data contacts and appointments
16 interacting with user data contacts and appointments
 
15 sensors and proximity nfc and bluetooth
15   sensors and proximity nfc and bluetooth15   sensors and proximity nfc and bluetooth
15 sensors and proximity nfc and bluetooth
 
14 tiles, notifications, and action center
14   tiles, notifications, and action center14   tiles, notifications, and action center
14 tiles, notifications, and action center
 
13 networking, mobile services, and authentication
13   networking, mobile services, and authentication13   networking, mobile services, and authentication
13 networking, mobile services, and authentication
 
12 maps, geolocation, and geofencing
12   maps, geolocation, and geofencing12   maps, geolocation, and geofencing
12 maps, geolocation, and geofencing
 
10 sharing files and data in windows phone 8
10   sharing files and data in windows phone 810   sharing files and data in windows phone 8
10 sharing files and data in windows phone 8
 
09 data storage, backup and roaming
09   data storage, backup and roaming09   data storage, backup and roaming
09 data storage, backup and roaming
 
08 localization and globalization in windows runtime apps
08   localization and globalization in windows runtime apps08   localization and globalization in windows runtime apps
08 localization and globalization in windows runtime apps
 
05 programming page controls and page transitions animations
05   programming page controls and page transitions animations05   programming page controls and page transitions animations
05 programming page controls and page transitions animations
 
04 lists and lists items in windows runtime apps
04   lists and lists items in windows runtime apps04   lists and lists items in windows runtime apps
04 lists and lists items in windows runtime apps
 
03 page navigation and data binding in windows runtime apps
03   page navigation and data binding in windows runtime apps03   page navigation and data binding in windows runtime apps
03 page navigation and data binding in windows runtime apps
 
02 getting started building windows runtime apps
02   getting started building windows runtime apps02   getting started building windows runtime apps
02 getting started building windows runtime apps
 
01 introducing the windows phone 8.1
01   introducing the windows phone 8.101   introducing the windows phone 8.1
01 introducing the windows phone 8.1
 
18 windows phone 8.1 for the enterprise developer
18   windows phone 8.1 for the enterprise developer18   windows phone 8.1 for the enterprise developer
18 windows phone 8.1 for the enterprise developer
 

Último

Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
FIDO Alliance
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
FIDO Alliance
 

Último (20)

Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Your enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4jYour enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4j
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 

07 windows runtime app lifecycle

  • 1. WinRT Apps Building Apps for Windows Phone 8.1 Jump Start
  • 2.
  • 3.
  • 4.
  • 5.
  • 7. sealed partial class App : Application { /// <summary> /// Invoked when the application is launched normally by the end user. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override async void OnLaunched(LaunchActivatedEventArgs e) { // How did the app exit the last time it was run (if at all) ApplicationExecutionState previousState = e.PreviousExecutionState; // What kind of launch is this? ActivationKind activationKind = e.Kind; // ... NotRunning Running Suspended Terminated ClosedByUser Launch File Protocol VoiceCommand Etc.
  • 8. App is suspended All code stopped No timers tick No events fire Process still alive and in memory Code has a chance to respond (next slide)
  • 9. sealed partial class App : Application { public App() { this.InitializeComponent(); this.Suspending += OnSuspending; } private async void OnSuspending(object sender, SuspendingEventArgs e) { // Ask for a deferral if you need to do async work var deferral = e.SuspendingOperation.GetDeferral(); // TODO: whatever async work you need to do when suspending deferral.Complete(); // Then mark the deferral complete }
  • 10. Same app is resumed Same process, same memory so values of variables are intact All code runs Code has a chance to respond... Launch Back Switcher
  • 11. sealed partial class App : Application { public App() { this.InitializeComponent(); this.Suspending += OnSuspending; this.Resuming += OnResuming; } private void OnResuming(object sender, object e) { // TODO: whatever you need to do to resume your app }
  • 12.
  • 15.
  • 16.
  • 18.
  • 19.
  • 20.
  • 21. App Data Local Folder (or roaming folder for Data) 12:38 12:38 Jim Jones Tel: 0111 222 333 Bob Brown Tel: 0444 555 666 Arthur Abbott Tel: 0777 888 999 CONTACTS all 12:38 12:38 Work Tel: 0111 222 333 Home Tel: 0444 555 666 Email jim@jones.com CONTACTS Jim Jones 12:38 CONTACTS Add Phone Mobile Phone Phone type Phone number 0888 777 State Data
  • 22.
  • 23.
  • 24. 24
  • 25. 25
  • 31. 31
  • 32.
  • 34. ©2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.