Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

WP7Dev with HTML & JavaScript

1,845 views

Published on

Slides from presentation given at WPUG

Published in: Technology
  • Be the first to comment

  • Be the first to like this

WP7Dev with HTML & JavaScript

  1. 1. WP7Devwith HTML & JS<br />
  2. 2. Silverlight and the web have a history<br /><br />
  3. 3. but Silverlight doesn't work in the browser (IE Mobile) on WP7 <br /><br />
  4. 4. You can put the browser inside a Silverlight app though<br /><br />
  5. 5. Microsoft.Phone.Controls.WebBrowser<br />
  6. 6. Simplest use:.NavigateToString()<br />Demo<br />
  7. 7. A common request:HTML Help<br />
  8. 8. Loading files from IsolatedStorage.Navigate()<br />Demo<br />
  9. 9. WebBrowser doesn't include a back stackbut it's easy to create your own<br />Demo<br />
  10. 10. private readonly Stack<Uri> historyList = new Stack<Uri>();<br />protected override void OnBackKeyPress(CancelEventArgs e)<br />{<br />if (this.historyList.Count > 1)<br /> {<br />this.historyList.Pop();<br />this.webBrowser1.Navigate(this.historyList.Peek());<br />e.Cancel = true;<br /> }<br />base.OnBackKeyPress(e);<br />}<br />private void webBrowser1_Navigated(object sender, NavigationEventArgs e)<br />{<br /> if ((this.historyList.Count == 0) || <br /> (e.Uri != this.historyList.Peek()))<br /> {<br />this.historyList.Push(e.Uri);<br /> }<br />}<br />
  11. 11. Seriously consider alternatives thoughhint: Don't do it!<br />
  12. 12. Where WebBrowser can be useful:interacting with external websites<br />
  13. 13. IsScriptEnabledallows JS on page to call .net codeand .net code to call JS functions<br />
  14. 14. Authorising with OAuthOrtaking in-app payments<br />Demo<br />
  15. 15. 80020006<br /><br />
  16. 16. 80020101<br /><br />
  17. 17. Can we do more?<br />
  18. 18. Why might we want to?<br />
  19. 19. There are more mobile platforms than just Windows Phone 7(Shhh!)<br />
  20. 20. All the different platforms use different programming languages <br /><br />
  21. 21. But everyone understandsHTML, JS & CSS <br /><br />
  22. 22. Introducing<br />
  23. 23. build cross-platform mobile apps in HTML and JavaScript and still take advantage of core, native, features<br />
  24. 24. iPhoneAndroidBlackberrySymbianPalmWindows Phone 7!<br />
  25. 25. Write the HTML, JS & CSS once*and then recompile for each platform<br />*but you may want/need some variation <br />
  26. 26. navigator.notification.vibrate()navigator.geolocation.getCurrentPosition()navigator.orientation.getCurrentOrientation()navigator.network.isReachable()navigator.sms.send()navigator.telephony.call()navigator.camera.getPicture()<br />
  27. 27. Demo<br />
  28. 28. That sounds amazing!What are the cons?<br />
  29. 29. - Not all platforms support/expose the same functionality- Metro harder to mimic- Debugging harder- WP7 support not finished, yet!<br /><br />
  30. 30. Consider it if you want to go cross-platform<br /><br />
  31. 31. It's OSS & contributions welcome<br /><br />

×