Update (Back-End): début patron mvvm
continuous-integration/drone/push Build is failing Details

Back-End
lodufour1 2 years ago
parent 5d068b590e
commit bf92f31134

@ -0,0 +1,80 @@
<mxfile host="app.diagrams.net" modified="2023-09-20T13:12:02.373Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0" etag="3fIbn-yQ0z-1iRBMl3H2" version="21.7.5" type="device">
<diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">
<mxGraphModel dx="2337" dy="1515" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="zkfFHV4jXpPFQw0GAbJ--0" value="Author" style="swimlane;fontStyle=2;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeLast=0;collapsible=1;marginBottom=0;rounded=0;shadow=0;strokeWidth=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="-880" y="-100" width="270" height="290" as="geometry">
<mxRectangle x="230" y="140" width="160" height="26" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="zkfFHV4jXpPFQw0GAbJ--1" value="Id: string" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="zkfFHV4jXpPFQw0GAbJ--0" vertex="1">
<mxGeometry y="26" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="zkfFHV4jXpPFQw0GAbJ--2" value="Name: string" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=0;shadow=0;html=0;" parent="zkfFHV4jXpPFQw0GAbJ--0" vertex="1">
<mxGeometry y="52" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-1" value="ImageSmall: string" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="zkfFHV4jXpPFQw0GAbJ--0">
<mxGeometry y="78" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="zkfFHV4jXpPFQw0GAbJ--3" value="ImageMedium: string" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=0;shadow=0;html=0;" parent="zkfFHV4jXpPFQw0GAbJ--0" vertex="1">
<mxGeometry y="104" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-2" value="ImageLarge: string" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="zkfFHV4jXpPFQw0GAbJ--0">
<mxGeometry y="130" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-4" value="Bio: string" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="zkfFHV4jXpPFQw0GAbJ--0">
<mxGeometry y="156" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-5" value="AlternateNames: List&amp;lt;string&amp;gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="zkfFHV4jXpPFQw0GAbJ--0">
<mxGeometry y="182" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-6" value="Links: List&amp;lt;Link&amp;gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="zkfFHV4jXpPFQw0GAbJ--0">
<mxGeometry y="208" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-7" value="BirthDate: DateTime?" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="zkfFHV4jXpPFQw0GAbJ--0">
<mxGeometry y="234" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-8" value="DeathDate: DateTime?" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="zkfFHV4jXpPFQw0GAbJ--0">
<mxGeometry y="260" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-9" value="Book" style="swimlane;fontStyle=2;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeLast=0;collapsible=1;marginBottom=0;rounded=0;shadow=0;strokeWidth=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="-500" y="-90" width="270" height="290" as="geometry">
<mxRectangle x="230" y="140" width="160" height="26" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-10" value="Id: string" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" vertex="1" parent="ZLGVB8EPfMX_kU-r60Th-9">
<mxGeometry y="26" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-11" value="Title: string" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=0;shadow=0;html=0;" vertex="1" parent="ZLGVB8EPfMX_kU-r60Th-9">
<mxGeometry y="52" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-12" value="Publishers: List&amp;lt;string&amp;gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="ZLGVB8EPfMX_kU-r60Th-9">
<mxGeometry y="78" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-13" value="PublishDate: DateTime" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=0;shadow=0;html=0;" vertex="1" parent="ZLGVB8EPfMX_kU-r60Th-9">
<mxGeometry y="104" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-14" value="ISBN13: string" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="ZLGVB8EPfMX_kU-r60Th-9">
<mxGeometry y="130" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-15" value="Series: List&amp;lt;string&amp;gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="ZLGVB8EPfMX_kU-r60Th-9">
<mxGeometry y="156" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-16" value="NbPages: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="ZLGVB8EPfMX_kU-r60Th-9">
<mxGeometry y="182" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-17" value="Links: List&amp;lt;Link&amp;gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="ZLGVB8EPfMX_kU-r60Th-9">
<mxGeometry y="208" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-18" value="BirthDate: DateTime?" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="ZLGVB8EPfMX_kU-r60Th-9">
<mxGeometry y="234" width="270" height="26" as="geometry" />
</mxCell>
<mxCell id="ZLGVB8EPfMX_kU-r60Th-19" value="DeathDate: DateTime?" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="ZLGVB8EPfMX_kU-r60Th-9">
<mxGeometry y="260" width="270" height="26" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

@ -19,6 +19,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils", "Utils\Utils.csproj
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stub", "Stub\Stub.csproj", "{14ED7ADF-7B83-432E-A87B-40C153041067}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFrontEnd", "Tests\TestFrontEnd.csproj", "{945A6DB3-CB0A-4FB8-8117-64F0CB0D838A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VMWrapper", "VMWrapper\VMWrapper.csproj", "{377DC5AB-5D7C-4A29-ACED-C08B581A8E58}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -59,6 +63,14 @@ Global
{14ED7ADF-7B83-432E-A87B-40C153041067}.Debug|Any CPU.Build.0 = Debug|Any CPU
{14ED7ADF-7B83-432E-A87B-40C153041067}.Release|Any CPU.ActiveCfg = Release|Any CPU
{14ED7ADF-7B83-432E-A87B-40C153041067}.Release|Any CPU.Build.0 = Release|Any CPU
{945A6DB3-CB0A-4FB8-8117-64F0CB0D838A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{945A6DB3-CB0A-4FB8-8117-64F0CB0D838A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{945A6DB3-CB0A-4FB8-8117-64F0CB0D838A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{945A6DB3-CB0A-4FB8-8117-64F0CB0D838A}.Release|Any CPU.Build.0 = Release|Any CPU
{377DC5AB-5D7C-4A29-ACED-C08B581A8E58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{377DC5AB-5D7C-4A29-ACED-C08B581A8E58}.Debug|Any CPU.Build.0 = Debug|Any CPU
{377DC5AB-5D7C-4A29-ACED-C08B581A8E58}.Release|Any CPU.ActiveCfg = Release|Any CPU
{377DC5AB-5D7C-4A29-ACED-C08B581A8E58}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -70,6 +70,13 @@
<PackageReference Include="CommunityToolkit.Maui" Version="5.3.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="SimpleRatingControl.MAUI" Version="0.1.0" />
<PackageReference Include="System.Linq" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" />
<ProjectReference Include="..\Stub\Stub.csproj" />
<ProjectReference Include="..\VMWrapper\VMWrapper.csproj" />
</ItemGroup>
<ItemGroup>

@ -2,10 +2,13 @@
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:vm="clr-namespace:BookApp.ViewModel"
xmlns:model="clr-namespace:Model;assembly=Model"
x:DataType="vm:TousViewModel"
x:Class="BookApp.Composants.CollectionFiltrage">
<CollectionView ItemsSource="{Binding MyCollections1}">
<CollectionView ItemsSource="{Binding Authors}">
<CollectionView.ItemTemplate>
<DataTemplate>
<DataTemplate x:DataType="model:Author">
<StackLayout Padding="5">
<Grid RowDefinitions="auto" Margin="5,0,0,0">
<Grid.ColumnDefinitions>
@ -19,8 +22,8 @@
<toolkit:IconTintColorBehavior TintColor="Red" />
</Image.Behaviors>
</Image>
<Label Grid.Column="1" Margin="10,0,0,0" VerticalTextAlignment="Center" Text="{Binding AuteurName}"/>
<Label Grid.Column="2" VerticalTextAlignment="Center" Margin="0,0,40,0" HorizontalTextAlignment="End" Text="{Binding NbLivre}"/>
<Label Grid.Column="1" Margin="10,0,0,0" VerticalTextAlignment="Center" Text="{Binding Name}"/>
<!-- <Label Grid.Column="2" VerticalTextAlignment="Center" Margin="0,0,40,0" HorizontalTextAlignment="End" Text="{Binding NbLivre}"/> -->
<Button Grid.Column="2"
ImageSource="chevron_right.svg"
HeightRequest="35"

@ -1,10 +1,11 @@
using BookApp.ViewModel;
using System.Collections.ObjectModel;
namespace BookApp.Composants;
public partial class CollectionFiltrage : ContentView
{
public class ObjetTemp
/* public class ObjetTemp
{
public string AuteurName { get; set; }
public int NbLivre { get; set; }
@ -16,12 +17,13 @@ public partial class CollectionFiltrage : ContentView
}
}
public ObservableCollection<ObjetTemp> MyCollections1 { get; set; }
public ObservableCollection<ObjetTemp> MyCollections1 { get; set; }*/
public CollectionFiltrage()
public CollectionFiltrage(TousViewModel data)
{
InitializeComponent();
MyCollections1 = new ObservableCollection<ObjetTemp>()
/*MyCollections1 = new ObservableCollection<ObjetTemp>()
{
new ObjetTemp("Victor Hugo", 10),
new ObjetTemp("Jane Austen", 3),
@ -38,7 +40,7 @@ public partial class CollectionFiltrage : ContentView
new ObjetTemp("William Shakespeare", 9),
new ObjetTemp("Charles Dickensn", 9),
new ObjetTemp("Isaac Asimov", 9),
};
BindingContext = this;
};*/
BindingContext = data;
}
}

@ -1,4 +1,3 @@
using BookApp.Model;
using BookApp.Pages;
using BookApp.ViewModel;
@ -13,10 +12,10 @@ namespace BookApp.Composants
private async void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (e.CurrentSelection.FirstOrDefault() is Book selectedItem)
/*if (e.CurrentSelection.FirstOrDefault() is Book selectedItem)
{
await Navigation.PushAsync(new DetailBook(selectedItem));
}
}*/
}
}
}

@ -1,198 +0,0 @@
using BookApp.Model;
using System.Collections.ObjectModel;
namespace BookApp.Data
{
public class Stub
{
public ObservableCollection<Auteur> Auteurs { get; private set; } =
new ObservableCollection<Auteur>();
public ObservableCollection<Auteur> CreateStubData()
{
var victorHugo = new Auteur
{
Name = "Victor Hugo",
Books = new ObservableCollection<Book>()
};
var georgeOrwell = new Auteur
{
Name = "George Orwell",
Books = new ObservableCollection<Book>()
};
var jkRowling = new Auteur
{
Name = "J.K. Rowling",
Books = new ObservableCollection<Book>()
};
Auteurs.Add(victorHugo);
Auteurs.Add(georgeOrwell);
Auteurs.Add(jkRowling);
AddBookToAuthor(
victorHugo,
"Les Misérables",
"dotnet_bot.svg",
new Star(5),
StatutDeLecture.Lu,
true,
false,
false,
"Grasset",
"Une épopée sur la vie de Jean Valjean...",
1232,
"Français",
"978-1234567890",
"2023-09-10",
"https://link_to_les_miserables.com"
);
AddBookToAuthor(
victorHugo,
"Notre-Dame de Paris",
"dotnet_bot.svg",
new Star(4),
StatutDeLecture.A_Lire,
false,
true,
false,
"Grasset",
"L'histoire de Quasimodo...",
940,
"Français",
"978-2345678910",
"2023-06-05",
"https://link_to_notre_dame.com"
);
AddBookToAuthor(
georgeOrwell,
"1984",
"dotnet_bot.svg",
new Star(4),
StatutDeLecture.A_Lire,
false,
true,
false,
"Penguin",
"L'histoire d'un futur dystopique...",
328,
"Anglais",
"978-9876543210",
"2023-08-01",
"https://link_to_1984.com"
);
AddBookToAuthor(
georgeOrwell,
"La Ferme des animaux",
"dotnet_bot.svg",
new Star(3),
StatutDeLecture.Non_Lu,
false,
false,
true,
"Penguin",
"Comment les animaux ont pris le pouvoir...",
112,
"Anglais",
"978-8765432109",
"2023-07-20",
"https://link_to_ferme_animaux.com"
);
AddBookToAuthor(
jkRowling,
"Harry Potter à l'école des sorciers",
"dotnet_bot.svg",
new Star(5),
StatutDeLecture.Lu,
true,
false,
false,
"Bloomsbury",
"L'aventure magique commence pour Harry...",
309,
"Anglais",
"978-7654321098",
"2023-01-15",
"https://link_to_hp_sorciers.com"
);
AddBookToAuthor(
jkRowling,
"Harry Potter et la chambre des secrets",
"dotnet_bot.svg",
new Star(5),
StatutDeLecture.Lu,
true,
false,
false,
"Bloomsbury",
"Le mystère de la Chambre des Secrets...",
341,
"Anglais",
"978-6543210987",
"2023-02-10",
"https://link_to_hp_chambre.com"
);
AddBookToAuthor(
jkRowling,
"Harry Potter et le prisonnier d'Azkaban",
"dotnet_bot.svg",
new Star(5),
StatutDeLecture.Lu,
true,
false,
false,
"Bloomsbury",
"Le danger rôde autour d'Harry...",
435,
"Anglais",
"978-5432109876",
"2023-03-05",
"https://link_to_hp_azkaban.com"
);
return Auteurs;
}
private void AddBookToAuthor(
Auteur author,
string name,
string imageBook,
Star note,
StatutDeLecture statut,
bool favori,
bool next,
bool pret,
string maisonEdit,
string resumer,
int nbPage,
string langue,
string isbn,
string dateAjout,
string link
)
{
author.Books.Add(
new Book
{
Name = name,
ImageBook = imageBook,
Auteur = author,
Note = note,
Statut = statut,
Favori = favori,
Next = next,
Pret = pret,
MaisonEdit = maisonEdit,
Resumer = resumer,
NbPage = nbPage,
Langue = langue,
ISBN = isbn,
dateAjout = dateAjout,
Link = link
}
);
}
}
}

@ -1,6 +1,12 @@
using CommunityToolkit.Maui;
using BookApp.Composants;
using BookApp.Pages;
using BookApp.ViewModel;
using CommunityToolkit.Maui;
using Microsoft.Extensions.Logging;
using Model;
using SimpleRatingControlMaui;
using StubLib;
using VMWrapper;
namespace BookApp
{
@ -22,6 +28,13 @@ namespace BookApp
#if DEBUG
builder.Logging.AddDebug();
#endif
builder.Services.AddSingleton<ILibraryManager, LibraryStub>();
builder.Services.AddSingleton<BookViewModel>();
builder.Services.AddSingleton<TousViewModel>();
builder.Services.AddSingleton<Filtrage>();
builder.Services.AddSingleton<CollectionFiltrage>();
// transient pour recharger la data à l'execute
return builder.Build();
}

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BookApp.Model
{
public class Auteur
{
public string Name { get; set; }
public ObservableCollection<Book> Books { get; set; }
}
}

@ -1,21 +0,0 @@
namespace BookApp.Model
{
public class Book
{
public string Name { get; set; }
public string ImageBook { get; set; }
public Auteur Auteur { get; set; }
public Star Note { get; set; }
public StatutDeLecture Statut { get; set; }
public bool Favori { get; set; }
public bool Next { get; set; }
public bool Pret { get; set; }
public string MaisonEdit { get; set; }
public string Resumer { get; set; }
public int NbPage { get; set; }
public string Langue { get; set; }
public string ISBN { get; set; }
public string dateAjout { get; set; }
public string Link { get; set; }
}
}

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BookApp.Model
{
public class Person
{
public int Id { get; set; }
public string Name { get; set; }
}
}

@ -1,27 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BookApp.Model
{
public class Star
{
public static int MaxStars { get; private set; } = 5;
public int CurrentRating { get; private set; }
public Star(int rating)
{
if (rating < 0 || rating > MaxStars)
throw new ArgumentOutOfRangeException("Rating should be between 0 and MaxStars.");
CurrentRating = rating;
}
public IEnumerable<int> Rating
{
get { return Enumerable.Range(0, MaxStars); }
}
}
}

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BookApp.Model
{
public enum StatutDeLecture
{
Lu,
A_Lire,
Non_Lu
}
}

@ -18,7 +18,7 @@
Source="Chevron_left.svg"
HorizontalOptions="Start">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="BackButton" NumberOfTapsRequired="1"/>
<!-- <TapGestureRecognizer Tapped="BackButton" NumberOfTapsRequired="1"/> -->
</Image.GestureRecognizers>
<Image.Behaviors>
<toolkit:IconTintColorBehavior TintColor="Red" />

@ -1,20 +1,19 @@
using BookApp.Model;
using System.Collections.ObjectModel;
namespace BookApp.Pages;
public partial class DetailBook : ContentPage
{
private int maxStars = 5;
/*private int maxStars = 5;
private int currentRating = 0;
public Book BookDetail { get; set; }
public DetailBook(Book ItemBook)
*/
public DetailBook()//Book ItemBook)
{
InitializeComponent();
for (int i = 1; i <= maxStars; i++)
/* for (int i = 1; i <= maxStars; i++)
{
var star = new Image
{
@ -33,9 +32,9 @@ public partial class DetailBook : ContentPage
UpdateStars();
BookDetail = ItemBook;
BindingContext = this;
BindingContext = this;*/
}
/*
private void StarTapped(int rating)
{
if (rating > maxStars)
@ -64,5 +63,5 @@ public partial class DetailBook : ContentPage
async void BackButton(object sender, EventArgs args)
{
await Shell.Current.Navigation.PopAsync();
}
}*/
}

@ -7,7 +7,7 @@ namespace BookApp.Pages
public Tous()
{
InitializeComponent();
BindingContext = new TousViewModel();
//BindingContext = new TousViewModel();
}
async void BackButton(object sender, EventArgs args)

@ -1,32 +1,53 @@
using BookApp.Data;
using BookApp.Model;
using Model;
using System.Collections.ObjectModel;
using VMWrapper;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace BookApp.ViewModel;
namespace BookApp.ViewModel
{
public class TousViewModel
{
public class AuteurGroup : ObservableCollection<Book>
{
public string Name { get; private set; }
public AuteurGroup(string name, ObservableCollection<Book> books)
: base(books)
{
Name = name;
}
}
public ObservableCollection<AuteurGroup> AuteurGroups { get; private set; } =
new ObservableCollection<AuteurGroup>();
public class TousViewModel
{
BookViewModel _viewModel;
public ObservableCollection<Author> Authors { get; set; } = new ObservableCollection<Author>();
/* public ObservableCollection<AuteurGroup> AuteurGroups { get; private set; } =
new ObservableCollection<AuteurGroup>();*/
public TousViewModel(BookViewModel viewModel)
{
_viewModel = viewModel;
GetAuthors();
/* ObservableCollection<Auteur> auteurs = new Stub().CreateStubData();
foreach (Auteur auteur in auteurs)
{
AuteurGroups.Add(new AuteurGroup(auteur.Name, auteur.Books));
}*/
}
public TousViewModel()
{
ObservableCollection<Auteur> auteurs = new Stub().CreateStubData();
foreach (Auteur auteur in auteurs)
{
AuteurGroups.Add(new AuteurGroup(auteur.Name, auteur.Books));
}
//fireandforget
public async void GetAuthors()
{
var authors1 = await _viewModel.GetAuthor();
Authors.Clear();
foreach (var author in authors1)
{
Authors.Add(author);
}
}
}
}
/*public class AuteurGroup : ObservableCollection<Book>
{
public string Name { get; private set; }
public AuteurGroup(string name, ObservableCollection<Book> books)
: base(books)
{
Name = name;
}
}*/

@ -6,6 +6,10 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Linq" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LibraryDTO\LibraryDTO.csproj" />
</ItemGroup>

@ -8,6 +8,7 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Linq" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LibraryDTO\LibraryDTO.csproj" />

@ -15,4 +15,7 @@
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\net7.0\LibraryDTO.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Linq" Version="4.3.0" />
</ItemGroup>
</Project>

@ -6,4 +6,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Linq" Version="4.3.0" />
</ItemGroup>
</Project>

@ -6,6 +6,10 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Linq" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" />
<ProjectReference Include="..\StubbedDTO\StubbedDTO.csproj" />

@ -24,6 +24,9 @@
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Linq" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DtoAbstractLayer\DtoAbstractLayer.csproj" />
<ProjectReference Include="..\JsonReader\JsonReader.csproj" />

@ -18,6 +18,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Linq" Version="4.3.0" />
</ItemGroup>
</Project>

@ -4,4 +4,8 @@
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Linq" Version="4.3.0" />
</ItemGroup>
</Project>

@ -0,0 +1,32 @@
using Model;
using System;
using System.Collections.ObjectModel;
using System.Xml.Linq;
namespace VMWrapper
{
// All the code in this file is included in all platforms.
public class BookViewModel
{
ILibraryManager data;
ObservableCollection<Author> authorList;
public BookViewModel(ILibraryManager data)
{
this.data = data;
}
public async Task<ObservableCollection<Author>> GetAuthor()
{
var objet = await data.GetAuthorsByName("",0,10);
var ojb = objet.Item2;
return new ObservableCollection<Author>(ojb);
}
}
}

@ -0,0 +1,7 @@
namespace VMWrapper
{
// All the code in this file is only included on Android.
public class PlatformClass1
{
}
}

@ -0,0 +1,7 @@
namespace VMWrapper
{
// All the code in this file is only included on Mac Catalyst.
public class PlatformClass1
{
}
}

@ -0,0 +1,9 @@
using System;
namespace VMWrapper
{
// All the code in this file is only included on Tizen.
public class PlatformClass1
{
}
}

@ -0,0 +1,7 @@
namespace VMWrapper
{
// All the code in this file is only included on Windows.
public class PlatformClass1
{
}
}

@ -0,0 +1,7 @@
namespace VMWrapper
{
// All the code in this file is only included on iOS.
public class PlatformClass1
{
}
}

@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0;net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</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> -->
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</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>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Linq" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>
</Project>
Loading…
Cancel
Save