Permalink
Browse files

Camera + Notification

  • Loading branch information...
1 parent 53f2d9c commit 49a9c54b318ae922e1d3565954f54bdf699b4c2c @purplecabbage purplecabbage committed with Jul 17, 2012
@@ -195,8 +195,23 @@ public void takePicture(string options)
{
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)
{
@@ -89,7 +89,11 @@ public void alert(string options)
{
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 @@ public void confirm(string options)
{
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 @@ void btnOK_Click(object sender, RoutedEventArgs e)
- 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)

0 comments on commit 49a9c54

Please sign in to comment.