//using Android.Media; using DataPersistence; using Model; using Model.Managers; using System.ComponentModel; namespace Views { public partial class Home : ContentPage { public MasterManager MasterMgr => (App.Current as App).MasterMgr; public User? user => (App.Current as App).CurrentUser; public RecipeCollection AllRecipe => (App.Current as App).AllRecipes; public RecipeCollection RecipesDisplayed { get; set; } public static readonly BindableProperty IsNotConnectedProperty = BindableProperty.Create("IsNotConnected", typeof(bool), typeof(bool)); public bool IsNotConnected { get => (bool)GetValue(IsNotConnectedProperty); set => SetValue(IsNotConnectedProperty, value); } public static readonly BindableProperty NeedReturnProperty = BindableProperty.Create("NeedReturn", typeof(bool), typeof(bool)); public bool NeedReturn { get => (bool)GetValue(NeedReturnProperty); set => SetValue(NeedReturnProperty, value); } public Home() { RecipesDisplayed = MasterMgr.DataMgr.GetRecipes("Suggestions"); InitializeComponent(); BindingContext = this; IsNotConnected = true; NeedReturn = false; } public Home(RecipeCollection recipesDisplayed) { RecipesDisplayed = recipesDisplayed; InitializeComponent(); BindingContext = this; IsNotConnected = true; NeedReturn = true; } private async void SearchBar_SearchButtonPressed(object sender, EventArgs e) { string searchStr = (sender as SearchBar).Text; await Navigation.PushModalAsync(new Home(AllRecipe.ResearchByName(searchStr))); } public void OnImageClicked(object sender, EventArgs e) { (App.Current as App).CurrentRecipe = (Recipe)(sender as ImageButton).BindingContext; Navigation.PushModalAsync(new ViewRecette()); } } }