From d683ae38ceb9d271d9fc4435d2a42a92073454c0 Mon Sep 17 00:00:00 2001 From: lobroda Date: Wed, 11 Oct 2023 11:19:03 +0100 Subject: [PATCH] ADD : Avancement avec StatutLecture & Bibliotheque VIewModel --- LivreLand/MauiProgram.cs | 9 +- LivreLand/View/BibliothequeView.xaml | 20 ++-- LivreLand/View/BibliothequeView.xaml.cs | 17 ++- LivreLand/View/FiltrageAuteurView.xaml | 1 + LivreLand/View/StatutLectureView.xaml | 139 ++++------------------- LivreLand/View/StatutLectureView.xaml.cs | 36 +++--- LivreLand/ViewModel/BibliothequeVM.cs | 31 +++++ LivreLand/ViewModel/StatutLectureVM.cs | 31 +++++ 8 files changed, 139 insertions(+), 145 deletions(-) create mode 100644 LivreLand/ViewModel/BibliothequeVM.cs create mode 100644 LivreLand/ViewModel/StatutLectureVM.cs diff --git a/LivreLand/MauiProgram.cs b/LivreLand/MauiProgram.cs index 8d64464..0b29492 100644 --- a/LivreLand/MauiProgram.cs +++ b/LivreLand/MauiProgram.cs @@ -29,8 +29,9 @@ public static class MauiProgram .AddSingleton() .AddSingleton() .AddSingleton() + .AddSingleton() - .AddSingleton() + .AddSingleton() .AddSingleton() .AddSingleton() @@ -38,11 +39,13 @@ public static class MauiProgram .AddSingleton() + .AddSingleton() .AddSingleton() - .AddSingleton() + .AddSingleton() .AddSingleton() .AddSingleton() - .AddSingleton(); + .AddSingleton() + .AddSingleton(); #if DEBUG builder.Logging.AddDebug(); diff --git a/LivreLand/View/BibliothequeView.xaml b/LivreLand/View/BibliothequeView.xaml index ae6b9ed..ea22313 100644 --- a/LivreLand/View/BibliothequeView.xaml +++ b/LivreLand/View/BibliothequeView.xaml @@ -23,7 +23,7 @@ + ButtonTappedCommand="{Binding BibliothequeVM.Navigator.PopupHomePlusNavigationCommand}"/> @@ -52,10 +52,10 @@ @@ -66,7 +66,7 @@ ButtonNumber="1" ButtonRedIconVisible="False" ButtonBlackIconVisible="True" - ButtonTappedCommand="{Binding Navigator.NavigationCommand}" + ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}" CommandParameter="pret/"/> @@ -76,7 +76,7 @@ ButtonIcon="arrow_forward.png" ButtonRedIconVisible="False" ButtonBlackIconVisible="True" - ButtonTappedCommand="{Binding Navigator.NavigationCommand}" + ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}" CommandParameter="later/"/> @@ -86,7 +86,7 @@ ButtonIcon="eyeglasses.png" ButtonRedIconVisible="False" ButtonBlackIconVisible="True" - ButtonTappedCommand="{Binding Navigator.NavigationCommand}" + ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}" CommandParameter="statut/"/> @@ -96,7 +96,7 @@ ButtonIcon="heart_fill.png" ButtonRedIconVisible="False" ButtonBlackIconVisible="True" - ButtonTappedCommand="{Binding Navigator.NavigationCommand}" + ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}" CommandParameter="favoris/"/> @@ -119,7 +119,7 @@ ButtonIcon="person_fill.png" ButtonRedIconVisible="False" ButtonBlackIconVisible="True" - ButtonTappedCommand="{Binding Navigator.NavigationCommand}" + ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}" CommandParameter="auteur/"/> @@ -129,7 +129,7 @@ ButtonIcon="calendar.png" ButtonRedIconVisible="False" ButtonBlackIconVisible="True" - ButtonTappedCommand="{Binding Navigator.NavigationCommand}" + ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}" CommandParameter="date/"/> @@ -139,7 +139,7 @@ ButtonIcon="sparkles.png" ButtonRedIconVisible="False" ButtonBlackIconVisible="True" - ButtonTappedCommand="{Binding Navigator.NavigationCommand}" + ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}" CommandParameter="note/"/> diff --git a/LivreLand/View/BibliothequeView.xaml.cs b/LivreLand/View/BibliothequeView.xaml.cs index 75c64af..dd9eca9 100644 --- a/LivreLand/View/BibliothequeView.xaml.cs +++ b/LivreLand/View/BibliothequeView.xaml.cs @@ -7,19 +7,30 @@ public partial class BibliothequeView : ContentPage { #region Properties - public NavigatorVM Navigator { get; private set; } + public BibliothequeVM BibliothequeVM { get; set; } #endregion #region Constructor - public BibliothequeView(NavigatorVM navigatorVM) + public BibliothequeView(BibliothequeVM bibliothequeVM) { - Navigator = navigatorVM; + BibliothequeVM = bibliothequeVM; InitializeComponent(); BindingContext = this; } #endregion + #region Methods + + protected override void OnAppearing() + { + base.OnAppearing(); + + BibliothequeVM.Manager.GetBooksFromCollectionCommand.Execute(null); + } + + #endregion + } \ No newline at end of file diff --git a/LivreLand/View/FiltrageAuteurView.xaml b/LivreLand/View/FiltrageAuteurView.xaml index 5da8f01..aa448e5 100644 --- a/LivreLand/View/FiltrageAuteurView.xaml +++ b/LivreLand/View/FiltrageAuteurView.xaml @@ -36,6 +36,7 @@ diff --git a/LivreLand/View/StatutLectureView.xaml b/LivreLand/View/StatutLectureView.xaml index 3ae497a..158870a 100644 --- a/LivreLand/View/StatutLectureView.xaml +++ b/LivreLand/View/StatutLectureView.xaml @@ -2,7 +2,8 @@ @@ -23,123 +24,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + @@ -178,7 +85,7 @@ Stroke="{StaticResource Gray}" StrokeShape="RoundRectangle 3" StrokeThickness="3"> - @@ -194,11 +101,11 @@ Style="{StaticResource MasterTitleBookText}" Grid.Column="2" Grid.Row="0"/> -