You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.1 KiB
69 lines
2.1 KiB
//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());
|
|
|
|
}
|
|
|
|
}
|
|
}
|