Compare commits

..

1 Commits

@ -27,7 +27,7 @@ public static class MauiProgram
builder.Services
.AddSingleton<BibliothequeView>()
.AddSingleton<TousView>()
.AddSingleton<TousView>()
.AddSingleton<FiltrageAuteurView>()
.AddSingleton<FiltrageDateView>()
.AddSingleton<FiltrageNoteView>()
@ -58,7 +58,8 @@ public static class MauiProgram
.AddSingleton<FavorisVM>()
.AddSingleton<ContactsVM>()
.AddSingleton<PopupISBNVM>()
.AddSingleton<ScanVM>();
.AddSingleton<ScanVM>()
.AddSingleton<StarNotationVM>();
#if DEBUG
builder.Logging.AddDebug();

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="108" height="110">
<path d="M54,5 86,105 1,43H107L22,105" fill="#808080"/>
</svg>

Before

Width:  |  Height:  |  Size: 167 B

@ -1,24 +1,67 @@
<?xml version="1.0" encoding="utf-8" ?>
<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"
x:Class="LivreLand.View.ContentViews.StarNotationView">
<HorizontalStackLayout Spacing="2">
<Grid ColumnSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Image Source="star.png"
HeightRequest="20"
WidthRequest="20"
Grid.Column="0"/>
<Image Source="star_fill.png"
HeightRequest="20"
WidthRequest="20"/>
WidthRequest="20"
Grid.Column="0"
IsVisible="{Binding StarNotationVM.Star1IsVisible}"/>
<Image Source="star.png"
HeightRequest="20"
WidthRequest="20"
Grid.Column="1"/>
<Image Source="star_fill.png"
HeightRequest="20"
WidthRequest="20"/>
WidthRequest="20"
Grid.Column="1"
IsVisible="{Binding StarNotationVM.Star2IsVisible}"/>
<Image Source="star.png"
HeightRequest="20"
WidthRequest="20"
Grid.Column="2"/>
<Image Source="star_fill.png"
HeightRequest="20"
WidthRequest="20"/>
WidthRequest="20"
Grid.Column="2"
IsVisible="{Binding StarNotationVM.Star3IsVisible}"/>
<Image Source="star.png"
HeightRequest="20"
WidthRequest="20"
Grid.Column="3"/>
<Image Source="star_fill.png"
HeightRequest="20"
WidthRequest="20"/>
WidthRequest="20"
Grid.Column="3"
IsVisible="{Binding StarNotationVM.Star4IsVisible}"/>
<Image Source="star_fill.png"
HeightRequest="20"
WidthRequest="20"/>
</HorizontalStackLayout>
WidthRequest="20"
Grid.Column="4"
IsVisible="{Binding StarNotationVM.Star5IsVisible}"/>
<Image Source="star.png"
HeightRequest="20"
WidthRequest="20"
Grid.Column="4"/>
</Grid>
</ContentView>

@ -1,9 +1,30 @@
using LivreLand.ViewModel;
namespace LivreLand.View.ContentViews;
public partial class StarNotationView : ContentView
{
public StarNotationView()
#region Properties
public static readonly BindableProperty StarNotationProperty = BindableProperty.Create(nameof(StarNotation), typeof(StarNotationVM), typeof(StarNotationView), Application.Current.Handler.MauiContext.Services.GetService<StarNotationVM>());
public StarNotationVM StarNotation
{
get { return (StarNotationVM)GetValue(StarNotationProperty); }
set { SetValue(StarNotationProperty, value); }
}
public StarNotationVM StarNotationVM { get; private set; }
#endregion
#region Constructor
public StarNotationView()
{
StarNotationVM = StarNotation;
InitializeComponent();
}
#endregion
}

@ -8,6 +8,7 @@
xmlns:model="clr-namespace:Model;assembly=Model"
x:Class="LivreLand.View.DetailsLivreView"
Title="DetailsLivreView">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>

@ -0,0 +1,61 @@
using Model;
using PersonalMVVMToolkit;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using ViewModels;
namespace LivreLand.ViewModel
{
public class StarNotationVM : BaseViewModel
{
#region Properties
public bool Star1IsVisible { get; private set; }
public bool Star2IsVisible { get; private set; }
public bool Star3IsVisible { get; private set; }
public bool Star4IsVisible { get; private set; }
public bool Star5IsVisible { get; private set; }
public ManagerVM Manager { get; private set; }
public ICommand StarRatingConverterCommand { get; private set; }
#endregion
#region Constructor
public StarNotationVM(ManagerVM managerVM)
{
Manager = managerVM;
StarRatingConverterCommand = new RelayCommand(() => StarRatingConverter());
}
#endregion
#region Methods
private void StarRatingConverter()
{
var bookRating = Manager.SelectedBook.UserRating;
for (int i = 1; i <= 5; i++)
{
if (bookRating >= i)
{
var starProperty = typeof(StarNotationVM).GetProperty($"Star{i}IsVisible");
starProperty?.SetValue(this, true);
}
}
}
#endregion
}
}

@ -41,6 +41,18 @@ namespace LivreLand.ViewModel
{
var result = new DetailsLivreVM(Manager, Navigator, bookVM);
App.Current.MainPage.Navigation.PushAsync(new DetailsLivreView(result));
var bookRating = bookVM.UserRating;
StarNotationVM starNotationVM = new StarNotationVM(this.Manager);
for (int i = 1; i <= 5; i++)
{
if (bookRating >= i)
{
var starProperty = typeof(StarNotationVM).GetProperty($"Star{i}IsVisible");
starProperty?.SetValue(starNotationVM, true);
}
}
}
}

@ -88,7 +88,7 @@ BaseViewModel --|> ObservableObject
RelayCommand ..|> ICommand
```
Cette structure est une version remplaçant pour le moment le `Community Toolkit` mis en place par Microsoft qui permet aussi de supprimer beaucoup de code inutile en remplaçant celui-ci par des annotations et des classes partielles.
Cette strcuture est une version remplaçant pour le moment le `Community Toolkit` mis en place par Microsoft qui permet aussi de supprimer beaucoup de code inutile en remplaçant celui-ci par des annotations et des classes partielles.
---
@ -115,86 +115,6 @@ Le schéma suivant montre bien les relations entre les grandes parties du `patro
Le **diagramme de classes** pouvant être extrèmement grand à cause des multiples classes au sein de notre projet, j'ai décidé de représenter une partie de celui-ci qui pourrait se répéter pour toutes les autres parties. L'objectif principal étant de comprendre comment fonctionne le **modèle MVVM** et comment les classes intéragissent entre elles, j'ai choisi de faire mon exemple avec la partie des livres qui est la plus générale du sujet.
```mermaid
classDiagram
class Book {
Id: string
Title: string
Publishers: List<string>
PublishDate: DateTime
ISBN13: string
Series: List<string>
NbPages: int
Format: string
Language: Languages
Contributors: List<Contributor>
ImageSmall: string
ImageMedium: string
ImageLarge: string
Works: List<Work>
Authors: List<Author>
Status: Status
UserTags: List<string>
UserRating: float?
UserNote: string
Equals(other: Book): bool
GetHashCode(): int
}
class DetailsLivreView {
DetailsLivreVM: DetailsLivreVM
}
class DetailsLivreVM {
isPickerVisible: bool
addFavorisButtonText: string
Manager: ManagerVM
Navigator: NavigatorVM
Book: BookVM
IsPickerVisible: bool
AddFavorisButtonText: string
BackButtonCommand: ICommand
ShowPickerCommand: ICommand
AddRemoveBookToFavoritesCommand: ICommand
AddBookToReadListCommand: ICommand
LoanBookCommand: ICommand
RemoveBookCommand: ICommand
OpenInfoCommand: ICommand
BackButton()
ShowPicker()
AddRemoveBookToFavorites(bookVM: BookVM)
AddBookToReadList(bookVM: BookVM)
LoanBook(bookVM: BookVM)
RemoveBook(bookVM: BookVM)
OpenInfo()
}
class BookVM {
Id: string
ISBN13: string
Title: string
Publishers: List<string>
PublishDate: DateTime
Works: List<WorkVM>
WorkDescription: string
Authors: List<AuthorVM>
Author: string
Status: Status
NbPages: int
Language: Languages
ImageSmall: string
UserRating: float?
}
DetailsLivreView --> DetailsLivreVM
DetailsLivreVM --> BookVM
DetailsLivreVM --> ManagerVM
DetailsLivreVM --> NavigatorVM
BookVM --> Book
BookVM --> WorkVM
BookVM --> AuthorVM
```
*******
<div id='presentation'/>
@ -213,7 +133,7 @@ Retrouver tous vos livres préférés en un clic.
**TP2 - Base** :
- [x] Page d'accueil
- [x] Affichage des livres de l'utilisateur : afficher tous les livres de l'utilisateur dans la vue BooksPage et permettre la sélection d'un livre et la navigation vers la page BookPage
* seule la note n'est pas encore affichée sous la forme d'étoiles (commencée dans `star-notation-22-10`)
* seule la note n'est pas encore affichée sous la forme d'étoiles
- [x] Filtrage par auteur et par date de publication : afficher dans la vue de filtrage (FilterPage)
**TP2 - Ajouts** :
@ -234,12 +154,12 @@ _Erreurs rencontrées_ :
**TP3** :
- [X] Modifier l'intégralité du code pour que l'application utilise désormais le MVVM Community Toolkit à la place du toolkit personnel
* lecture de la documentation et implémentation dans la branche `TP3` (à affiner pour respecter parfaitement le Toolkit)
* lecture de la documentation et début de l'implémentation effectuée
**TP 4** :
Ajouter les vues et les VM nécessaires pour permettre :
- [x] Le scan de code-barres afin d'ajouter de nouveaux livres
* le scan de code-barres fonctionne mais le livre n'est pas encore directement ajouté dans la liste (affichage de l'isbn dans en bas de page & du bouton d'ajout du livre)
* le scan de code-barres fonctionne mais le livre n'est pas encore directement ajouté dans la liste
- [X] La recherche en ligne (via le web service)
* il est possible d'accéder à la page d'un livre en ligne en cliquant dans la partie "Infos en ligne" de la page Détails

Loading…
Cancel
Save