public Task <CropResult> CropImage(string imagePath, CropRatioType ratioType) { var task = new TaskCompletionSource <CropResult>(); try { var controllar = new CropImageController(imagePath); GetController().PresentModalViewController(controllar, false); controllar.CropImageAsync(GetController(), (isImageCropDone) => { if (!isImageCropDone) { task.SetResult(new CropResult(false) { Message = "Cancelled" }); return; } task.SetResult(new CropResult(true) { FilePath = imagePath, Message = "Image cropped successfully" }); }); } catch (Exception ex) { task.SetResult(new CropResult(false) { Message = ex.Message }); } return(task.Task); }
public Task <CropResult> CropImage(string imagePath, CropRatioType ratioType) { _tcs = new TaskCompletionSource <CropResult>(); Intent intent = new Intent(_context, typeof(CropImageActivity)); intent.PutExtra("image-path", imagePath); intent.PutExtra("scale", true); _context.StartActivity(intent); return(_tcs.Task); }