public async void LoadDocument(object obj) { try { DocumentSource = await Common.LoadCamara("document"); DocumentResource = ImageSource.FromStream(() => { var stPassport = DocumentSource.GetStream(); return(stPassport); }); } catch (Exception ex) { Debug.WriteLine("Camera error: " + ex.Message); } }
private bool SaveDocument() { var urli = string.Format("https://api.onfido.com/v2/applicants/{0}/documents", ApplicationId); var httpContents = new List <ParameterEntity>() { new ParameterEntity { httpContent = new StringContent(DocumentType), Name = "\"type\"" } }; var fileContent = new StreamContent(DocumentSource.GetStream()); fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data") { Name = "file", FileName = "documentReview.png" }; fileContent.Headers.ContentType = new MediaTypeHeaderValue("image/png"); httpContents.Add(new ParameterEntity { httpContent = fileContent }); var authorization = string.Format("Token token={0}", Token); var response = Common.SendRequest(urli, httpContents, authorization, HttpMethod.Post); if (response) { return(true); } else { return(false); } }