modification de la recette(ajout image), copie du home xaml et cs, binding profil
continuous-integration/drone/push Build is passing Details

pull/48/head
Roxane ROSSETTO 2 years ago
parent 96954e6c94
commit 924d66dbe2

@ -25,7 +25,7 @@ dataMgr.Serializer = new DataContractXML();
//dataMgr.Import<Recipe>("C:\\Users\\alex6\\Downloads\\recipe2.json"); //dataMgr.Import<Recipe>("C:\\Users\\alex6\\Downloads\\recipe2.json");
PasswordManager passwordManager = new PasswordManager(); PasswordManager passwordManager = new PasswordManager();
RecipeCollection rc = new RecipeCollection("All recipes", dataMgr.Data[nameof(Recipe)].Cast<Recipe>().ToArray()); //RecipeCollection rc = new RecipeCollection("All recipes", dataMgr.Data[nameof(Recipe)].Cast<Recipe>().ToArray());
User user = dataMgr.Data[nameof(User)].Cast<User>().Last(); User user = dataMgr.Data[nameof(User)].Cast<User>().Last();

@ -23,14 +23,18 @@ namespace DataPersistence
new List<object>(new[] new List<object>(new[]
{ {
new Recipe( new Recipe(
title: "Cookies classiques", id: null, title: "Cookies classiques",
picture : "room_service_icon.png",
id: null,
preparationSteps: new[] preparationSteps: new[]
{ {
new PreparationStep(1, "Faire cuire."), new PreparationStep(1, "Faire cuire."),
new PreparationStep(2, "Manger.") new PreparationStep(2, "Manger.")
}), }),
new Recipe( new Recipe(
title: "Cookies au chocolat", id: null, title: "Cookies au chocolat",
picture : "",
id: null,
preparationSteps: new[] preparationSteps: new[]
{ {
new PreparationStep(1, "Moulinez la pâte."), new PreparationStep(1, "Moulinez la pâte."),
@ -38,34 +42,39 @@ namespace DataPersistence
new PreparationStep(3, "Sortir du four et mettre dans un plat.") new PreparationStep(3, "Sortir du four et mettre dans un plat.")
}), }),
new Recipe( new Recipe(
title: "Gateau nature", id: null, title: "Gateau nature",
picture : "dotnet_bot.svg",
id: null,
preparationSteps: new[] preparationSteps: new[]
{ {
new PreparationStep(1, "Achetez les ingrédients."), new PreparationStep(1, "Achetez les ingrédients."),
new PreparationStep(2, "Préparez le matériel. Ustensiles et tout."), new PreparationStep(2, "Préparez le matériel. Ustensiles et tout."),
new PreparationStep(3, "Pleurez.") new PreparationStep(3, "Pleurez.")
}), }),
new Recipe( new Recipe(
title: "Gateau au pommes", id: null, title: "Gateau nature",
picture : "dotnet_bot.svg",
id: null,
preparationSteps: new[] preparationSteps: new[]
{ {
new PreparationStep(1, "Achetez les légumes."), new PreparationStep(1, "Achetez les ingrédients."),
new PreparationStep(2, "Préparez le plat. Ustensiles et préchauffez le four."), new PreparationStep(2, "Préparez le matériel. Ustensiles et tout."),
new PreparationStep(3, "Coupez les pommes en morceaux et disposez-les sur le plat."), new PreparationStep(3, "Pleurez.")
new PreparationStep(4, "Mettez enfin le plat au four, puis une fois cuit, dégustez !")
}), }),
new Recipe( new Recipe(
title: "Gateau au chocolat", id: null, title: "Gateau nature",
picture : "dotnet_bot.svg",
id: null,
preparationSteps: new[] preparationSteps: new[]
{ {
new PreparationStep(1, "Ajouter les oeufs."), new PreparationStep(1, "Achetez les ingrédients."),
new PreparationStep(2, "Ajouter la farine."), new PreparationStep(2, "Préparez le matériel. Ustensiles et tout."),
new PreparationStep(3, "Ajouter 100g de chocolat fondu."), new PreparationStep(3, "Pleurez.")
new PreparationStep(4, "Mélanger le tout."),
new PreparationStep(5, "Faire cuire 45h au four traditionnel.")
}), }),
new Recipe( new Recipe(
title: "Dinde au jambon", id: null, title: "Dinde au jambon",
picture : "",
id: null,
preparationSteps: new[] preparationSteps: new[]
{ {
new PreparationStep(1, "Faire une cuisson bien sec de la dinde à la poêle"), new PreparationStep(1, "Faire une cuisson bien sec de la dinde à la poêle"),
@ -75,16 +84,15 @@ namespace DataPersistence
new PreparationStep(5, "Présentez sur un plat la dinde et le jambon : Miam !") new PreparationStep(5, "Présentez sur un plat la dinde et le jambon : Miam !")
}), }),
new Recipe( new Recipe(
title: "Poulet au curry", id: null, title: "Gateau nature",
picture : "dotnet_bot.svg",
id: null,
preparationSteps: new[] preparationSteps: new[]
{ {
new PreparationStep(1, "Trouvez des épices de curry."), new PreparationStep(1, "Achetez les ingrédients."),
new PreparationStep(2, "Trouvez maintenant du poulet."), new PreparationStep(2, "Préparez le matériel. Ustensiles et tout."),
new PreparationStep(3, "Coupez la tête du poulet et posez-la dans un plat."), new PreparationStep(3, "Pleurez.")
new PreparationStep(4, "Parsemez d'épices curry la tête de la poule."), }),
new PreparationStep(5, "Mettre le tout au four traditionnel 30min."),
new PreparationStep(6, "Dégustez en famille !")
})
}) })
#endregion #endregion
}, },

@ -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
@ -47,6 +50,21 @@ namespace Model
} }
} }
/// <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;
}
}
/// <summary> /// <summary>
/// The steps of the preparation. See: <see cref="PreparationStep"/>. /// The steps of the preparation. See: <see cref="PreparationStep"/>.
/// </summary> /// </summary>
@ -61,11 +79,12 @@ namespace Model
/// <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="preparationSteps">The steps of the preparation of the meal</param>
public Recipe(string title, int? id, public Recipe(string title, string picture, int? id,
List<Review> reviews, List<Review> reviews,
params PreparationStep[] preparationSteps) params PreparationStep[] preparationSteps)
{ {
Title = title; Title = title;
Image = picture;
PreparationSteps = new List<PreparationStep>(preparationSteps); PreparationSteps = new List<PreparationStep>(preparationSteps);
Reviews = reviews; Reviews = reviews;
@ -83,8 +102,8 @@ namespace Model
/// <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>
public Recipe(string title) public Recipe(string title, string picture)
: this(title, null, new List<Review>()) : this(title, picture, null, new List<Review>())
{ {
} }
@ -94,7 +113,7 @@ namespace Model
/// <param name="title">The title of the recipe.</param> /// <param name="title">The title of 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, params PreparationStep[] preparationSteps) public Recipe(string title, params PreparationStep[] preparationSteps)
: this(title, null, new List<Review>(), preparationSteps) : this(title, picture : null, null, new List<Review>(), preparationSteps)
{ {
} }
@ -104,8 +123,8 @@ namespace Model
/// <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="preparationSteps">The steps of the preparation of the meal.</param>
public Recipe(string title, int? id, params PreparationStep[] preparationSteps) public Recipe(string title, string picture, int? id, params PreparationStep[] preparationSteps)
: this(title, id, new List<Review>(), preparationSteps) : this(title, picture, id, new List<Review>(), preparationSteps)
{ {
} }
#endregion #endregion

@ -4,10 +4,10 @@
x:Class="Views.AddRecipe" x:Class="Views.AddRecipe"
Title="AddRecipe" Title="AddRecipe"
xmlns:local="clr-namespace:Views"> xmlns:local="clr-namespace:Views">
<VerticalStackLayout> <VerticalStackLayout>
<local:MiniHeader <local:MiniHeader
TitleMini="Ajouter une recette" TitleMini="Ajouter une recette"
NeedReturn="True" NeedReturn="True"
HeightRequest="100"/> HeightRequest="100"/>
<Grid ColumnDefinitions="auto, *" <Grid ColumnDefinitions="auto, *"
RowDefinitions="auto,auto,auto,auto,auto,auto, auto, auto, auto" RowDefinitions="auto,auto,auto,auto,auto,auto, auto, auto, auto"
@ -25,34 +25,34 @@
<Label Text="Dessert" Grid.Row="3" Margin="185,20"/> <Label Text="Dessert" Grid.Row="3" Margin="185,20"/>
<Label Text="Type de priorité" Grid.Row="4"/> <Label Text="Type de priorité" Grid.Row="4"/>
<Grid BackgroundColor="#D1E8E2" <Grid BackgroundColor="#D1E8E2"
MinimumHeightRequest="100" MinimumHeightRequest="100"
MaximumWidthRequest="300" MaximumWidthRequest="300"
Padding="20" Padding="20"
Grid.Row="5"> Grid.Row="5">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Text="Recettes économiques" Grid.Row="0" Padding="5,0,0,0"/> <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" /> <BoxView Color="Black" HeightRequest="1" Margin="10,10,10,10" Grid.Row="1" />
<Label Text="Recettes rapides" Grid.Row="2"/> <Label Text="Recettes rapides" Grid.Row="2"/>
<BoxView Color="Black" HeightRequest="1" Margin="10,10,10,10" Grid.Row="3" /> <BoxView Color="Black" HeightRequest="1" Margin="10,10,10,10" Grid.Row="3" />
<Label Text="Recettes simples" Grid.Row="4"/> <Label Text="Recettes simples" Grid.Row="4"/>
<BoxView Color="Black" HeightRequest="1" Margin="10,10,10,10" Grid.Row="5" /> <BoxView Color="Black" HeightRequest="1" Margin="10,10,10,10" Grid.Row="5" />
<Label Text="Recettes légères" Grid.Row="6"/> <Label Text="Recettes légères" Grid.Row="6"/>
<BoxView Color="Black" HeightRequest="1" Margin="10,10,10,10" Grid.Row="7" /> <BoxView Color="Black" HeightRequest="1" Margin="10,10,10,10" Grid.Row="7" />
<Label Text="Recettes gourmandes" Grid.Row="8"/> <Label Text="Recettes gourmandes" Grid.Row="8"/>
</Grid> </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"/>
@ -62,15 +62,15 @@
</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" 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,50,0" WidthRequest="500"/>
<Picker Title="Unité" > <Picker Title="Unité">
</Picker> </Picker>
</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"/>
<Button WidthRequest="100" Text="Ajouter" TextColor="Black" Margin="20,0"/> <Button WidthRequest="100" Text="Ajouter" TextColor="Black" Margin="20,0"/>
</HorizontalStackLayout> </HorizontalStackLayout>

@ -8,7 +8,6 @@ namespace Views
public partial class AddRecipe : ContentPage public partial class AddRecipe : ContentPage
{ {
public DataManager DataMgr => (App.Current as App).DataMgr; public DataManager DataMgr => (App.Current as App).DataMgr;
public Ingredient ingredient;
public AddRecipe() public AddRecipe()
{ {

@ -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;
namespace Views namespace Views
{ {
public partial class App : Application public partial class App : Application
{ {
//Point d'entrée de l'application
public DataManager DataMgr { get; private set; } = new DataManager(new Stubs()); public DataManager DataMgr { get; private set; } = new DataManager(new Stubs());
public User user { get; set; }
//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 WindowWidth = 1200;
const int WindowHeight = 800; const int WindowHeight = 800;
public App() public App()
{ {
user = DataMgr.Data[nameof(User)].Cast<User>().Last(); CurrentUser = DataMgr.Data[nameof(User)].Cast<User>().Last();
AllRecipes = DataMgr.Data[nameof(RecipeCollection)]
.Cast<RecipeCollection>()
.ToArray();
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 MyProfil();
//MainPage = new MyPosts(); //MainPage = new MyPosts();
} }
} }

@ -1,66 +1,107 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <ContentPage 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: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"
x:Class="Views.Home"> xmlns:model="clr-namespace:Model;assembly=Model"
x:Class="Views.Home">
<local:ContainerBase
IsNotConnected="True"> <local:ContainerBase
IsNotConnected="True">
<!-- Flyout -->
<local:ContainerBase.MyFlyoutContent> <!-- Flyout -->
<VerticalStackLayout Grid.Row="1"> <local:ContainerBase.MyFlyoutContent>
<!-- Research --> <VerticalStackLayout Grid.Row="1">
<Button Text="Recherche" ImageSource="search_icon.png" <!-- Research -->
MaximumHeightRequest="20" <Button
Style="{StaticResource button1}"/> Text="Recherche"
<SearchBar Placeholder="Mots-clés (ex.: rapide, fromage)" FontAttributes="Italic" TextColor="Black" ImageSource="search_icon.png"
BackgroundColor="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray300}}" MaximumHeightRequest="20"
Margin="15, 10, 15, 40"/> Style="{StaticResource button1}"/>
<SearchBar
<!-- Direct research --> Placeholder="Mots-clés (ex.: rapide, fromage)"
<Button Text="Entrées" ImageSource="flatware_icon.png" FontAttributes="Italic" TextColor="Black"
Style="{StaticResource button1}"/> BackgroundColor="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray300}}"
<Button Text="Plats" ImageSource="room_service_icon.png" Margin="15, 10, 15, 40"/>
Style="{StaticResource button1}"/>
<Button Text="Desserts" ImageSource="coffee_icon.png" <!-- Direct research -->
Style="{StaticResource button1}"/> <Button
</VerticalStackLayout> Text="Entrées"
</local:ContainerBase.MyFlyoutContent> ImageSource="flatware_icon.png"
Style="{StaticResource button1}"/>
<!-- Master --> <Button
<local:ContainerBase.MyContent> Text="Plats"
<ScrollView> ImageSource="room_service_icon.png"
<StackLayout> Style="{StaticResource button1}"/>
<Label Text="Suggestions" TextColor="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource Gray100}}" <Button
FontSize="24" Padding="15"/> Text="Desserts"
ImageSource="coffee_icon.png"
<FlexLayout Style="{StaticResource button1}"/>
Margin="0, 15" </VerticalStackLayout>
Wrap="Wrap" </local:ContainerBase.MyFlyoutContent>
JustifyContent="Start"
AlignItems="Center" <!-- Master -->
AlignContent="SpaceEvenly" <local:ContainerBase.MyContent>
HorizontalOptions="Center"> <ScrollView>
<StackLayout BindingContext="{Binding AllRecipes}" MinimumWidthRequest="400">
<local:RecipeCase CaseImageSource="room_service_icon.png"/> <!--Modification du prof apportée sur le stacklayout pour empecher l'affichage d'une seule case recipe-->
<local:RecipeCase CaseImageSource="room_service_icon.png"/> <Label
<local:RecipeCase CaseImageSource="room_service_icon.png"/> Text="{Binding Description}"
<local:RecipeCase CaseImageSource="room_service_icon.png"/> TextColor="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource Gray100}}"
<local:RecipeCase CaseImageSource="room_service_icon.png"/> FontSize="24"
<local:RecipeCase CaseImageSource="room_service_icon.png"/> Padding="15"/>
<local:RecipeCase CaseImageSource="room_service_icon.png"/>
<local:RecipeCase CaseImageSource="room_service_icon.png"/> <FlexLayout
<local:RecipeCase CaseImageSource="room_service_icon.png"/> Margin="0, 15"
<local:RecipeCase CaseImageSource="room_service_icon.png"/> Wrap="Wrap"
<local:RecipeCase CaseImageSource="room_service_icon.png"/> JustifyContent="Start"
AlignItems="Center"
</FlexLayout> AlignContent="SpaceEvenly"
</StackLayout> HorizontalOptions="Center"
</ScrollView> BindableLayout.ItemsSource="{Binding}">
</local:ContainerBase.MyContent>
<BindableLayout.ItemTemplate>
</local:ContainerBase> <DataTemplate x:DataType="model:Recipe">
<Border Style="{StaticResource recipeCase}">
</ContentPage> <Grid RowDefinitions="*, 40" BindingContext="{Binding AllRecipes}">
<!--<local:RecipeCase
CaseImageSource="room_service_icon.png"
Title="{Binding Title}"/>-->
<Image
Grid.Row="0" VerticalOptions="Fill"
Source="{Binding AllRecipe.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"/>
<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>
</StackLayout>
</ScrollView>
</local:ContainerBase.MyContent>
</local:ContainerBase>
</ContentPage>

@ -1,10 +1,21 @@
namespace Views using DataPersistence;
using Model;
namespace Views
{ {
public partial class Home : ContentPage public partial class Home : ContentPage
{ {
public DataManager DataMgr => (App.Current as App).DataMgr;
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">

@ -8,24 +8,12 @@ namespace Views;
public partial class MyProfil : ContentPage public partial class MyProfil : ContentPage
{ {
public DataManager DataMgr => (App.Current as App).DataMgr; public DataManager DataMgr => (App.Current as App).DataMgr;
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