コード例 #1
0
        public async void LoadSelfie(object obj)
        {
            SelfieSource = await Common.LoadCamara("Selfie");

            SelfieResource = ImageSource.FromStream(() =>
            {
                var stBits = SelfieSource.GetStream();
                return(stBits);
            });
        }
コード例 #2
0
        private bool SaveSelfie()
        {
            var urlSelfie    = "https://api.onfido.com/v2/live_photos";
            var httpContents = new List <ParameterEntity>()
            {
                new ParameterEntity
                {
                    httpContent = new StringContent(ApplicationId), Name = "\"applicant_id\""
                },
                new ParameterEntity
                {
                    httpContent = new StringContent("false"), Name = "\"advanced_validation\""
                }
            };

            var fileContent = new StreamContent(SelfieSource.GetStream());

            fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
            {
                Name     = "file",
                FileName = "selfieReview.jpg"
            };
            fileContent.Headers.ContentType = new MediaTypeHeaderValue("image/jpg");

            httpContents.Add(new ParameterEntity {
                httpContent = fileContent
            });

            var authorization = string.Format("Token token={0}", Token);
            var response      = Common.SendRequest(urlSelfie, httpContents, authorization, HttpMethod.Post);

            if (response)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }