예제 #1
0
        private async Task ResumeAfterFormDialog(IDialogContext context, IAwaitable <WeatherQuery> result)
        {
            try
            {
                var searchQuery = await result;
                var weatherInfo = await weatherService.GetWeatherAsync(searchQuery);

                var message = context.MakeMessage();
                message.Text = $"{weatherInfo.Name}の天気は...";
                message.Attachments.Add(new Attachment()
                {
                    ContentUrl  = weatherService.GetWeatherIcon(weatherInfo),
                    ContentType = "image/png"
                });

                await context.PostAsync(message);

#if DEBUG
                await context.PostAsync(this.FormatWeatherInfo(weatherInfo));
#endif
            }
            catch (FormCanceledException ex)
            {
                throw ex;
            }
            finally
            {
                context.Done <object>(null);
            }
        }