home working, little issue on search
continuous-integration/drone/push Build is passing Details

pull/56/head
Alexandre AGOSTINHO 2 years ago
parent d939560b4f
commit a2b75d2ce4

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class ReadOnlyObservableRecipeCollection : ReadOnlyObservableCollection<Recipe>
{
private RecipeCollection _recipeObserved;
public string Description => _recipeObserved.Description;
public ReadOnlyObservableRecipeCollection(RecipeCollection recipeCollection)
: base(recipeCollection)
{
_recipeObserved = recipeCollection;
}
}
}

@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Text;
namespace Model
@ -31,6 +32,8 @@ namespace Model
_description = "No description.";
else
_description = value;
OnPropertyChanged(new PropertyChangedEventArgs("Description"));
}
}
#endregion

@ -8,8 +8,7 @@
x:Name="homepage">
<local:ContainerBase x:Name="container_base"
NeedReturn="False"
IsConnected="True">
NeedReturn="False">
<!-- Flyout -->
<local:ContainerBase.MyFlyoutContent>
@ -20,7 +19,7 @@
Margin="20, 10, 15, 0"/>
<SearchBar
Placeholder="Mots-clés (ex.: rapide, fromage)"
FontAttributes="Italic" TextColor="Black"
TextColor="Black"
BackgroundColor="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray300}}"
Margin="15, 10, 15, 40"
SearchButtonPressed="SearchBar_SearchButtonPressed"/>
@ -52,10 +51,11 @@
<!-- Master -->
<local:ContainerBase.MyContent>
<ScrollView>
<StackLayout BindingContext="{Binding RecipesDisplayed}" MinimumWidthRequest="400">
<StackLayout BindingContext="{Binding ., Source={x:Reference homepage}}"
MinimumWidthRequest="400">
<!--Modification du prof apportée sur le stacklayout pour empecher l'affichage d'une seule case recipe-->
<Label
Text="{Binding Description}"
Text="{Binding RecipesDisplayed.Description}"
TextColor="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource Gray100}}"
FontSize="24"
Padding="15"/>
@ -67,7 +67,7 @@
AlignItems="Center"
AlignContent="SpaceEvenly"
HorizontalOptions="Center"
BindableLayout.ItemsSource="{Binding}">
BindableLayout.ItemsSource="{Binding RecipesDisplayed}">
<BindableLayout.ItemTemplate>
<DataTemplate x:DataType="model:Recipe">

@ -8,18 +8,14 @@ namespace Views
public MasterManager Master => (Application.Current as App).Master;
private readonly RecipeCollection _recipesDisplayed;
public ReadOnlyObservableCollection<Recipe> RecipesDisplayed { get; private set; }
public static readonly BindableProperty IsNotConnectedProperty =
BindableProperty.Create("IsNotConnected", typeof(bool), typeof(bool));
public ReadOnlyObservableRecipeCollection RecipesDisplayed { get; private set; }
public string Description => _recipesDisplayed.Description;
public Home()
{
_recipesDisplayed = Master.Recipe.GetAllRecipes();
RecipesDisplayed = new ReadOnlyObservableCollection<Recipe>(_recipesDisplayed);
RecipesDisplayed = new ReadOnlyObservableRecipeCollection(_recipesDisplayed);
InitializeComponent();

@ -17,7 +17,6 @@ public partial class ContainerBase : ContentView
public ContainerBase()
{
InitializeComponent();
BindingContext = this;
}

Loading…
Cancel
Save