exports.onTap = function () {
    camera.takePicture().then(function(picture) {
        console.log("Result is an image source instance");
        
        var image = new imageModule.Image();
        image.imageSource = picture;

        myImage.imageSource = picture;
    });
}
function takePhoto() {
    camera.takePicture()
        .then(function (imageAsset) {
        console.log("Result is an image asset instance");
        img.src = imageAsset;
        image_source_1.fromAsset(imageAsset).then(function (res) {
            myImageSource = res;
            console.log(myImageSource);
        });
    }).catch(function (err) {
        console.log("Error -> " + err.message);
    });
}
function onTap() {
    camera.takePicture().
        then(function (imageAsset) {
        console.log("Result is an image asset instance");
        img.src = imageAsset;
        image_source_1.fromAsset(imageAsset).then(function (res) {
            var folder = fs.knownFolders.documents();
            var path = fs.path.join(folder.path, "Test.png");
            var saved = res.saveToFile(path, "png");
        });
    }).catch(function (err) {
        console.log("Error -> " + err.message);
    });
}
		do_capture: function() {
			var self = this;
			camera.takePicture({width:300,height:300,keepAspectRatio:true})
			.then((imageAsset) => {
				let source = new imageSource.ImageSource();
				source.fromAsset(imageAsset).then((picture) => {
					var imageCropper = new ImageCropper();
					imageCropper.show(picture).then(function(args){
						self.image_src = args.image;
					})
					.catch(function(e){
						console.log(e);
					});
				});
			}).catch((err) => {
				console.log("Error -> " + err.message);
			});
		}
 DetailComponent.prototype.onAddImageTap = function () {
     var _this = this;
     if (!geolocation.isEnabled()) {
         geolocation.enableLocationRequest();
     }
     camera.takePicture({ width: 100, height: 100, keepAspectRatio: true })
         .then(function (picture) {
         var image = new image_source_1.ImageSource();
         image.fromAsset(picture).then(function (imageSource) {
             _this.page.Image = imageSource;
             _this.page.ImageBase64 = _this.page.Image.toBase64String("png");
         });
         geolocation.getCurrentLocation(null)
             .then(function (location) {
             _this.page.Lat = location.latitude;
             _this.page.Long = location.longitude;
         });
     });
 };
        var onAddImageTap = function(args) {
            if (!geolocation.isEnabled()) {
                geolocation.enableLocationRequest();
            }

            camera.requestPermissions();
            camera
                .takePicture({ width: 100, height: 100, keepAspectRatio: true, saveToGallery: false })
                .then(function (imageAsset) {
                    this._item.set("image", imageAsset);

                    geolocation
                        .getCurrentLocation()
                        .then(function (location) {
                            this._item.set("lat", location.latitude);
                            this._item.set("long", location.longitude);
                        }.bind(this));
                    }.bind(this));
        }.bind(this);
exports.onAddImageTap = function (args) {
    var scrapbookPage = updateStackLayout.bindingContext;

    if (!geolocation.isEnabled()) {
        geolocation.enableLocationRequest();
    }

    camera.takePicture({ width: 100, height: 100, keepAspectRatio: true }).then(function (picture) {
        image.fromAsset(picture).then(function (imageSource) {
            scrapbookPage.set("image", imageSource);
        });

        geolocation
            .getCurrentLocation()
            .then(function (location) {
                scrapbookPage.set("lat", location.latitude);
                scrapbookPage.set("long", location.longitude);
            });
    });
};