Beispiel #1
0
        private async Task ResumeAfterPictureClarification(IDialogContext context, IAwaitable <IEnumerable <Attachment> > result)
        {
            await context.PostAsync(Response.Introduction_PictureSent);

            try
            {
                var attachments    = await result;
                var faceAttributes = await FaceApiService.DetectFaceAttributesAsync(attachments.First().ContentUrl);

                // Parse the result
                var gender = faceAttributes.Gender;
                var age    = (int)Math.Round(faceAttributes.Age);

                await context.PostAsync($"Now that's one good looking *{gender}*! I'm guessing you're around *{age}* years of age?");
            }
            catch (Exception ex)
            {
                await context.PostAsync($"ERROR: {ex.Message}");

                await context.PostAsync(Response.Error);
            }

            await RestartAsync(context);
        }