namespace ShoopNCook.Pages; using Models; using ShoopNCook.Views; using Endpoint; public partial class HomePage : ContentPage { public HomePage(Account account, IEndpoint endpoint) { InitializeComponent(); IRecipesService service = endpoint.RecipesService; void PushRecipe(Layout layout, RecipeInfo info) { layout.Children.Add(new RecipeView(info, () => { Recipe recipe = service.GetRecipe(info); AccountRecipeRate rate = service.GetRateOf(account, recipe); Shell.Current.Navigation.PushAsync(new RecipePage(recipe, rate, 1)); })); } service.PopularRecipes().ForEach(recipe => PushRecipe(PopularsList, recipe)); service.RecommendedRecipes(account).ForEach(recipe => PushRecipe(RecommendedList, recipe)); ProfilePictureImage.Source = ImageSource.FromUri(account.User.ProfilePicture); ProfilePictureName.Text = account.User.Name; } private void OnSyncButtonClicked(object sender, EventArgs e) { Shell.Current.Navigation.PushAsync(new SearchPage()); } }