You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2012/05/14 21:26:18 UTC
[3/3] wp7 commit: added try/catch for backbutton handling when a page
is not loaded in the webbrowser, was an exception
added try/catch for backbutton handling when a page is not loaded in the webbrowser, was an exception
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/commit/b9ab2423
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/tree/b9ab2423
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/diff/b9ab2423
Branch: refs/heads/master
Commit: b9ab2423e0d4f41ea2874a15a8968821ce083b19
Parents: eac02c8
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Mon May 14 10:08:15 2012 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Mon May 14 10:08:15 2012 -0700
----------------------------------------------------------------------
framework/CordovaView.xaml.cs | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/b9ab2423/framework/CordovaView.xaml.cs
----------------------------------------------------------------------
diff --git a/framework/CordovaView.xaml.cs b/framework/CordovaView.xaml.cs
index 7456985..afd09d0 100644
--- a/framework/CordovaView.xaml.cs
+++ b/framework/CordovaView.xaml.cs
@@ -320,6 +320,7 @@ namespace WP7CordovaClassLib
void page_BackKeyPress(object sender, CancelEventArgs e)
{
+
if (OverrideBackButton)
{
try
@@ -334,10 +335,17 @@ namespace WP7CordovaClassLib
}
else
{
- PageDidChange = false;
- // calling js history.back with result in a page change if history was valid.
- CordovaBrowser.InvokeScript("eval", new string[] { "(function(){window.history.back();})()" });
- e.Cancel = PageDidChange;
+ try
+ {
+ PageDidChange = false;
+ // calling js history.back with result in a page change if history was valid.
+ CordovaBrowser.InvokeScript("eval", new string[] { "(function(){window.history.back();})()" });
+ e.Cancel = PageDidChange;
+ }
+ catch (Exception)
+ {
+ e.Cancel = false; // exit the app ... ?
+ }
}
}