fix merge conflict + build issues

pull/48/head
Alexandre AGOSTINHO 2 years ago
commit 41689ae1f5

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;CI</Configurations>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DataPersistence\DataPersistence.csproj" />
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>
</Project>

@ -5,7 +5,6 @@
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Configurations>Debug;Release;CI</Configurations>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

@ -41,6 +41,7 @@ namespace ConsoleApp.Menu
title: title, title: title,
id: null, id: null,
authorMail: MasterManager.CurrentConnectedUser?.Mail, authorMail: MasterManager.CurrentConnectedUser?.Mail,
picture: "",
ingredients: new List<Ingredient>(), ingredients: new List<Ingredient>(),
preparationSteps: steps.ToArray() preparationSteps: steps.ToArray()
); );

@ -23,6 +23,7 @@ else
masterMgr = new MasterManager(dataManager); masterMgr = new MasterManager(dataManager);
} }
MenuManager menuMgr = new MenuManager(masterMgr); MenuManager menuMgr = new MenuManager(masterMgr);
menuMgr.Loop(); menuMgr.Loop();

@ -22,8 +22,10 @@ namespace DataPersistence
new List<object>(new[] new List<object>(new[]
{ {
new Recipe( new Recipe(
title: "Cookies classiques", id: null, title: "Cookies classiques",
id: 50,
authorMail: "admin@mctg.fr", authorMail: "admin@mctg.fr",
picture : "room_service_icon.png",
ingredients: new List<Ingredient>(new[] ingredients: new List<Ingredient>(new[]
{ {
new Ingredient("Patates", new Quantity(23, Unit.unit)), new Ingredient("Patates", new Quantity(23, Unit.unit)),
@ -74,7 +76,8 @@ namespace DataPersistence
new PreparationStep(5, "Faire cuire 45h au four traditionnel.") new PreparationStep(5, "Faire cuire 45h au four traditionnel.")
}), }),
new Recipe( new Recipe(
title: "Dinde au jambon", id: null, title: "Dinde au jambon",
id: null,
authorMail: "pedrosamigos@hotmail.com", authorMail: "pedrosamigos@hotmail.com",
preparationSteps: new[] preparationSteps: new[]
{ {
@ -99,6 +102,7 @@ namespace DataPersistence
}) })
#endregion #endregion
}, },
{ {
#region Data: User #region Data: User
nameof(User), nameof(User),

@ -16,6 +16,9 @@ namespace Model
#region Attributes #region Attributes
[DataMember(Name = "title")] [DataMember(Name = "title")]
private string _title = ""; private string _title = "";
[DataMember(Name = "image")]
private string _image = "";
#endregion #endregion
#region Properties #region Properties
@ -54,11 +57,26 @@ namespace Model
} }
/// <summary> /// <summary>
/// The image of the recipe. <br/>
/// Set to "room_service_icon.png" when the value passed is null, empty or contain white space.
/// </summary>
public string? Image
{
get => _image;
set
{
if (!string.IsNullOrWhiteSpace(value))
_image = "room_service_icon.png";
_image = value;
}
}
/// The list of ingredients. /// The list of ingredients.
/// </summary> /// </summary>
[DataMember(Name = "ingredient")] [DataMember(Name = "ingredient")]
public List<Ingredient> Ingredients { get; set; } public List<Ingredient> Ingredients { get; set; }
/// <summary> /// <summary>
/// The steps of the preparation. See: <see cref="PreparationStep"/>. /// The steps of the preparation. See: <see cref="PreparationStep"/>.
/// </summary> /// </summary>
@ -72,14 +90,17 @@ namespace Model
/// </summary> /// </summary>
/// <param _name="title">The title of the recipe</param> /// <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="id">The id of the recipe. If not given, get a new id.</param>
/// <param _name="authorMail">The name of the user that create this recipe.</param>
/// <param _name="picture"> The image that represent the recipe</param>
/// <param _name="reviews">Thr list of reviews.</param> /// <param _name="reviews">Thr list of reviews.</param>
/// <param _name="ingredients">Thr list of ingredients.</param> /// <param _name="ingredients">Thr list of ingredients.</param>
/// <param _name="preparationSteps">The steps of the preparation of the meal</param> /// <param _name="preparationSteps">The steps of the preparation of the meal</param>
public Recipe(string title, int? id, string? authorMail, public Recipe(string title, int? id, string? authorMail, string? picture,
List<Review> reviews, List<Ingredient> ingredients, List<Review> reviews, List<Ingredient> ingredients,
params PreparationStep[] preparationSteps) params PreparationStep[] preparationSteps)
{ {
Title = title; Title = title;
Image = picture;
PreparationSteps = new List<PreparationStep>(preparationSteps); PreparationSteps = new List<PreparationStep>(preparationSteps);
Ingredients = ingredients; Ingredients = ingredients;
Reviews = reviews; Reviews = reviews;
@ -95,47 +116,18 @@ namespace Model
else Id = (int)id; else Id = (int)id;
} }
/// <summary>
/// <inheritdoc cref="Recipe.Recipe(string, int?, List{Review}, PreparationStep[])"/>
/// </summary>
/// <param _name="title">The title of the recipe.</param>
public Recipe(string title)
: this(title, null, null, new List<Review>(), new List<Ingredient>())
{
}
/// <summary>
/// <inheritdoc cref="Recipe.Recipe(string, int?, List{Review}, PreparationStep[])"/>
/// </summary>
/// <param _name="title">The title of the recipe.</param>
/// <param _name="preparationSteps">The steps of the preparation of the meal.</param>
public Recipe(string title, params PreparationStep[] preparationSteps)
: this(title, null, null, new List<Review>(), new List<Ingredient>(), preparationSteps)
{
}
/// <summary> /// <summary>
/// <inheritdoc cref="Recipe.Recipe(string, int?, List{Review}, PreparationStep[])"/> /// <inheritdoc cref="Recipe.Recipe(string, int?, List{Review}, PreparationStep[])"/>
/// </summary> /// </summary>
/// <param _name="title">The title of the recipe.</param> /// <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="id">The id of the recipe. If not given, get a new id.</param>
/// <param _name="authorMail">Mail of the user that create the recipe</param>
/// <param _name="preparationSteps">The steps of the preparation of the meal.</param> /// <param _name="preparationSteps">The steps of the preparation of the meal.</param>
public Recipe(string title, int? id, params PreparationStep[] preparationSteps) public Recipe(string title, int? id, string? authorMail, params PreparationStep[] preparationSteps)
: this(title, id, null, new List<Review>(), new List<Ingredient>(), preparationSteps) : this(title, id, authorMail, null, 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="ingredients">Thr list of ingredients.</param>
/// <param _name="preparationSteps">The steps of the preparation of the meal.</param>
public Recipe(string title, int? id, List<Ingredient> ingredients,
params PreparationStep[] preparationSteps)
: this(title, id, null, new List<Review>(), ingredients, preparationSteps)
{
} }
/// <summary> /// <summary>
@ -143,22 +135,27 @@ namespace Model
/// </summary> /// </summary>
/// <param _name="title">The title of the recipe.</param> /// <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="id">The id of the recipe. If not given, get a new id.</param>
/// <param _name="authorMail">Mail of the user that create the recipe</param>
/// <param _name="picture">Mail of the user that create the recipe</param>
/// <param _name="ingredients">List of ingredients that compose the recipe. </param>
/// <param _name="preparationSteps">The steps of the preparation of the meal.</param> /// <param _name="preparationSteps">The steps of the preparation of the meal.</param>
public Recipe(string title, int? id, string? authorMail, List<Ingredient> ingredients, params PreparationStep[] preparationSteps) public Recipe(string title, int? id, string? authorMail, string? picture, List<Ingredient> ingredients, params PreparationStep[] preparationSteps)
: this(title, id, authorMail, new List<Review>(), ingredients, preparationSteps) : this(title, id, authorMail, picture, new List<Review>(), ingredients, preparationSteps)
{ {
} }
/// <summary> ///// <summary>
/// <inheritdoc cref="Recipe.Recipe(string, int?, List{Review}, PreparationStep[])"/> ///// <inheritdoc cref="Recipe.Recipe(string, int?, List{Review}, PreparationStep[])"/>
/// </summary> ///// </summary>
/// <param _name="title">The title of the recipe.</param> ///// <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="id">The id of the recipe. If not given, get a new id.</param>
/// <param _name="preparationSteps">The steps of the preparation of the meal.</param> ///// <param _name="picture">Image that reppresent the recipe.</param>
public Recipe(string title, int? id, string? authorMail, params PreparationStep[] preparationSteps) ///// <param _name="preparationSteps">The steps of the preparation of the meal.</param>
: this(title, id, authorMail, new List<Review>(), new List<Ingredient>(), preparationSteps) //public Recipe(string title, int? id, string picture, params PreparationStep[] preparationSteps)
{ // : this(title, id, null, picture, new List<Review>(), new List<Ingredient>(), preparationSteps)
} //{
//}
#endregion #endregion
#region Methods #region Methods

@ -3,8 +3,9 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using DataPersistence;
using Model; using Model;
using Model.Managers;
namespace Model_UnitTests namespace Model_UnitTests
{ {
@ -13,18 +14,12 @@ namespace Model_UnitTests
[Fact] [Fact]
public void TestResearchByName() public void TestResearchByName()
{ {
RecipeCollection recipes = new RecipeCollection( MasterManager masterManager = new MasterManager(new Stubs());
description: "test recipe", RecipeCollection recipes = masterManager.DataMgr.GetRecipes("test rc");
recipes: new[]
{
new Recipe(title: "Gateau à la crème"),
new Recipe(title: "Gateau au chocolat"),
new Recipe(title: "Gateau aux cerises")
});
Recipe? search_result = recipes.ResearchByName("chocolat").FirstOrDefault(); Recipe? search_result = recipes.ResearchByName("chocolat").FirstOrDefault();
Assert.NotNull(search_result); Assert.NotNull(search_result);
Assert.Equal("Gateau au chocolat", search_result.Title); Assert.Equal("Cookies au chocolat", search_result.Title);
} }
} }
} }

@ -7,7 +7,10 @@ namespace Model_UnitTests
[Fact] [Fact]
public void TestVoidConstructor() public void TestVoidConstructor()
{ {
Recipe r = new Recipe(""); // id is given to avoid tests errors with the static atrribute 'idCreator'. Recipe r = new Recipe(
title: "test recipe",
id: null,
authorMail: "test@test.fr");
Assert.NotNull(r.Title); Assert.NotNull(r.Title);
} }
} }

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Views.AddRecipe"
Title="AddRecipe"
xmlns:local="clr-namespace:Views">
<VerticalStackLayout>
<local:MiniHeader
TitleMini="Ajouter une recette"
NeedReturn="True"
HeightRequest="100"/>
<Grid ColumnDefinitions="auto, *"
RowDefinitions="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"
Grid.Row="1"
Margin="10"/>
<Label Text="Type de la recette" Grid.Row="2"/>
<CheckBox x:Name="CheckEntree" Grid.Row="3" Margin="10,0,20,0" />
<Label Text="Entrée" Grid.Row="3" Margin="40,20"/>
<CheckBox x:Name="CheckPlat" Grid.Row="3" Margin="90,0" />
<Label Text="Plat" Grid.Row="3" Margin="120,20"/>
<CheckBox x:Name="CheckDessert" Grid.Row="3" Margin="155,0" />
<Label Text="Dessert" Grid.Row="3" Margin="185,20"/>
<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="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"/>
</HorizontalStackLayout>
<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>
</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"/>
</HorizontalStackLayout>
</Grid>
</VerticalStackLayout>
</ContentPage>

@ -0,0 +1,18 @@
using CommunityToolkit.Maui.Behaviors;
using DataPersistence;
using Model;
using Model.Managers;
using System.Diagnostics;
namespace Views
{
public partial class AddRecipe : ContentPage
{
public MasterManager MasterMgr => (App.Current as App).MasterMgr;
public AddRecipe()
{
InitializeComponent();
}
}
}

@ -1,7 +1,7 @@
<?xml version = "1.0" encoding = "UTF-8" ?> <?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Vue" xmlns:local="clr-namespace:Views"
x:Class="Views.App"> x:Class="Views.App">
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>

@ -6,38 +6,49 @@ using Windows.Graphics;
using DataPersistence; using DataPersistence;
using Model; using Model;
using System.Collections.ObjectModel;
using Model.Managers;
namespace Views namespace Views
{ {
public partial class App : Application public partial class App : Application
{ {
public DataManager DataMgr { get; private set; } = new DataManager(new Stubs()); //Point d'entrée de l'application
public User user { get; set; } public MasterManager MasterMgr { get; private set; } = new MasterManager(new Stubs());
const int WindowWidth = 1200;
const int WindowHeight = 800; //L'utilisateur courant de l'application
public User CurrentUser { get; set; }
//collection de recette de l'application
public RecipeCollection AllRecipes { get; set; }
//const int WindowWidth = 1200;
//const int WindowHeight = 800;
public App() public App()
{ {
user = DataMgr.Data[nameof(User)].Cast<User>().Last(); CurrentUser = MasterMgr.DataMgr.GetUsers().Last();
AllRecipes = MasterMgr.DataMgr.GetRecipes("All recipes");
InitializeComponent(); InitializeComponent();
Microsoft.Maui.Handlers.WindowHandler.Mapper.AppendToMapping(nameof(IWindow), (handler, view) => // Microsoft.Maui.Handlers.WindowHandler.Mapper.AppendToMapping(nameof(IWindow), (handler, view) =>
{ // {
#if WINDOWS //#if WINDOWS
var mauiWindow = handler.VirtualView; // var mauiWindow = handler.VirtualView;
var nativeWindow = handler.PlatformView; // var nativeWindow = handler.PlatformView;
nativeWindow.Activate(); // nativeWindow.Activate();
IntPtr windowHandle = WinRT.Interop.WindowNative.GetWindowHandle(nativeWindow); // IntPtr windowHandle = WinRT.Interop.WindowNative.GetWindowHandle(nativeWindow);
WindowId windowId = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(windowHandle); // WindowId windowId = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(windowHandle);
AppWindow appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(windowId); // AppWindow appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(windowId);
appWindow.Resize(new SizeInt32(WindowWidth, WindowHeight)); // appWindow.Resize(new SizeInt32(WindowWidth, WindowHeight));
#endif //#endif
}); // });
/* - Comment(ctrl-k + ctrl-c)/Uncomment(ctrl-k + ctrl-u) to change page - */ /* - Comment(ctrl-k + ctrl-c)/Uncomment(ctrl-k + ctrl-u) to change page - */
UserAppTheme = AppTheme.Light; UserAppTheme = AppTheme.Light;
MainPage = new AddRecipe(); MainPage = new Home();
//MainPage = new MyPosts(); //MainPage = new MyPosts();
} }
} }

@ -1,13 +1,13 @@
using DataPersistence; using DataPersistence;
using Model; using Model;
using Model.Managers;
namespace Views; namespace Views;
public partial class ContainerFlyout : ContentView public partial class ContainerFlyout : ContentView
{ {
public DataManager DataMgr => (App.Current as App).DataMgr; public MasterManager MasterMgr => (App.Current as App).MasterMgr;
public User user => (App.Current as App).user; public User user => (App.Current as App).CurrentUser;
public ContainerFlyout() public ContainerFlyout()
{ {

@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:local="clr-namespace:Views" xmlns:local="clr-namespace:Views"
xmlns:model="clr-namespace:Model;assembly=Model"
x:Class="Views.Home"> x:Class="Views.Home">
<local:ContainerBase <local:ContainerBase
@ -12,19 +13,29 @@
<local:ContainerBase.MyFlyoutContent> <local:ContainerBase.MyFlyoutContent>
<VerticalStackLayout Grid.Row="1"> <VerticalStackLayout Grid.Row="1">
<!-- Research --> <!-- Research -->
<Button Text="Recherche" ImageSource="search_icon.png" <Button
Text="Recherche"
ImageSource="search_icon.png"
MaximumHeightRequest="20" MaximumHeightRequest="20"
Style="{StaticResource button1}"/> Style="{StaticResource button1}"/>
<SearchBar Placeholder="Mots-clés (ex.: rapide, fromage)" FontAttributes="Italic" TextColor="Black" <SearchBar
Placeholder="Mots-clés (ex.: rapide, fromage)"
FontAttributes="Italic" TextColor="Black"
BackgroundColor="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray300}}" BackgroundColor="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray300}}"
Margin="15, 10, 15, 40"/> Margin="15, 10, 15, 40"/>
<!-- Direct research --> <!-- Direct research -->
<Button Text="Entrées" ImageSource="flatware_icon.png" <Button
Text="Entrées"
ImageSource="flatware_icon.png"
Style="{StaticResource button1}"/> Style="{StaticResource button1}"/>
<Button Text="Plats" ImageSource="room_service_icon.png" <Button
Text="Plats"
ImageSource="room_service_icon.png"
Style="{StaticResource button1}"/> Style="{StaticResource button1}"/>
<Button Text="Desserts" ImageSource="coffee_icon.png" <Button
Text="Desserts"
ImageSource="coffee_icon.png"
Style="{StaticResource button1}"/> Style="{StaticResource button1}"/>
</VerticalStackLayout> </VerticalStackLayout>
</local:ContainerBase.MyFlyoutContent> </local:ContainerBase.MyFlyoutContent>
@ -32,9 +43,13 @@
<!-- Master --> <!-- Master -->
<local:ContainerBase.MyContent> <local:ContainerBase.MyContent>
<ScrollView> <ScrollView>
<StackLayout> <StackLayout BindingContext="{Binding AllRecipes}" MinimumWidthRequest="400">
<Label Text="Suggestions" TextColor="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource Gray100}}" <!--Modification du prof apportée sur le stacklayout pour empecher l'affichage d'une seule case recipe-->
FontSize="24" Padding="15"/> <Label
Text="{Binding Description}"
TextColor="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource Gray100}}"
FontSize="24"
Padding="15"/>
<FlexLayout <FlexLayout
Margin="0, 15" Margin="0, 15"
@ -42,8 +57,35 @@
JustifyContent="Start" JustifyContent="Start"
AlignItems="Center" AlignItems="Center"
AlignContent="SpaceEvenly" AlignContent="SpaceEvenly"
HorizontalOptions="Center"> HorizontalOptions="Center"
BindableLayout.ItemsSource="{Binding}">
<BindableLayout.ItemTemplate>
<DataTemplate x:DataType="model:Recipe">
<Border Style="{StaticResource recipeCase}">
<Grid RowDefinitions="*, 40">
<!--<local:RecipeCase
CaseImageSource="room_service_icon.png"
Title="{Binding Title}"/>-->
<Image
Grid.Row="0" VerticalOptions="Fill"
Source="{Binding Image}"/>
<Label
Text="{Binding Title}" FontSize="18"
Grid.Row="1" HorizontalOptions="Center"/>
</Grid>
</Border>
</DataTemplate>
</BindableLayout.ItemTemplate>
<!--<local:RecipeCase CaseImageSource="room_service_icon.png"/>
<local:RecipeCase CaseImageSource="room_service_icon.png"/> <local:RecipeCase CaseImageSource="room_service_icon.png"/>
<local:RecipeCase CaseImageSource="room_service_icon.png"/> <local:RecipeCase CaseImageSource="room_service_icon.png"/>
<local:RecipeCase CaseImageSource="room_service_icon.png"/> <local:RecipeCase CaseImageSource="room_service_icon.png"/>
@ -53,8 +95,7 @@
<local:RecipeCase CaseImageSource="room_service_icon.png"/> <local:RecipeCase CaseImageSource="room_service_icon.png"/>
<local:RecipeCase CaseImageSource="room_service_icon.png"/> <local:RecipeCase CaseImageSource="room_service_icon.png"/>
<local:RecipeCase CaseImageSource="room_service_icon.png"/> <local:RecipeCase CaseImageSource="room_service_icon.png"/>
<local:RecipeCase CaseImageSource="room_service_icon.png"/> <local:RecipeCase CaseImageSource="room_service_icon.png"/>-->
<local:RecipeCase CaseImageSource="room_service_icon.png"/>
</FlexLayout> </FlexLayout>
</StackLayout> </StackLayout>

@ -1,10 +1,22 @@
namespace Views using DataPersistence;
using Model;
using Model.Managers;
namespace Views
{ {
public partial class Home : ContentPage public partial class Home : ContentPage
{ {
public MasterManager MasterMgr => (App.Current as App).MasterMgr;
public User user => (App.Current as App).CurrentUser;
public RecipeCollection AllRecipes => (App.Current as App).AllRecipes;
public Home() public Home()
{ {
//DataMgr = new DataManager(new Stubs());
//AllRecipes = new RecipeCollection("Toutes les recettes", DataMgr.Data[nameof(Recipe)].Cast<Recipe>().ToArray());
InitializeComponent(); InitializeComponent();
BindingContext = this;
} }
} }
} }

@ -38,26 +38,20 @@
FontSize="18"/> FontSize="18"/>
<Entry BackgroundColor="#D1E8E2" <Entry BackgroundColor="#D1E8E2"
Margin="50,10,0,20" Margin="50,10,0,20"
Text="{Binding userBis.Name}"/> Text="{Binding CurrentUser.Name}"/>
<Label Text="Prénom :" <Label Text="Prénom :"
Padding="50,0,0,0" Padding="50,0,0,0"
FontSize="18"/> FontSize="18"/>
<Entry BackgroundColor="#D1E8E2" <Entry BackgroundColor="#D1E8E2"
Margin="50,10,0,20" Margin="50,10,0,20"
Text="{Binding userBis.Surname} "/> Text="{Binding CurrentUser.Surname} "/>
<Label Text="Mail :" <Label Text="Mail :"
Padding="50,0,0,0" Padding="50,0,0,0"
FontSize="18"/> FontSize="18"/>
<Entry BackgroundColor="#D1E8E2" <Entry BackgroundColor="#D1E8E2"
Margin="50,10,0,20" Margin="50,10,0,20"
IsEnabled="False" IsEnabled="False"
Text="{Binding user.Mail}"/> Text="{Binding CurrentUser.Mail}"/>
<Button BackgroundColor="#bdf5bd"
Text="Modifier"
Margin="40,0,0,0"
TextColor="Black"
MaximumWidthRequest="100"
Clicked="Validation_Click"/>
<!--liste drag and drop--> <!--liste drag and drop-->
</VerticalStackLayout> </VerticalStackLayout>
<VerticalStackLayout Padding="100,0,0,0"> <VerticalStackLayout Padding="100,0,0,0">

@ -1,31 +1,20 @@
using CommunityToolkit.Maui.Behaviors; using CommunityToolkit.Maui.Behaviors;
using DataPersistence; using DataPersistence;
using Model; using Model;
using Model.Managers;
using System.Diagnostics; using System.Diagnostics;
namespace Views; namespace Views;
public partial class MyProfil : ContentPage public partial class MyProfil : ContentPage
{ {
public DataManager DataMgr => (App.Current as App).DataMgr; public MasterManager MasterMgr => (App.Current as App).MasterMgr;
public User user => (App.Current as App).user; public User user => (App.Current as App).CurrentUser;
public User userBis {get; set; }
public MyProfil() public MyProfil()
{ {
userBis = new User(user);
InitializeComponent(); InitializeComponent();
BindingContext = this; BindingContext = this;
} }
public void Validation_Click(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(userBis.Name) || String.IsNullOrEmpty(userBis.Surname)){
return;
}
user.Name = userBis.Name;
user.Surname = userBis.Surname;
}
} }
Loading…
Cancel
Save