first test link Home page recipe collection

pull/65/head
Alexandre AGOSTINHO 2 years ago
parent 7a15ac8b49
commit 07c235e56c

@ -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>

@ -14,7 +14,7 @@ namespace Views
public App() public App()
{ {
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
@ -27,11 +27,11 @@ namespace Views
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 RecipeReviews(); MainPage = new Home();
//MainPage = new MyPosts(); //MainPage = new MyPosts();
} }
} }

@ -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
BackgroundColor="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray300}}" Placeholder="Mots-clés (ex.: rapide, fromage)"
Margin="15, 10, 15, 40"/> FontAttributes="Italic" TextColor="Black"
BackgroundColor="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray300}}"
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,12 @@
<!-- Master --> <!-- Master -->
<local:ContainerBase.MyContent> <local:ContainerBase.MyContent>
<ScrollView> <ScrollView>
<StackLayout> <StackLayout BindingContext="{Binding AllRecipes}">
<Label Text="Suggestions" TextColor="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource Gray100}}" <Label
FontSize="24" Padding="15"/> 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 +56,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="room_service_icon.png"/>
<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 +94,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,20 @@
namespace Views using DataPersistence;
using Model;
namespace Views
{ {
public partial class Home : ContentPage public partial class Home : ContentPage
{ {
public DataManager DataMgr { get; private set; }
public RecipeCollection AllRecipes { get; private set; }
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;
} }
} }
} }

@ -12,7 +12,7 @@
Grid.Row="0" VerticalOptions="Fill" Grid.Row="0" VerticalOptions="Fill"
Source="{Binding CaseImageSource, Source={x:Reference rCase}}"/> Source="{Binding CaseImageSource, Source={x:Reference rCase}}"/>
<Label Text="Recette 1" FontSize="18" <Label Text="{Binding Title, Source={x:Reference rCase}}" FontSize="18"
Grid.Row="1" HorizontalOptions="Center"/> Grid.Row="1" HorizontalOptions="Center"/>
</Grid> </Grid>
</Border> </Border>

@ -15,4 +15,13 @@ public partial class RecipeCase : ContentView
get => (ImageSource)GetValue(CaseImageSourceProperty); get => (ImageSource)GetValue(CaseImageSourceProperty);
set => SetValue(CaseImageSourceProperty, value); set => SetValue(CaseImageSourceProperty, value);
} }
public static readonly BindableProperty TitleProperty =
BindableProperty.Create("Title", typeof(string), typeof(Label));
public string Title
{
get => (string)GetValue(TitleProperty);
set => SetValue(TitleProperty, value);
}
} }

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

Loading…
Cancel
Save