ViewRecipe's binding fixed. Only title remain to fix
continuous-integration/drone/push Build was killed Details

pull/65/head
Roxane 2 years ago
parent d466fbd5a0
commit 143c8b0dba

@ -56,7 +56,7 @@ namespace Views
InitializeComponent(); InitializeComponent();
UserAppTheme = AppTheme.Light; UserAppTheme = AppTheme.Light;
MainPage = new Home(); MainPage = new AddRecipe();
//MainPage = new MyPosts(); //MainPage = new MyPosts();
} }

@ -9,8 +9,8 @@
TitleMini="Ajouter une recette" TitleMini="Ajouter une recette"
NeedReturn="True" NeedReturn="True"
HeightRequest="100"/> HeightRequest="100"/>
<Grid ColumnDefinitions="auto, *" <Grid ColumnDefinitions="auto, auto"
RowDefinitions="auto,auto,auto,auto,auto,auto, auto, auto, auto" RowDefinitions="auto,auto,auto,auto,auto,auto, auto, auto, auto,auto"
Margin="50,20,20,20"> Margin="50,20,20,20">
<Label Text="Titre de la recette :"/> <Label Text="Titre de la recette :"/>
<Entry Placeholder="Saisie du texte de la recette correspondante" <Entry Placeholder="Saisie du texte de la recette correspondante"
@ -24,56 +24,47 @@
<CheckBox x:Name="CheckDessert" Grid.Row="3" Margin="155,0" /> <CheckBox x:Name="CheckDessert" Grid.Row="3" Margin="155,0" />
<Label Text="Dessert" Grid.Row="3" Margin="185,20"/> <Label Text="Dessert" Grid.Row="3" Margin="185,20"/>
<Button Text="pick photo" Clicked="PickPhoto" Grid.Row="1" Grid.Column="1"/> <Button Text="pick photo" Clicked="PickPhoto" Grid.Row="1" Grid.Column="1"/>
<Label Text="Type de priorité" Grid.Row="4"/> <Label Text="Type de priorité :" Grid.Row="4" Margin="0,10,0,20"/>
<Grid BackgroundColor="#D1E8E2" <VerticalStackLayout Grid.Row="5">
MinimumHeightRequest="100" <HorizontalStackLayout>
MaximumWidthRequest="300" <Label Text="Recettes Economiques" VerticalOptions="Center"/>
Padding="20" <CheckBox x:Name="checkEconomique"/>
Grid.Row="5"> </HorizontalStackLayout>
<Grid.RowDefinitions> <HorizontalStackLayout>
<RowDefinition Height="*"/> <Label Text="Recettes Rapides" VerticalOptions="Center"/>
<RowDefinition Height="*"/> <CheckBox x:Name="checkFast"/>
<RowDefinition Height="*"/> </HorizontalStackLayout>
<RowDefinition Height="*"/> <HorizontalStackLayout>
<RowDefinition Height="*"/> <Label Text="Recettes Faciles" VerticalOptions="Center"/>
<RowDefinition Height="*"/> <CheckBox x:Name="checkEasy"/>
<RowDefinition Height="*"/> </HorizontalStackLayout>
<RowDefinition Height="*"/> <HorizontalStackLayout>
<RowDefinition Height="*"/> <Label Text="Recettes Légères" VerticalOptions="Center"/>
</Grid.RowDefinitions> <CheckBox x:Name="checkLight"/>
<Grid.ColumnDefinitions> </HorizontalStackLayout>
<ColumnDefinition Width="*"/> <HorizontalStackLayout>
</Grid.ColumnDefinitions> <Label Text="Recettes Gourmandes" VerticalOptions="Center"/>
<Label Text="Recettes économiques" Grid.Row="0" Padding="5,0,0,0"/> <CheckBox x:Name="checkGourmet"/>
<BoxView Color="Black" HeightRequest="1" Margin="10,10,10,10" Grid.Row="1" /> </HorizontalStackLayout>
<Label Text="Recettes rapides" Grid.Row="2"/> </VerticalStackLayout>
<BoxView Color="Black" HeightRequest="1" Margin="10,10,10,10" Grid.Row="3" />
<Label Text="Recettes simples" Grid.Row="4"/>
<BoxView Color="Black" HeightRequest="1" Margin="10,10,10,10" Grid.Row="5" />
<Label Text="Recettes légères" Grid.Row="6"/>
<BoxView Color="Black" HeightRequest="1" Margin="10,10,10,10" Grid.Row="7" />
<Label Text="Recettes gourmandes" Grid.Row="8"/>
</Grid>
<Label Text="Saisir les étapes de la recette " Grid.Row="6" Margin="0,15"/> <Label Text="Saisir les étapes de la recette " Grid.Row="6" Margin="0,15"/>
<Entry Placeholder="Etape de la recette" Grid.Row="7" Margin="12,0"/> <Entry Placeholder="Etape de la recette" Grid.Row="7" Margin="12,0"/>
<HorizontalStackLayout Grid.Row="8" Margin="20"> <HorizontalStackLayout Grid.Row="8" Margin="20">
<Button WidthRequest="100" Text="Précédent" TextColor="Black" Margin="20,0,20,0"/> <Button WidthRequest="100" Text="Précédent" TextColor="Black" Margin="20,0,20,0" Clicked="AddStepRecipe"/>
<Button WidthRequest="100" Text="Ajouter" TextColor="Black" Margin="20,0"/> <Button WidthRequest="100" Text="Ajouter" TextColor="Black" Margin="20,0" Clicked="RemoveStepRecipe"/>
</HorizontalStackLayout> </HorizontalStackLayout>
<Label Text="Saisir les ingrédients de la recette" Grid.Row="6" Grid.Column="1" Margin="50,15"/> <Label Text="Saisir les ingrédients de la recette (nom, quantité, unité)" Grid.Row="6" Grid.Column="1" Margin="50,15"/>
<HorizontalStackLayout Grid.Row="7" Grid.Column="1"> <HorizontalStackLayout Grid.Row="7" Grid.Column="1">
<Entry Placeholder="Nom de l'ingrédient" Margin="12,0,50,0" WidthRequest="500"/> <Entry Placeholder="Nom de l'ingrédient" Margin="12,0,0,0" WidthRequest="500"/>
<Entry Placeholder="1" />
<Picker ItemsSource= "{Binding UnitList}"/> <Picker ItemsSource= "{Binding UnitList}"/>
</HorizontalStackLayout> </HorizontalStackLayout>
<HorizontalStackLayout Grid.Row="8" Grid.Column="1" Margin="20"> <HorizontalStackLayout Grid.Row="8" Grid.Column="1" Margin="20">
<Button WidthRequest="100" Text="Précédent" TextColor="Black" Margin="20,0,20,0"/> <Button WidthRequest="100" Text="Précédent" TextColor="Black" Margin="20,0,20,0" Clicked="AddIngredient"/>
<Button WidthRequest="100" Text="Ajouter" TextColor="Black" Margin="20,0"/> <Button WidthRequest="100" Text="Ajouter" TextColor="Black" Margin="20,0" Clicked="RemoveIngredient"/>
</HorizontalStackLayout> </HorizontalStackLayout>
<Button Grid.Row="10" Grid.ColumnSpan="2" Text="Validé" TextColor="Black" Clicked="AddRecipeValidation"/>
</Grid> </Grid>
</VerticalStackLayout> </VerticalStackLayout>
</ContentPage> </ContentPage>

@ -6,9 +6,23 @@ namespace Views
{ {
public partial class AddRecipe : ContentPage public partial class AddRecipe : ContentPage
{ {
private List<Ingredient> ingredientList;
private List<PreparationStep> preparationStepList;
public MasterManager Master => (Application.Current as App).Master; public MasterManager Master => (Application.Current as App).Master;
public List<Unit> UnitList { get; set; } = new List<Unit> { Unit.unit, Unit.kG, Unit.mG, Unit.G, Unit.L, Unit.cL, Unit.mL }; public List<Unit> UnitList { get; set; } = new List<Unit> { Unit.unit, Unit.kG, Unit.mG, Unit.G, Unit.L, Unit.cL, Unit.mL };
public List<Ingredient> IngredientList { get => ingredientList; set => ingredientList = value; }
public List<PreparationStep> PreparationStepList { get => preparationStepList; set => preparationStepList = value; }
public AddRecipe(List<PreparationStep> preparationStepList)
{
PreparationStepList = preparationStepList;
}
public AddRecipe(List<Ingredient> ingredientList)
{
IngredientList = ingredientList;
}
public bool IsCaptureSupported => throw new NotImplementedException(); public bool IsCaptureSupported => throw new NotImplementedException();
@ -17,9 +31,28 @@ namespace Views
InitializeComponent(); InitializeComponent();
BindingContext = this; BindingContext = this;
} }
private void PickPhoto (object sender, EventArgs e) private void PickPhoto(object sender, EventArgs e)
{ {
MediaPicker.PickPhotoAsync(); MediaPicker.PickPhotoAsync();
} }
private void AddRecipeValidation(object sender, EventArgs e)
{
if (IsCaptureSupported)
{
}
}
private void AddStepRecipe(object sender, EventArgs e)
{
}
private void RemoveStepRecipe(object sender, EventArgs e)
{
}
} }
} }

@ -11,6 +11,8 @@ namespace Views
private readonly RecipeCollection _recipesDisplayed; private readonly RecipeCollection _recipesDisplayed;
public ReadOnlyObservableRecipeCollection RecipesDisplayed { get; private set; } public ReadOnlyObservableRecipeCollection RecipesDisplayed { get; private set; }
public Recipe Recipe => Master.Recipe.CurrentSelected;
public Home() public Home()
{ {

@ -16,4 +16,6 @@ public partial class ViewRecette : ContentPage
InitializeComponent(); InitializeComponent();
BindingContext = this; BindingContext = this;
} }
} }

@ -5,8 +5,10 @@ namespace Views;
public partial class MiniHeader : ContentView public partial class MiniHeader : ContentView
{ {
MasterManager Master = (Application.Current as App).Master; MasterManager Master = (Application.Current as App).Master;
public Recipe Recipe => Master.Recipe.CurrentSelected;
public MiniHeader()
public MiniHeader()
{ {
InitializeComponent(); InitializeComponent();
BindingContext = Master.User.CurrentConnected; BindingContext = Master.User.CurrentConnected;

@ -11,7 +11,7 @@
<ImageButton <ImageButton
Grid.Row="0" VerticalOptions="Fill" Grid.Row="0" VerticalOptions="Fill"
Source="{Binding CaseImageSource, Source={x:Reference rCase}}" Source="{Binding CaseImageSource, Source={x:Reference rCase}}"
Clicked="ImageButton_Clicked"/> Clicked="ImageButton_Clicked"/>
<Label <Label
Grid.Row="1" HorizontalOptions="Center" VerticalOptions="Center" Grid.Row="1" HorizontalOptions="Center" VerticalOptions="Center"

@ -1,8 +1,13 @@
using Model;
namespace Views; namespace Views;
public partial class RecipeCase : ContentView public partial class RecipeCase : ContentView
{ {
public RecipeCase() public MasterManager Master => (Application.Current as App).Master;
public Recipe Recipe => Master.Recipe.CurrentSelected;
public RecipeCase()
{ {
InitializeComponent(); InitializeComponent();
} }
@ -24,9 +29,9 @@ public partial class RecipeCase : ContentView
get => (string)GetValue(RecipeTitleProperty); get => (string)GetValue(RecipeTitleProperty);
set => SetValue(RecipeTitleProperty, value); set => SetValue(RecipeTitleProperty, value);
} }
private async void ImageButton_Clicked(object sender, EventArgs e) private async void ImageButton_Clicked(object sender, EventArgs e)
{ {
Master.Recipe.CurrentSelected = (Recipe)(sender as ImageButton).BindingContext;
await Navigation.PushModalAsync(new ViewRecette()); await Navigation.PushModalAsync(new ViewRecette());
} }
} }

Loading…
Cancel
Save