cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [41/50] [abbrv] git commit: add callback id to callbacks
Date Fri, 01 Nov 2013 01:27:36 GMT
add callback id to callbacks


Project: http://git-wip-us.apache.org/repos/asf/cordova-wp8/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-wp8/commit/f500ee2a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-wp8/tree/f500ee2a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-wp8/diff/f500ee2a

Branch: refs/heads/2.9.x
Commit: f500ee2a819fcf4763fff531e70765d3153e2c8d
Parents: d769703
Author: purplecabbage <purplecabbage@gmail.com>
Authored: Tue Oct 29 16:51:02 2013 -0700
Committer: purplecabbage <purplecabbage@gmail.com>
Committed: Tue Oct 29 16:51:02 2013 -0700

----------------------------------------------------------------------
 common/Plugins/Accelerometer.cs | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/f500ee2a/common/Plugins/Accelerometer.cs
----------------------------------------------------------------------
diff --git a/common/Plugins/Accelerometer.cs b/common/Plugins/Accelerometer.cs
index cba911c..c06cc20 100644
--- a/common/Plugins/Accelerometer.cs
+++ b/common/Plugins/Accelerometer.cs
@@ -114,6 +114,11 @@ namespace WPCordovaClassLib.Cordova.Commands
         /// <returns>status of listener</returns>
         public void start(string options)
         {
+            string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+            string callbackId = args[0];
+
+            //Debug.WriteLine("start called with callbackId : " + callbackId);
+
             if ((currentStatus == Running) || (currentStatus == Starting))
             {
                 return;
@@ -137,23 +142,28 @@ namespace WPCordovaClassLib.Cordova.Commands
                 if (currentStatus != Running)
                 {
                     this.SetStatus(ErrorFailedToStart);
-                    DispatchCommandResult(new PluginResult(PluginResult.Status.IO_EXCEPTION,
ErrorFailedToStart));
+                    DispatchCommandResult(new PluginResult(PluginResult.Status.IO_EXCEPTION,
ErrorFailedToStart), callbackId);
                     return;
                 }
             }
             catch (Exception)
             {
                 this.SetStatus(ErrorFailedToStart);
-                DispatchCommandResult(new PluginResult(PluginResult.Status.IO_EXCEPTION,
ErrorFailedToStart));
+                DispatchCommandResult(new PluginResult(PluginResult.Status.IO_EXCEPTION,
ErrorFailedToStart), callbackId);
                 return;
             }
             PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
             result.KeepCallback = true;
-            DispatchCommandResult(result);
+            DispatchCommandResult(result, callbackId);
         }
 
         public void stop(string options)
         {
+            string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+            string callbackId = args[0];
+
+            //Debug.WriteLine("stop called with callbackId : " + callbackId);
+
             if (currentStatus == Running)
             {
                 lock (accelerometer)
@@ -163,7 +173,7 @@ namespace WPCordovaClassLib.Cordova.Commands
                     this.SetStatus(Stopped);
                 }
             }
-            DispatchCommandResult(new PluginResult(PluginResult.Status.OK));
+            DispatchCommandResult(new PluginResult(PluginResult.Status.OK), callbackId);
         }
 
         /// <summary>


Mime
View raw message