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/04/10 00:40:30 UTC

[31/34] wp7 commit: When execScript fails, it will continue to fail even with an separate thread and multiple tries.

When execScript fails, it will continue to fail even with an separate thread and multiple tries.


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/925c8a95
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/tree/925c8a95
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/diff/925c8a95

Branch: refs/heads/master
Commit: 925c8a95077e9ae013707da11f86c1e75e3e4948
Parents: bd3bb10
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Fri Mar 30 18:23:54 2012 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Fri Mar 30 18:23:54 2012 -0700

----------------------------------------------------------------------
 framework/CordovaView.xaml.cs |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/925c8a95/framework/CordovaView.xaml.cs
----------------------------------------------------------------------
diff --git a/framework/CordovaView.xaml.cs b/framework/CordovaView.xaml.cs
index 4b3c32c..2a75063 100644
--- a/framework/CordovaView.xaml.cs
+++ b/framework/CordovaView.xaml.cs
@@ -322,17 +322,19 @@ namespace WP7CordovaClassLib
         {
             this.CordovaBrowser.Opacity = 1;
 
-            Dispatcher.BeginInvoke(new ThreadStart(nativeReady));
-        }
-
-        void nativeReady()
-        {
-            Thread.Sleep(1000);
+            string nativeReady = "(function(){ cordova.require('cordova/channel').onNativeReady.fire()})();";
 
-            string nativeReady = "cordova.require('cordova/channel').onNativeReady.fire();";
-            CordovaBrowser.InvokeScript("execScript", new string[] {nativeReady});
+            try
+            {
+                CordovaBrowser.InvokeScript("execScript", new string[] { nativeReady });
+            }
+            catch (Exception ex)
+            {
+                Debug.WriteLine("Error calling js to fire nativeReady event :: " + ex.Message);
+            }
         }
 
+
         void GapBrowser_Navigating(object sender, NavigatingEventArgs e)
         {
             Debug.WriteLine("GapBrowser_Navigating to :: " + e.Uri.ToString());
@@ -340,8 +342,6 @@ namespace WP7CordovaClassLib
             // TODO: check whitelist / blacklist
             // NOTE: Navigation can be cancelled by setting :        e.Cancel = true;
 
-            
-
 
         }