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/07/18 23:10:15 UTC

[7/7] wp7 commit: Camera + Notification

Camera + Notification


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

Branch: refs/heads/master
Commit: 9d7b92a96cdda6c8a4b576ae2cfae8230e2693ee
Parents: 7cca458
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Mon Jul 16 18:15:31 2012 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Mon Jul 16 18:15:31 2012 -0700

----------------------------------------------------------------------
 templates/standalone/cordovalib/Commands/Camera.cs |   19 +++++++++++++-
 .../standalone/cordovalib/Commands/Notification.cs |   18 +++++++++++---
 2 files changed, 31 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/9d7b92a9/templates/standalone/cordovalib/Commands/Camera.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/Commands/Camera.cs b/templates/standalone/cordovalib/Commands/Camera.cs
index 9e10a7d..8fbf317 100644
--- a/templates/standalone/cordovalib/Commands/Camera.cs
+++ b/templates/standalone/cordovalib/Commands/Camera.cs
@@ -195,8 +195,23 @@ namespace WP7CordovaClassLib.Cordova.Commands
         {
             try
             {
-                this.cameraOptions = String.IsNullOrEmpty(options) ?
-                        new CameraOptions() : JSON.JsonHelper.Deserialize<CameraOptions>(options);
+                string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+                // ["quality", "destinationType", "sourceType", "targetWidth", "targetHeight", "encodingType",
+                //     "mediaType", "allowEdit", "correctOrientation", "saveToPhotoAlbum" ]
+                this.cameraOptions = new CameraOptions();
+                this.cameraOptions.Quality = int.Parse(args[0]);
+                this.cameraOptions.DestinationType = int.Parse(args[1]);
+                this.cameraOptions.PictureSourceType = int.Parse(args[2]);
+                this.cameraOptions.TargetWidth = int.Parse(args[3]);
+                this.cameraOptions.TargetHeight = int.Parse(args[4]);
+                this.cameraOptions.EncodingType = int.Parse(args[5]);
+                this.cameraOptions.MediaType = int.Parse(args[6]);
+                this.cameraOptions.AllowEdit = bool.Parse(args[7]);
+                this.cameraOptions.CorrectOrientation = bool.Parse(args[8]);
+                this.cameraOptions.SaveToPhotoAlbum = bool.Parse(args[9]);
+                
+                //this.cameraOptions = String.IsNullOrEmpty(options) ?
+                //        new CameraOptions() : JSON.JsonHelper.Deserialize<CameraOptions>(options);
             }
             catch (Exception ex)
             {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/9d7b92a9/templates/standalone/cordovalib/Commands/Notification.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/Commands/Notification.cs b/templates/standalone/cordovalib/Commands/Notification.cs
index f91cc71..896342e 100644
--- a/templates/standalone/cordovalib/Commands/Notification.cs
+++ b/templates/standalone/cordovalib/Commands/Notification.cs
@@ -89,7 +89,11 @@ namespace WP7CordovaClassLib.Cordova.Commands
         {
             Deployment.Current.Dispatcher.BeginInvoke(() =>
             {
-                AlertOptions alertOpts = JSON.JsonHelper.Deserialize<AlertOptions>(options);
+                string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+                AlertOptions alertOpts = new AlertOptions();// JSON.JsonHelper.Deserialize<AlertOptions>(options);
+                alertOpts.message = args[0];
+                alertOpts.title = args[1];
+                alertOpts.buttonLabel = args[2];
 
                 PhoneApplicationPage page = Page;
                 if (page != null)
@@ -120,7 +124,12 @@ namespace WP7CordovaClassLib.Cordova.Commands
         {
             Deployment.Current.Dispatcher.BeginInvoke(() =>
             {
-                AlertOptions alertOpts = JSON.JsonHelper.Deserialize<AlertOptions>(options);
+                //AlertOptions alertOpts = JSON.JsonHelper.Deserialize<AlertOptions>(options);
+                string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+                AlertOptions alertOpts = new AlertOptions();// JSON.JsonHelper.Deserialize<AlertOptions>(options);
+                alertOpts.message = args[0];
+                alertOpts.title = args[1];
+                alertOpts.buttonLabel = args[2];
 
                 PhoneApplicationPage page = Page;
                 if (page != null)
@@ -197,9 +206,10 @@ namespace WP7CordovaClassLib.Cordova.Commands
 
 
 
-        public void beep(string count)
+        public void beep(string options)
         {
-            int times = int.Parse(count);
+            string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+            int times = int.Parse(args[0]);
 
             StreamResourceInfo sri = Application.GetResourceStream(new Uri("/WP7CordovaClassLib;component/resources/notification-beep.wav", UriKind.Relative));
             if (sri != null)