示例#1
0
        public async Task StartAsync(IDialogContext context)
        {
            CookBookClient client  = new CookBookClient();
            var            recipes = await client.GetRecipes();

            await DisplayRecipes(context, recipes);
        }
        public RecipesViewModel()
        {
            _cookBookClient = new CookBookClient();

            Recipes = new ObservableCollection <Recipe>();

            RefreshCommand = new Command(async() => await Load());
        }
示例#3
0
        private async Task RecipeCallback(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            CookBookClient client   = new CookBookClient();
            var            activity = await result;

            try
            {
                var action = OrderButtonAction.FromJson(activity.Text);
                if (action.Type == 2)
                {
                    var recipe = await client.GetRecipe(action.Value);

                    await context.PostAsync($"{recipe.Description}");
                }
            }
            catch (Exception)
            {
                // todo: ewww
            }
        }