Skip to content

Commit

Permalink
Camera + Notification
Browse files Browse the repository at this point in the history
  • Loading branch information
purplecabbage authored and sgrebnov committed Oct 8, 2012
1 parent 53f2d9c commit 49a9c54
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
19 changes: 17 additions & 2 deletions templates/standalone/cordovalib/Commands/Camera.cs
Expand Up @@ -195,8 +195,23 @@ public void takePicture(string options)
{ {
try try
{ {
this.cameraOptions = String.IsNullOrEmpty(options) ? string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
new CameraOptions() : JSON.JsonHelper.Deserialize<CameraOptions>(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) catch (Exception ex)
{ {
Expand Down
18 changes: 14 additions & 4 deletions templates/standalone/cordovalib/Commands/Notification.cs
Expand Up @@ -89,7 +89,11 @@ public void alert(string options)
{ {
Deployment.Current.Dispatcher.BeginInvoke(() => 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; PhoneApplicationPage page = Page;
if (page != null) if (page != null)
Expand Down Expand Up @@ -120,7 +124,12 @@ public void confirm(string options)
{ {
Deployment.Current.Dispatcher.BeginInvoke(() => 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; PhoneApplicationPage page = Page;
if (page != null) if (page != null)
Expand Down Expand Up @@ -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)); StreamResourceInfo sri = Application.GetResourceStream(new Uri("/WP7CordovaClassLib;component/resources/notification-beep.wav", UriKind.Relative));
if (sri != null) if (sri != null)
Expand Down

0 comments on commit 49a9c54

Please sign in to comment.