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();
UserAppTheme = AppTheme.Light;
MainPage = new Home();
MainPage = new AddRecipe();
//MainPage = new MyPosts();
}

@ -9,8 +9,8 @@
TitleMini="Ajouter une recette"
NeedReturn="True"
HeightRequest="100"/>
<Grid ColumnDefinitions="auto, *"
RowDefinitions="auto,auto,auto,auto,auto,auto, auto, auto, auto"
<Grid ColumnDefinitions="auto, auto"
RowDefinitions="auto,auto,auto,auto,auto,auto, auto, auto, auto,auto"
Margin="50,20,20,20">
<Label Text="Titre de la recette :"/>
<Entry Placeholder="Saisie du texte de la recette correspondante"
@ -24,56 +24,47 @@
<CheckBox x:Name="CheckDessert" Grid.Row="3" Margin="155,0" />
<Label Text="Dessert" Grid.Row="3" Margin="185,20"/>
<Button Text="pick photo" Clicked="PickPhoto" Grid.Row="1" Grid.Column="1"/>
<Label Text="Type de priorité" Grid.Row="4"/>
<Grid BackgroundColor="#D1E8E2"
MinimumHeightRequest="100"
MaximumWidthRequest="300"
Padding="20"
Grid.Row="5">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label Text="Recettes économiques" Grid.Row="0" Padding="5,0,0,0"/>
<BoxView Color="Black" HeightRequest="1" Margin="10,10,10,10" Grid.Row="1" />
<Label Text="Recettes rapides" Grid.Row="2"/>
<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="Type de priorité :" Grid.Row="4" Margin="0,10,0,20"/>
<VerticalStackLayout Grid.Row="5">
<HorizontalStackLayout>
<Label Text="Recettes Economiques" VerticalOptions="Center"/>
<CheckBox x:Name="checkEconomique"/>
</HorizontalStackLayout>
<HorizontalStackLayout>
<Label Text="Recettes Rapides" VerticalOptions="Center"/>
<CheckBox x:Name="checkFast"/>
</HorizontalStackLayout>
<HorizontalStackLayout>
<Label Text="Recettes Faciles" VerticalOptions="Center"/>
<CheckBox x:Name="checkEasy"/>
</HorizontalStackLayout>
<HorizontalStackLayout>
<Label Text="Recettes Légères" VerticalOptions="Center"/>
<CheckBox x:Name="checkLight"/>
</HorizontalStackLayout>
<HorizontalStackLayout>
<Label Text="Recettes Gourmandes" VerticalOptions="Center"/>
<CheckBox x:Name="checkGourmet"/>
</HorizontalStackLayout>
</VerticalStackLayout>
<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"/>
<HorizontalStackLayout Grid.Row="8" Margin="20">
<Button WidthRequest="100" Text="Précédent" TextColor="Black" Margin="20,0,20,0"/>
<Button WidthRequest="100" Text="Ajouter" TextColor="Black" Margin="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" Clicked="RemoveStepRecipe"/>
</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">
<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}"/>
</HorizontalStackLayout>
<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="Ajouter" TextColor="Black" Margin="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" Clicked="RemoveIngredient"/>
</HorizontalStackLayout>
<Button Grid.Row="10" Grid.ColumnSpan="2" Text="Validé" TextColor="Black" Clicked="AddRecipeValidation"/>
</Grid>
</VerticalStackLayout>
</ContentPage>

@ -6,9 +6,23 @@ namespace Views
{
public partial class AddRecipe : ContentPage
{
private List<Ingredient> ingredientList;
private List<PreparationStep> preparationStepList;
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<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();
@ -17,9 +31,28 @@ namespace Views
InitializeComponent();
BindingContext = this;
}
private void PickPhoto (object sender, EventArgs e)
private void PickPhoto(object sender, EventArgs e)
{
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;
public ReadOnlyObservableRecipeCollection RecipesDisplayed { get; private set; }
public Recipe Recipe => Master.Recipe.CurrentSelected;
public Home()
{

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

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

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

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

Loading…
Cancel
Save