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

[32/34] wp7 commit: Dispatching onNativeReady trigger from native side on separate patch with slight delay. Definitely need to tweak the delay

Dispatching onNativeReady trigger from native side on separate patch with slight delay. Definitely need to tweak the delay


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

Branch: refs/heads/master
Commit: bd3bb103f78a13171f1b65e9d13dabaac5a97d9c
Parents: 05a2c58
Author: filmaj <ma...@gmail.com>
Authored: Fri Mar 30 17:23:25 2012 -0700
Committer: filmaj <ma...@gmail.com>
Committed: Fri Mar 30 17:23:25 2012 -0700

----------------------------------------------------------------------
 framework/CordovaView.xaml.cs |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/bd3bb103/framework/CordovaView.xaml.cs
----------------------------------------------------------------------
diff --git a/framework/CordovaView.xaml.cs b/framework/CordovaView.xaml.cs
index 7086f9c..4b3c32c 100644
--- a/framework/CordovaView.xaml.cs
+++ b/framework/CordovaView.xaml.cs
@@ -322,11 +322,16 @@ namespace WP7CordovaClassLib
         {
             this.CordovaBrowser.Opacity = 1;
 
-            string nativeReady = "try{ cordova.require('cordova/channel').onNativeReady.fire() }catch(e){console.log('error firing nativeReady event' + e);}";
-
-            CordovaBrowser.InvokeScript("execScript",  new string[] { nativeReady });
+            Dispatcher.BeginInvoke(new ThreadStart(nativeReady));
         }
 
+        void nativeReady()
+        {
+            Thread.Sleep(1000);
+
+            string nativeReady = "cordova.require('cordova/channel').onNativeReady.fire();";
+            CordovaBrowser.InvokeScript("execScript", new string[] {nativeReady});
+        }
 
         void GapBrowser_Navigating(object sender, NavigatingEventArgs e)
         {