Download - WP7Dev with HTML & JavaScript
WP7Devwith HTML & JS
Silverlight and the web have a history
but Silverlight doesn't work in the browser (IE Mobile)
on WP7
You can put the browser inside a Silverlight app
though
Microsoft.Phone.Controls.WebBrows
er
Simplest use:.NavigateToString(
)
Demo
A common request:
HTML Help
Loading files from IsolatedStorage
.Navigate()
Demo
WebBrowser doesn't include a back stackbut it's easy to create your
own
Demo
private readonly Stack<Uri> historyList = new Stack<Uri>();
protected override void OnBackKeyPress(CancelEventArgs e){ if (this.historyList.Count > 1) { this.historyList.Pop(); this.webBrowser1.Navigate(this.historyList.Peek()); e.Cancel = true; }
base.OnBackKeyPress(e);}
private void webBrowser1_Navigated(object sender, NavigationEventArgs e)
{ if ((this.historyList.Count == 0) || (e.Uri != this.historyList.Peek())) { this.historyList.Push(e.Uri); }}
Seriously consider
alternatives though
hint: Don't do it!
Where WebBrowser can be useful:
interacting with external websites
IsScriptEnabled
allows JS on page to call .net code
and .net code to call JS functions
Authorising with OAuthOr
taking in-app payments
Demo
80020006
80020101
Can we do more?
Why might we want to?
There are more mobile platforms than just Windows Phone 7
(Shhh!)
All the different platforms use different
programming languages
But everyone understands
HTML, JS & CSS
Introducing
build cross-platform mobile apps in HTML and JavaScript and still take advantage
of core, native, features
iPhoneAndroid
BlackberrySymbian
PalmWindows Phone
7!
Write the HTML, JS & CSS once*
and then recompile for each platform
*but you may want/need some variation
navigator.notification.vibrate()
navigator.geolocation.getCurrentPosition(
)
navigator.orientation.getCurrentOrientati
on()
navigator.network.isReachable()
navigator.sms.send()
navigator.telephony.call()
navigator.camera.getPicture()
Demo
That sounds amazing!
What are the cons?
- Not all platforms support/expose the same
functionality- Metro harder to mimic
- Debugging harder- WP7 support not finished, yet!
Consider it if you want to go cross-platform
It's OSS & contributions welcome