Presentation is loading. Please wait.

Presentation is loading. Please wait.

Windows Phone 7.5 Academic RoadShow Christophe Peerens Neomytic.

Similar presentations


Presentation on theme: "Windows Phone 7.5 Academic RoadShow Christophe Peerens Neomytic."— Presentation transcript:

1 Windows Phone 7.5 Academic RoadShow Christophe Peerens Neomytic

2

3 Student Developer Competition 11 Windows Phone to Win From 1 October to 31 October Publish 3 Application for Windows Phone on the Marketplace More information on the Microsoft Academic Blog – http://blogs.msdn.com/b/academicbelux/ http://blogs.msdn.com/b/academicbelux/

4 Student Developer Competition : How to Download the free tools – create.msdn.com (App Hub) create.msdn.com Develop your App Test your App – Your Teacher will receive 1 Windows Phone. Submit your App – Free for Student through your DreamSpark account (www.dreamspark.be)www.dreamspark.be

5 Stay connected My Blog – http://www.mytic.be/blog/cpe http://www.mytic.be/blog/cpe David Hernie – http://www.mytic.be/blog/dhe http://www.mytic.be/blog/dhe

6 End of the session At the end, don’t forget to ask to fill the evaluation form http://www.surveymonkey.com/s/HQ979TF and take a chance to win a Windows Phone 7

7 INTRODUCTION BIG PICTURE OF WINDOWS PHONE 7.5

8 Major Investment Areas Multi-tasking Enhanced Phone Framework XNA Silverlight Integration Integrating with the phone Performance Database Access Complete the push notification and Tile experience Marketplace Services Sockets

9 Multitasking Themes Fast Application Resume – Ability to resume applications that the user has recently used – Apps stay in memory unless memory is needed for other apps – *Every* app should do this Background Agents – Ability to run your code in the background – Audio, Timed or on Idle Notifications – Ability to create alarms and reminders – UX and behavior is the same as the phone Alarms and Calendar items Background Transfer Service – Application can queue up transfers in the background

10 Integrating with the Phone Camera Access to the pipeline No need to capture the image to flash Networking Sockets Connection Manager control Sensors GPS Accelerometer Compass Gyro Spatial Framework Data SQL CE Phone Contacts Phone Calendar Launchers & Choosers Bing Maps E-mail Phone Number Address Chooser Controls Frame and Page Navigation improvements Performance Open Source on CodePlex

11 Expanding the Phone Framework Push Notifications Deep Toast More control over notifications Phone Extras Search Music Photos Tiles Signature user experience for Windows Phone Complete Framework Multiple Tiles

12 Silverlight Investments Silverlight 4 RichTextBox Implicit Styles Clipboard API Performance Memory Management Input on Render Thread Profiler Instrumentation International Reading/Writing of all Mango Languages Big deal if you are writing an app for Asia XNA & Siverlight in the same app

13 Tools Investments.NET Performance Generational GC Serialization SIMD – Vector Profiler Tools New Template for Multitasking Debugging Background Agents Isolated Storage Explorer Profiler Emulator Sensors and Location in Emulator Multi Touch in Emulator Screen shot Ingestion Tool

14 DEVELOPER TOOLS & MARKETPLACE

15 My Hello World App Demo

16 What’s New in Windows Phone Developer Tools & Marketplace Multi-targeting Multitasking support Silverlight and XNA interop support Profiler Emulator enhancements

17 Emulator Enhancements Media support for H.264 Memory model improvements – Emulator can handle physical memory fragmentations like device Sensor Support

18 Accelerometer Based Apps

19 Emulator – Accelerometer support Demo

20 Location Based Apps

21 Emulator – Location support Demo

22 Profiler

23 Demo

24 Other Tooling support Multi-tasking Debugging support Isolated Storage Explorer Screen shot Tool

25 Marketplace Public Private Beta Test for Marketplace available inside VS2010

26 Marketplace test inside VS2010 Demo

27 MULTITASKING

28 Windows Phone Multitasking Multitask Between Application – Quickly Switch – Quickly Resume Start in foreground & continue in Background

29 Windows Phone Harmony Network Conscience Battery Friendly Hardened Services Delightful and Responsive UX Never Regret App Install Integrated Feel UX Health

30 Application Lifecycle Running Deactivated DormantActivated Save but do not dispose of state Re-load state ONLY if tombstoned Application is resident in memory; system detaches resources and pauses threads Tombstoned

31 Backgroud Notification Service Alarms using Microsoft.Phone.Scheduler; private void AddAlarm(object sender, RoutedEventArgs e) { Alarm alarm = new Alarm("Long Day"); alarm.BeginTime = DateTime.Now.AddSeconds(15); alarm.Content = "It's been a long day. Go to bed."; alarm.Title = "Alarm"; ScheduledActionService.Add(alarm); }

32 Backgroud Notification Service Reminders using Microsoft.Phone.Scheduler; private void AddReminder(object sender, RoutedEventArgs e) { Reminder reminder = new Reminder("CompanyMeeting"); reminder.BeginTime = DateTime.Now.AddSeconds(15); reminder.Content = "Soccer Fields by The Commons"; reminder.Title = "Microsoft Annual Company Product Fair 2009"; reminder.RecurrenceType = RecurrenceInterval.Yearly; reminder.NavigationUri = new Uri("/Reminder.xaml", UriKind.Relative); ScheduledActionService.Add(reminder); }

33 Background Transfer Service Cloud Background Transfer Service <2 GB <20 MB <~3.0 MB GET POST My WP Book App ISO Store

34 Background Transfer Service using Microsoft.Phone.BackgroundTransfer; void DownloadWithBTS(Uri sourceUri, Uri destinationPath) { btr = new BackgroundTransferRequest(sourceUri, destinationUri); btr.TransferStatusChanged += BtsStatusChanged; btr.TransferProgressChanged += BtsProgressChanged; BackgroundTransferService.Add(btr); } void BtsProgressChanged(object sender, BackgroundTransferEventArgs e) { DrawProgressBar(e.Request.BytesReceived); }

35 Generic Background Agents Agents – Periodic – On Idle – May have one or both Initialized in foreground, run in background – Persisted across reboots User control through CPL – Up to a maximum of 18 Synchronize with foreground through mutex Agent runs for up to 14 days (can be renewed)

36 Generic Agent Types Periodic Agents Occurrence – Every 30 min Duration – 15 seconds Scenarios – Incremental data sync – Location – Others… On Idle Agents Occurrence – External power, non-cell network Duration – 10 minutes Scenarios – Data feasting – Initial sync – Others…

37 Periodic Agent - Sample Code private void StartSearchAgent(object sender, RoutedEventArgs e) { PeriodicTask task = new PeriodicTask("twitter"); task.Description = "Gets latest tweet"; task.ExpirationTime = DateTime.Now.AddDays(7); ScheduledActionService.Add(task); } <BackgroundServiceAgent Specifier="ScheduledTaskAgent" Name="TwitterAgent" Source="TweetAgent" Type="TweetAgent.TweetAgent"/> public class TweetAgent : ScheduledTaskAgent { public override void OnInvoke(ScheduledTask Task) { // Do some background work NotifyComplete(); }; }

38 Background Audio – HTML5 <audio id="audio_tag" controls="controls" src="http://html5audio.com/Demo1.mp3" onplay="StartPlayback()" onended="NextTrack()" function NextTrack() { musicPlayer = document.getElementById("audio_tag"); musicPlayer.src = 'http://html5audio.com/Demo2.mp3'; } Cloud Browser Zune Service ++

39 Background Audio – URL Based Cloud Zune Service My Music App ISO Store ++ Buffer void PlayStateChanged(object sender, EventArgs e) { switch (player.PlayerState) { case PlayState.FastForwarding: // Move to next track break; } Player = BackgroundAudioPlayer.Instance; player.PlayStateChanged += new eventHandler(PlayStateChanged); AudioTrack track = new AudioTrack(new Uri("/audiofile.mp3"),…); … player.Play();

40 End-to-End Architecture System Services ISO Store Cloud Different Processes Logic UX myapp.dll ApplicationOS Logic myappagent.dll Single App Developer

41 Background Agent Functionality Allowed  Tiles  Toast  Location  Network  R/W ISO store  Structured storage  Sockets  Most framework APIs Restricted  Display UI  XNA libraries  Microphone and Camera  Sensors  Play audio (may only use background audio APIs)

42 Windows Phone Harmony - UX CPU – Balance foreground and background – Monitor usage Delightful and Responsive UX Never Regret App Install Integrated Feel  Working Set  Maximize # of dormant apps  5 MB for periodic  10 MB for audio  BTS limits per app  Periodic agents run serially when screen is on  App isolation is maintained  No app execution on install  Additional ingestion rules

43 Windows Phone Harmony - Health Efficient Network Usage – Aligned with radio – On Idle agents don’t use radio Network Conscience Battery Friendly Hardened Services  New System Services  Secure  Performant  Reliable  Stress tested  Periodic Agents  CPL provides user control  Expire after 14 days  Run 15 seconds every 30 min  Cache GPS  Execute in parallel when screen is off  Participate in battery saver mode

44 Periodic Agent Demo

45 SQLCE AND ISOLATED STORAGE

46 Local Data Storage: Overview Apps store private data in Isolated Storage  Settings and properties in the app dictionary  Unstructured data in Isolated Storage files  Structured data in database files Application Settings File App Creates/Manages files and settings Application Files App Data Folder Creates root folder sandboxed to App Package Manager App Root Folder WP7 Isolated Storage APIs Install DB Database file DB Database File (r/o)

47 Architecture Custom Data Context App Objects Identity Management Change Tracking Update Processing Object Materialization Core ADO.NET (System.Data) SQLCE ADO.NET Provider (System.Data.SqlServerCe) SQL CE DB.Call System.Linq.Queryable.Select(.Call System.Linq.Queryable.Where(.Constant(Table(Wines)), '(.Lambda #Lambda1)), '(.Lambda #Lambda2)).Lambda #Lambda1(db.Wines $w) { $w.Country == “USA" }.Lambda #Lambda2(w.Country $w) { $w.Name } var query = from w in db.Wines where w.Country == “USA" select w.Name; select Name from Wines where Country = “USA”

48 Code First Development Design time  Create object model: wines, varietals, vineyards, etc.  Decorate objects with attributes for persistence Run time  Create DataContext reference to database  Translate object model into a database file  Submit API persists changes to DB Database upgrade  Create new objects to enable new features  Use upgrade APIs to change DB Varietals Wines Vineyards WineMakers

49 Database Creation: Example // Define the data context. public partial class WineDataContext : DataContext { public Table Wines; public Table Vineyards; public WineDataContext(string connection) : base(connection) { } } // Define the tables in the database [Table] public class Wine { [Column(IsPrimaryKey=true] public string WineID { get; set; } [Column] public string Name { get; set; } …… } // Create the database form data context, using a connection string DataContext db = new WineDataContext("isostore:/wineDB.sdf"); if (!db.DatabaseExists()) db.CreateDatabase();

50 Queries: Examples // Create the database form data context, using a connection string DataContext db = new WineDataContext("isostore:/wineDB.sdf"); // Find all wines currently at home, ordered by date acquired var q = from w in db.Wines where w.Varietal.Name == “Shiraz” && w.IsAtHome == true orderby w.DateAcquired select w;

51 Inserts/Updates/Deletes DB NameLittle Penguin VarietalPinot Noir AtHome False NameLittle Penguin VarietalPinot Noir AtHome True It’s all about the DataContext – Changes made against the DataContext first – Changes persisted by calling SubmitChanges() SubmitChanges – LINQ to SQL determines change set and submits to DB NameLittle Penguin VarietalPinot Noir AtHome False NameYellow Tail VarietalPinot Noir AtHome True

52 Inserts/Updates/Deletes Insert Update Wine newWine = new Wine { WineID = “1768", Name = “Windows Phone Syrah", Description = “Bold and spicy" }; db.Wines.InsertOnSubmit(newWine); db.SubmitChanges(); Wine wine = (from w in db.Wines where w.WineID == “1768" select w).First(); wine.Description = “Hints of plum and melon"; db.SubmitChanges();

53 Inserts/Updates/Deletes Delete var vineyardsToDelete = from Vineyards v in db.Vineyards where v.Country == “Australia” select v; db.Vineyards.DeleteAllOnSubmit (vineyardsToDelete); db.SubmitChanges();

54 SQLCE Demo

55 Database Schema Upgrades DatabaseSchemaUpdater allows for simple upgrades on your existing DB It offers the ability to add – Tables – Columns – Indices – Associations/foreign keys All schema updates are transactional More complex schema upgrades require full DB migration

56 Performance and Best Practices Keep change sets small – Submit early and often to avoid data loss on app termination Use background threads – Non-trivial operations will impact app responsiveness if done on UI thread Optimize read-only queries – Set ObjectTrackingEnabled to minimize memory usage Use secondary indices for properties which you query often Populate large reference data tables in advance – Create a simple project to prepopulate data in emulator – Pull out database file using Isolated Storage explorer When to use a database… – Expect some impact to startup time and memory usage from incorporating a DB – Stick to IsolatedStorageSettings or basic files for small data sets

57 USER DATA CONTACTS AND APPOINTMENTS

58 New and updated APIs in “Mango” Chooser Tasks related to user data – EmailAddressChooserTask – PhoneNumberChooserTask – AddressChooserTask Microsoft.Phone.UserData for direct access – Contacts – Appointments Important points – Contacts and Appointments APIs are read only – Third party social network data cannot be shared

59 Contacts/Appointments Data Shared Contact Name and Picture Other contact dataAppointments/Events Windows Live SocialYES Windows Live Rolodex (user created and SIM import) YES n/a Exchange accounts (corporate plus Google, etc.) YES Operator Address BooksYES n/a FacebookYESNO Other networks in the People Hub (e.g., Twitter) NO

60 AddressChooserTask private AddressChooserTask addressChooserTask; // Constructor public MainPage() { this.addressChooserTask = new AddressChooserTask(); this.addressChooserTask.Completed += new EventHandler ( addressChooserTask_Completed); } private void addressChooserTask_Completed(object sender, AddressResult e) { if (null == e.Error && TaskResult.OK == e.TaskResult) {... = e.DisplayName;... = e.Address; }

61 Contacts Contacts contacts = new Contacts(); contacts.SearchCompleted += new EventHandler ((sender, e) => {... = e.Results; }); // E.g. search for all contacts contacts.SearchAsync(string.Empty, FilterKind.None, null); filter expression (not a regex) Filter kind: name, email, phone or pinned to start) state // E.g. search for all contacts with display name matching "ja" contacts.SearchAsync("ja", FilterKind.DisplayName, null);

62 Appointments Appointments appointments = new Appointments(); appointments.SearchCompleted += new EventHandler ((sender, e) => {... = e.Results; }); // E.g. get next appointment (up to 1 week away) appointments.SearchAsync(DateTime.Now, DateTime.Now + TimeSpan.FromDays(7), 1, null); start date and time Maximum items to return state end date and time

63 Conclusion Many new APIs  Many new application ideas Discover and enjoy Windows Phone development Don’t forget to fill the evaluation form – http://www.surveymonkey.com/s/HQ979TF http://www.surveymonkey.com/s/HQ979TF


Download ppt "Windows Phone 7.5 Academic RoadShow Christophe Peerens Neomytic."

Similar presentations


Ads by Google