Merge pull request 'Nav & Binding Recipe' (#53) from feature/43-MyProfil-User into dev
continuous-integration/drone/push Build is passing Details

Reviewed-on: #53
pull/58/head
Alexandre AGOSTINHO 2 years ago
commit 99c04979b9

@ -38,7 +38,8 @@ namespace DataPersistence
}),
new Recipe(
authorMail: "admin@mctg.fr",
title: "Cookies au chocolat", id: null,
title: "Cookies au chocolat",
id: null,
preparationSteps: new[]
{
new PreparationStep(1, "Moulinez la pâte."),

@ -67,7 +67,7 @@ namespace Model
public override string ToString()
{
return $"{Number}{UnitQ}";
return $"{Number} {UnitQ} de : ";
}
}
}

@ -40,6 +40,8 @@ namespace Model
[DataMember(Name = "authorMail")]
public string? AuthorMail { get; private set; }
public string Toto { get; set; } = "Coucou";
/// <summary>
/// The Title of the recipe. <br/>
/// Set to "No title." when the value passed is null, empty or contain white spaces.
@ -144,17 +146,17 @@ namespace Model
{
}
///// <summary>
///// <inheritdoc cref="Recipe.Recipe(string, int?, List{Review}, PreparationStep[])"/>
///// </summary>
///// <param _name="title">The title of the recipe.</param>
///// <param _name="id">The id of the recipe. If not given, get a new id.</param>
///// <param _name="picture">Image that reppresent the recipe.</param>
///// <param _name="preparationSteps">The steps of the preparation of the meal.</param>
//public Recipe(string title, int? id, string picture, params PreparationStep[] preparationSteps)
// : this(title, id, null, picture, new List<Review>(), new List<Ingredient>(), preparationSteps)
//{
//}
/// <summary>
/// <inheritdoc cref="Recipe.Recipe(string, int?, List{Review}, PreparationStep[])"/>
/// </summary>
/// <param _name="title">The title of the recipe.</param>
/// <param _name="id">The id of the recipe. If not given, get a new id.</param>
/// <param _name="picture">Image that reppresent the recipe.</param>
/// <param _name="preparationSteps">The steps of the preparation of the meal.</param>
public Recipe()
: this("", null, null, null, new List<Review>(), new List<Ingredient>(),new PreparationStep[0])
{
}
#endregion

@ -63,9 +63,7 @@
<Label Text="Saisir les ingrédients de la recette" 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"/>
<Picker Title="Unité">
</Picker>
<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"/>

@ -9,10 +9,11 @@ namespace Views
public partial class AddRecipe : ContentPage
{
public MasterManager MasterMgr => (App.Current as App).MasterMgr;
public List<Unit> UnitList { get; set; } = new List<Unit> { Unit.unit, Unit.kG, Unit.mG, Unit.G, Unit.L, Unit.cL, Unit.mL };
public AddRecipe()
{
InitializeComponent();
BindingContext = this;
}
}
}

@ -8,6 +8,10 @@ using DataPersistence;
using Model;
using System.Collections.ObjectModel;
using Model.Managers;
using Microsoft.Maui.Controls;
using System.Linq;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace Views
{
@ -15,9 +19,18 @@ namespace Views
{
//Point d'entrée de l'application
public MasterManager MasterMgr { get; private set; } = new MasterManager(new Stubs());
//L'utilisateur courant de l'application
public User CurrentUser { get; set; }
private Recipe currentRecipe { get; set; }
public Recipe CurrentRecipe
{
get => currentRecipe;
set
{
currentRecipe = value;
OnPropertyChanged(nameof(CurrentRecipe));
}
}
//collection de recette de l'application
public RecipeCollection AllRecipes { get; set; }
@ -29,7 +42,7 @@ namespace Views
{
CurrentUser = MasterMgr.DataMgr.GetUsers().Last();
AllRecipes = MasterMgr.DataMgr.GetRecipes("All recipes");
CurrentRecipe = MasterMgr.DataMgr.GetRecipes().First();
InitializeComponent();
// Microsoft.Maui.Handlers.WindowHandler.Mapper.AppendToMapping(nameof(IWindow), (handler, view) =>
@ -51,5 +64,6 @@ namespace Views
MainPage = new Home();
//MainPage = new MyPosts();
}
}
}

@ -68,9 +68,10 @@
CaseImageSource="room_service_icon.png"
Title="{Binding Title}"/>-->
<Image
<ImageButton
Grid.Row="0" VerticalOptions="Fill"
Source="{Binding Image}"/>
Source="{Binding Image}"
Clicked="OnImageClicked"/>
<Label
Text="{Binding Title}" FontSize="18"

@ -1,4 +1,5 @@
using DataPersistence;
//using Android.Media;
using DataPersistence;
using Model;
using Model.Managers;
@ -8,7 +9,7 @@ namespace Views
{
public MasterManager MasterMgr => (App.Current as App).MasterMgr;
public User user => (App.Current as App).CurrentUser;
public Recipe Recipe => (App.Current as App).CurrentRecipe;
public RecipeCollection AllRecipes => (App.Current as App).AllRecipes;
public Home()
{
@ -18,5 +19,12 @@ namespace Views
InitializeComponent();
BindingContext = this;
}
public void OnImageClicked(object sender, EventArgs e)
{
(App.Current as App).CurrentRecipe = (Recipe)(sender as ImageButton).BindingContext;
Navigation.PushModalAsync(new ViewRecette());
}
}
}

@ -10,7 +10,7 @@
WidthRequest="60"
/>
<Label Grid.Column="1"
Text="{Binding TitleMini, Source={Reference miniheader}}"
Text="{Binding TitleMini, Source={x:Reference miniheader}}"
FontSize="Medium"
FontAttributes="Bold"
LineBreakMode="WordWrap"

@ -1,27 +1,27 @@
namespace Views;
public partial class MiniHeader : ContentView
{
public MiniHeader()
{
InitializeComponent();
}
public readonly BindableProperty TitleMiniProperty =
BindableProperty.Create("TitleMini", typeof(string), typeof(MiniHeader), "Erreur de titre");
public string TitleMini
{
get => (string)GetValue(TitleMiniProperty);
set => SetValue(TitleMiniProperty, value);
}
// bind NeedReturn
public static readonly BindableProperty NeedReturnProperty =
BindableProperty.Create("NeedReturn", typeof(bool), typeof(Border), false);
public bool NeedReturn
{
get => (bool)GetValue(NeedReturnProperty);
set => SetValue(NeedReturnProperty, value);
}
namespace Views;
public partial class MiniHeader : ContentView
{
public MiniHeader()
{
InitializeComponent();
}
public static readonly BindableProperty TitleMiniProperty =
BindableProperty.Create(nameof(TitleMini), typeof(string), typeof(Label), "Erreur de titre");
public string TitleMini
{
get => (string)GetValue(TitleMiniProperty);
set => SetValue(TitleMiniProperty, value);
}
// bind NeedReturn
public static readonly BindableProperty NeedReturnProperty =
BindableProperty.Create("NeedReturn", typeof(bool), typeof(Border), false);
public bool NeedReturn
{
get => (bool)GetValue(NeedReturnProperty);
set => SetValue(NeedReturnProperty, value);
}
}

@ -5,19 +5,19 @@
xmlns:local="clr-namespace:Views"
Title="ViewRecette"
x:Name="nrecipe">
<VerticalStackLayout>
<VerticalStackLayout BindingContext="{Binding Recipe}">
<local:MiniHeader
TitleMini="Cookies aux Pépites de chocolat"
TitleMini="{Binding Title}"
NeedReturn="True"
HeightRequest="100"/>
<Image
Source="entete.jpg"
Source="{Binding Image}"
HeightRequest="150"
Aspect="AspectFill"/>
<Grid ColumnDefinitions="200,*">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
@ -25,49 +25,39 @@
Text="Ingrédients :"
FontSize="Subtitle"
FontAttributes="Bold"/>
<Label Margin="10,60,20,0"
Grid.RowSpan="4">
<Label.Text>
- 6 pommes
- 6 poires
- une banane
- 3 fraises
- 400g de farine
- 200g de beurre
- 150g de pépite de chocolat
</Label.Text>
</Label>
<Label Margin="10,20,0,0"
<ListView Margin="10,60,20,0"
Grid.RowSpan="4"
ItemsSource="{Binding Ingredients}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid ColumnDefinitions="auto,auto, auto"
RowDefinitions="auto">
<Label Text="{Binding QuantityI}" Grid.Column="0" Grid.Row="0"/>
<Label Text="{Binding Name}" Grid.Column=" 1" Grid.Row="0"/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Label Margin="10,0,20,20"
Grid.Column="1"
Grid.Row="0"
Text="Préparation :"
FontSize="Subtitle"
FontAttributes="Bold"/>
<Label Grid.Column="1"
Grid.Row="1"
Text="Etape 1"
FontAttributes="Italic"/>
<Label Grid.Column="1"
Grid.Row="1"
Margin="10,20,0,0"
Text=" ° Laissez ramollir le beurre à température ambiante. Dans un saladier, malaxez-le avec le sucre"/>
<Label Grid.Column="1"
Grid.Row="2"
FontAttributes="Italic"
Text="Etape 2"/>
<Label Grid.Column="1"
Grid.Row="2"
Margin="10,20,0,0"
Text=" ° Ajoutez l'oeuf et éventuellement le sucre vanillé. "/>
<Label Grid.Column="1"
Grid.Row="3"
FontAttributes="Italic"
Text="Etape 3"/>
<Label Grid.Column="1"
Grid.Row="3"
Margin="10,20,0,0"
Text=" ° Ajoutez l'oeuf et éventuellement le sucre vanillé. "/>
<ListView Margin="10,30,0,0"
Grid.Column="1"
ItemsSource="{Binding PreparationSteps}">
<ListView.ItemTemplate>
<DataTemplate>
<TextCell Text="{Binding Order, StringFormat='Etape {0}'}"
Detail="{Binding Description}"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
@ -81,30 +71,37 @@
Padding="20,10,80,20"
Margin="50,100,50,0"
MinimumHeightRequest="200">
<Grid ColumnDefinitions="600,*">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Label Grid.ColumnSpan="2"
Grid.Row="0"
Text=" Meilleure revue : "
FontAttributes="Bold"/>
<Label Background="#FFCB9A"
Grid.Column="0"
Grid.Row="1"
Grid.RowSpan="2"
Padding="10,10,10,10"
Text="Recette facile, non prise de tête et agréable à réaliser avec ses grands parents. Le resultat est délicieux, ma famille a adorée."
Margin="0,0,15,0"/>
<Button Grid.Column="1"
Grid.Row="2"
Background="#FFCB9A"
Text="Voir plus"
TextColor="Black"/>
</Grid>
<ListView ItemsSource="{Binding Reviews}">
<ListView.ItemTemplate>
<DataTemplate>
<Grid ColumnDefinitions="600,*" >
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Label Grid.ColumnSpan="2"
Grid.Row="0"
Text=" Meilleure revue : "
FontAttributes="Bold"/>
<Label
Background="#FFCB9A"
Grid.Column="0"
Grid.Row="1"
Grid.RowSpan="2"
Padding="10,10,10,10"
Text="{Binding Content}"
Margin="0,0,15,0"/>
<Button Grid.Column="1"
Grid.Row="2"
Background="#FFCB9A"
Text="Voir plus"
TextColor="Black"/>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Border>
</VerticalStackLayout>

@ -1,13 +1,21 @@
namespace Views;
/// <summary>
/// Classe de la page contenant le detail de la recette
///
/// </summary>
public partial class ViewRecette : ContentPage
{
public ViewRecette()
{
InitializeComponent();
}
using Model.Managers;
using Model;
namespace Views;
/// <summary>
/// Classe de la page contenant le detail de la recette
///
/// </summary>
public partial class ViewRecette : ContentPage
{
public MasterManager MasterMgr => (App.Current as App).MasterMgr;
public User user => (App.Current as App).CurrentUser;
public Recipe Recipe => (App.Current as App).CurrentRecipe;
public RecipeCollection AllRecipes => (App.Current as App).AllRecipes;
public ViewRecette()
{
InitializeComponent();
BindingContext = this;
}
}

@ -1,106 +1,106 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0-android</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('ios'))">$(TargetFrameworks);net7.0-ios</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('maccatalyst'))">$(TargetFrameworks);net7.0-maccatalyst</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType>
<RootNamespace>Views</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<!-- Display name -->
<ApplicationTitle>Views</ApplicationTitle>
<!-- App Identifier -->
<ApplicationId>com.companyname.views</ApplicationId>
<ApplicationIdGuid>79cbc22d-7cee-47b2-af9f-b25e09cea0af</ApplicationIdGuid>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
<Configurations>Debug;Release;CI</Configurations>
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Maui" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
</ItemGroup>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0-android</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('ios'))">$(TargetFrameworks);net7.0-ios</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('maccatalyst'))">$(TargetFrameworks);net7.0-maccatalyst</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType>
<RootNamespace>Views</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<!-- Display name -->
<ApplicationTitle>Views</ApplicationTitle>
<!-- App Identifier -->
<ApplicationId>com.companyname.views</ApplicationId>
<ApplicationIdGuid>79cbc22d-7cee-47b2-af9f-b25e09cea0af</ApplicationIdGuid>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
<Configurations>Debug;Release;CI</Configurations>
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Maui" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DataPersistence\DataPersistence.csproj" />
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
<MauiXaml Update="AddRecipe.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="ContainerBase.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="ContainerFlyout.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="CustomHeader.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Login.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="MiniHeader.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="MyPosts.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="MyProfil.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="RecipeCase.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="RecipeReviews.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="ReturnButton.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="UserReview.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="ViewRecette.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>
</Project>
</MauiXaml>
<MauiXaml Update="ContainerBase.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="ContainerFlyout.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="CustomHeader.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Login.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="MiniHeader.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="MyPosts.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="MyProfil.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="RecipeCase.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="RecipeReviews.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="ReturnButton.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="UserReview.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="ViewRecette.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>
</Project>

Loading…
Cancel
Save