Cool Stuff Your App Can Do

1,964 views

Published on

To get a .zip file of the demos, email me!

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,964
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
20
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • You can do this from either a real device via the visualizer or the latest version of the emulator. The visualizer approach is perhaps more impressive as you can have some games amongst the programs that you can show navigation to.Show the Windows Phone start screen.Start Internet Explorer. Navigate to a page.Press the Windows Button to reopen the start page.Open the Settings page.Open the Theme page in settings.Press the Search buttonThe search window will openHold down the Back buttonThis will display all the currently active applications including theme, settings, search and IETouch IE to return to it.Press the Back button. Note that you are returned to the Search page. Ask if this is sensible.Answer: Yes it is, this is the place you were at before you switched back to the browser.Ask where you will go if you press the back button again. Answer: Back to the theme page.Press back to prove this.Press the back button again and you will return to the Settings page.Explain that with each press of back you are unwinding the back stackPress back at the Settings page and you are not returned to IE. Ask why.Answer: IE was moved to the top of the stack when we selected it from the list of applications. Instead you are returned to the Start page.Hold down the Back button to display the list of currently active applications and you should just see the start page, since all the others have been “popped” off.
  • This is the test that can be performed during Activation. If the test fails it means that we have to reload everything.
  • This is a recap, the content should have been covered in an earlier module.However, make the point that Isolated storage is available up to the capacity of the phone (at least 8GBytes or so). But it is slow to use and should only be used to persist non volatile data, for example word documents and media etc.State storage is phone memory set aside to hold the state information for dormant or tombstoned applications. This is very fast to use, but the amount available is limited, and it will be discarded if the phone is turned off.
  • Start Visual Studio Open the project CaptainsLogin the folder Demo 1 CaptainsLog No StorageEnsure that the deployment target is set to Windows Phone EmulatorPress F5 to start the program running.Enter some text into the textbox in the Add Entry page.Click the Store buttonThe add entry textbox should clear as this text is added to the log.Enter some more text.Click the Store button again to store the next entry.Click the View Log button.This will show the two entries, with date and timestaps on them.Ask the class what will happen if you press the Back button on the phone.Answer: Since you are on a sub page you should be directed back to the parent one.Press Back and be directed back to the Add Entry page.Ask the class what will happen if you press the Back button again.Answer: Since this is the top menu, it should end the application.Press the Back button on the phoneand the application will stop.Press F5 to run the application again.Click the View Log button. Note that the log is empty now, as it was not stored when the program.Press Back to return to the Add Entry page.While the program is still running, and at the Add Entry page, open the file App.xaml.cs in Visual Studio (you might need to open the Solution Explorer to find this).Put a breakpoint at the start of the Application_Closing method.Return to the emulator and press Back to end the program. Note that the breakpoint is hit. Explain that we are going to add some code that will store the data on exit from the program and reload it on return.End the program.Clear the breakpoint for next time and exit Visual Studio.
  • Make the point that for this reminder there is no recurrence. We are only boiling one egg.This can be set to daily, monthly, end of month and yearly.You can also set an expiration time when the reminder is to stop
  • Make the point that, as with other tasks, even though a reminder has fired it will still exist in the system.If we want to, we can find that reminder and update it, alternatively we can delete the reminder and make a new one.
  • The Picture Fetch program uses all the code shown above. It fetches a file into IsolatedStorage and then displays it on the screen.Start Visual Studio Open the project EggTimerin the folder Demo 4 EggTimerEnsure that the deployment target is set to Windows Phone EmulatorPress F5 to run the program.Set the slider to 1 minute.Press the Start Timer button.Keep the audience amused for a minute.When the notification fires, click in the notification to show how the navigation moves to the Egg Ready page.Stop the program and close Visual Studio
  • Windows phone has the unique ability to provide the end user glanceable access to the information they care most about, via Live Tiles +Push Notifications offer developers a way to send timely information to the end user’s device even when the application is not running, including Tile updatesDevelopers cannot force a tile to StartTo add a tile to the Start screen, the end-user can tap and Hold in App List then select “Pin to Start”End-users can move, re-order, and remove from Start screen
  • Tiles use a data driven template model. Every tile maps to a template that defines a set of data properties. Windows Phone 7.5 (Mango) supports “tile flip”. Developers can write to the back and front of a tile. Windows Phone automatically animates between front and back.
  • Also new in Windows Phone 7.5 is ability to update front and back of tiles.Background InfoApplication TileCan be created by the user only when the user taps and holds the application name in the Application List and then selects pin to start. Properties are initially set in the Application Manifest. For more information, see How to: Set the Initial Properties for the Application Tile for Windows PhoneCannot be deleted. The Application Tile may or may not be pinned to Start. But even if the user has not pinned the Application Tile to Start, it can be updated programmatically such that its property data will be fresh should the user decide to pin it. Can be updated by:ShellTile APIs. The Application Tile is always the first item in the ActiveTiles collection, even if the Tile is not pinned to Start.Push Notifications for Windows PhoneShellTileSchedule APIsSecondary TilesCan be created only as the result of user input in an application. The application then uses the Create(Uri, ShellTileData) method to create a Tile on Start. Because the UI will navigate to Start when a new secondary Tile is created, only one secondary Tile can be created at a time.Can be deleted by: The user unpinning the Tile from Start.Uninstalling the application.Calling Delete()Can be updated by:ShellTile APIsPush Notifications for Windows PhoneShellTileSchedule APIs
  • New API in Windows Phone 7.5 to support local tile updates.
  • Cool Stuff Your App Can Do

    1. 1. Cool Stuff Your AppCan DoEd DonahueAcademic Developer Evangelisted.donahue@microsoft.comcreepyed.com | @creepyed
    2. 2. What I’m Going to Cover Storage and tombstoning Alarms and reminders Application tiles Other cool stuff Windows Phone 2
    3. 3. Storage andTombstoning
    4. 4. DemoFast ApplicationSwitching
    5. 5. Application Lifecycle - Dormant Fast App Resume runningState preserved!e.IsApplicationInstancePreserved Save State!== true activated deactivated dormant Phone resources detached Threads & timers suspended Windows Phone
    6. 6. Application Lifecycle - Tombstoned Resuming .. .Restore state!e.IsApplicationInstancePreserved== false running activated deactivated Tombstone the oldest app Tombstoned dormant Phone resources detached Threads & timers suspended Windows Phone
    7. 7. Finding the Resume type private void Application_Activated(object sender, ActivatedEventArgs e) { if (e.IsApplicationInstancePreserved) { // Dormant - objects in memory intact } else { // Tombstoned - need to reload } } The Activation handler can test a flag to determine the type of resume taking place Windows Phone
    8. 8. Deactivation ResourceManagement MediaPlayer.Pause MediaElement.Pause SoundEffectInstance.Pause VibrateController.Stop PhotoCamera.Dispose Save page/global state XNA Audio Paused Sensors Notifications suppressed Networking Cancelled Sockets Disconnected MediaElement Disconnected Camera Disposed Windows Phone
    9. 9. Activation Resource Management MediaElement.Source/Position/ Play Socket.ConnectAsync new PhotoCamera/VideoCamera Restore app state if tombstoned XNA Audio Resumed Sensors Notifications resumed Networking Completed with Cancellation Sockets - MediaElement - Camera - Windows Phone
    10. 10. Isolated Storage vs State Storage Isolated storage is so called because the data for an application is isolated from all other applications  It can be used as filestore where an application can store folders and files  It is slow to access, since it is based on NVRAM technology  It can also be used to store name/value pairs, e.g. program settings State storage is so called because it is used to hold the state of an application  It can be used to store name/value pairs which are held in memory for dormant or tombstoned applications  It provides very quick access to data Windows Phone 10
    11. 11. Captain’s LogDemo• With No Storage• With Storage• Fully Working
    12. 12. Fast App Switching andTombstoning Review Only one Windows Phone application is Active at any time The Start and Back buttons on the phone are used to start new applications and return to previously used ones If an application is replaced by another it is either made Dormant (still in memory but not running) or Tombstoned (removed from memory) Applications must use populate methods provided in the App.xaml.cs class to save and retrieve state information when appropriate  State can be stored in memory for quick reload and in isolated storage which serve as a permanent store Windows Phone 12
    13. 13. Alarms andReminders
    14. 14. Scheduled Notifications Time-based, on-phone notifications Supports Alarms & Reminders Persist across reboots Adheres to user settings Consistent with phone UX Windows Phone
    15. 15. Alarms vs Reminders? Alarms Reminder s• Modal • Rich information• Snooze and Dismiss • Integrates with other• Sound customization reminders• No app invocation • Snooze and Dismiss• No stacking • Launch app • Follows the phones global 15 settings
    16. 16. Creating a Reminder using Microsoft.Phone.Scheduler; ... eggReminder = new Reminder("Egg Timer"); eggReminder.BeginTime = DateTime.Now + new TimeSpan(0, eggTime, 0); eggReminder.Content = "Egg Ready"; eggReminder.RecurrenceType = RecurrenceInterval.None; eggReminder.NavigationUri = new Uri("/EggReadyPage.xaml", UriKind.Relative); ScheduledActionService.Add(eggReminder); This code creates a reminder and adds it as a scheduled service The value eggTime holds the length of the delay This code also sets the url of the page in the application Windows Phone
    17. 17. Reminder HousekeepingReminder eggReminder = ScheduledActionService.Find("Egg Timer") as Reminder;if ( eggReminder != null ){ ScheduledActionService.Remove("Egg Timer");} Reminders are identified by name This code finds the “Egg Timer” reminder and then removes it from the scheduler Windows Phone
    18. 18. DemoEgg Timer
    19. 19. Application Tiles
    20. 20. Tiles 101 Shortcuts to apps Static or dynamic 2 sizes: small & large  Large only for 1st party apps End-user is in control Windows Phone
    21. 21. Data Driven Template Model A fixed set of data properties Each property corresponds to a UI element Each UI element has a fixed position on screen Not all elements need to be used Animations are not extensible Background Title Count Image (173 x 173 .png) Windows Phone
    22. 22. Scenarios/Popular Applications Weather Apps  Send to WP7  Weather Tile  Link Tile  Warning Toast  Link Toast Chess by Post  AlphaJax  Turn Tile  Turn Tile  Move Toast  Move Toast Beezz  Seattle Traffic Map  Unread Tile  Traffic Tile  Direct Toast Windows Phone
    23. 23. Primary and Secondary Tiles Application Tile Front  Pinned from App List  Properties are set initially in the Application Manifest Back Secondary Tile  New in Windows Phone 7.5!  Created as a result of user input in an application Windows Phone
    24. 24. Live Tiles – Local Tile API Local tile updates (these are *not* push)  Full control of all properties when your app is in the foreground or background  Calorie counter, sticky notes Multi-Tile!  Deep-link to specific application sections  Launch directly to page/experience Windows Phone
    25. 25. Live Tiles – Local Tile APIContinued… Back of tile updates  Full control of all properties when your app is in the foreground or background  Content, Title, Background Content Content string is Background bigger Title Title  Flips from front to back at random interval  Smart logic to make flips asynchronous Windows Phone
    26. 26. DemoLive Tiles – Local Tile API
    27. 27. Other Cool Stuff
    28. 28. Easy-Bake Oven Apps AppMakr Follow My Feed ScriptTD Silverlight Toolkit: silverlight.codeplex.com Windows Phone
    29. 29. AppMakr (appmakr.com) Tips Find RSS feeds either by searching AppMakr or searching the site for “RSS” Want a Twitter RSS?  http://twitter.com/statuses/user_timeline/USERID.atom  Use www.idfromuser.com to find Twitter user ID Want to make multiple RSS feeds into one?  Yahoo Pipes  http://rssmix.com ( I used this one) Feel free to upload your own images  App icon: 512 x 512 pixels  Splash screen: 480 x 800 pixels bit.ly/appmakrlab Windows Phone
    30. 30. FollowMyFeed.net Uses Panorama One RSS feed Allows for favorites Windows Phone
    31. 31. ScriptTD Tower defense game engine All you have to do is change the graphics & audio! scriptTD.codeplex.com/ Windows Phone
    32. 32. Contests!
    33. 33. Idea of the Week Submit your great app idea for a chance to win $50! Create a Sketchflow prototype and post it online (wp7sketchflow.codeplex.com/) Tweet the URL with #WPAppItUp Judged on Innovation, Experience and Potential Rules: bit.ly/idearules Windows Phone
    34. 34. Your App Here Be a featured app in December, January or February! Win a digital ad campaign that will deliver one million ad impressions! Receive featured placement on the Windows Phone Marketplace More info: wpyourapphere.com Windows Phone
    35. 35. Core77 Fast Track Design a productivity app for Windows Phone 5 winning designers get an App Development Deal, Windows Phone, Xbox 360 with Kinect, & App Hub subscription Ends Nov. 18. 2011 More info: http://fasttrackapp.core77.com Windows Phone
    36. 36. Q&A
    37. 37. 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.© 2011 Microsoft Corporation.All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S.and/or other countries.

    ×