ADD : Avancement avec StatutLecture & Bibliotheque VIewModel

commands-19-09
Lou BRODA 1 year ago
parent a387a06a05
commit d683ae38ce

@ -29,6 +29,7 @@ public static class MauiProgram
.AddSingleton<FiltrageDateView>() .AddSingleton<FiltrageDateView>()
.AddSingleton<FiltrageNoteView>() .AddSingleton<FiltrageNoteView>()
.AddSingleton<ALirePlusTardView>() .AddSingleton<ALirePlusTardView>()
.AddSingleton<StatutLectureView>()
.AddSingleton<NavigatorVM>() .AddSingleton<NavigatorVM>()
@ -38,11 +39,13 @@ public static class MauiProgram
.AddSingleton<ManagerVM>() .AddSingleton<ManagerVM>()
.AddSingleton<BibliothequeVM>()
.AddSingleton<TousVM>() .AddSingleton<TousVM>()
.AddSingleton<FiltrageAuteurVM>() .AddSingleton<FiltrageAuteurVM>()
.AddSingleton<FiltrageDateVM>() .AddSingleton<FiltrageDateVM>()
.AddSingleton<FiltrageNoteVM>() .AddSingleton<FiltrageNoteVM>()
.AddSingleton<ALirePlusTardVM>(); .AddSingleton<ALirePlusTardVM>()
.AddSingleton<StatutLectureVM>();
#if DEBUG #if DEBUG
builder.Logging.AddDebug(); builder.Logging.AddDebug();

@ -23,7 +23,7 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<view:HeaderHome Grid.Row="0" <view:HeaderHome Grid.Row="0"
ButtonTappedCommand="{Binding Navigator.PopupHomePlusNavigationCommand}"/> ButtonTappedCommand="{Binding BibliothequeVM.Navigator.PopupHomePlusNavigationCommand}"/>
<ScrollView Grid.Row="2"> <ScrollView Grid.Row="2">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -52,10 +52,10 @@
<!--Tous--> <!--Tous-->
<contentView:HomeButtonView ButtonTitle="Tous" <contentView:HomeButtonView ButtonTitle="Tous"
ButtonIcon="tray_2_fill.png" ButtonIcon="tray_2_fill.png"
ButtonNumber="45" ButtonNumber="{Binding BibliothequeVM.Manager.NbBooks}"
ButtonRedIconVisible="False" ButtonRedIconVisible="False"
ButtonBlackIconVisible="True" ButtonBlackIconVisible="True"
ButtonTappedCommand="{Binding Navigator.NavigationCommand}" ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}"
CommandParameter="tous/"/> CommandParameter="tous/"/>
<contentView:SeparatorCutStartView/> <contentView:SeparatorCutStartView/>
@ -66,7 +66,7 @@
ButtonNumber="1" ButtonNumber="1"
ButtonRedIconVisible="False" ButtonRedIconVisible="False"
ButtonBlackIconVisible="True" ButtonBlackIconVisible="True"
ButtonTappedCommand="{Binding Navigator.NavigationCommand}" ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}"
CommandParameter="pret/"/> CommandParameter="pret/"/>
<contentView:SeparatorCutStartView/> <contentView:SeparatorCutStartView/>
@ -76,7 +76,7 @@
ButtonIcon="arrow_forward.png" ButtonIcon="arrow_forward.png"
ButtonRedIconVisible="False" ButtonRedIconVisible="False"
ButtonBlackIconVisible="True" ButtonBlackIconVisible="True"
ButtonTappedCommand="{Binding Navigator.NavigationCommand}" ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}"
CommandParameter="later/"/> CommandParameter="later/"/>
<contentView:SeparatorCutStartView/> <contentView:SeparatorCutStartView/>
@ -86,7 +86,7 @@
ButtonIcon="eyeglasses.png" ButtonIcon="eyeglasses.png"
ButtonRedIconVisible="False" ButtonRedIconVisible="False"
ButtonBlackIconVisible="True" ButtonBlackIconVisible="True"
ButtonTappedCommand="{Binding Navigator.NavigationCommand}" ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}"
CommandParameter="statut/"/> CommandParameter="statut/"/>
<contentView:SeparatorCutStartView/> <contentView:SeparatorCutStartView/>
@ -96,7 +96,7 @@
ButtonIcon="heart_fill.png" ButtonIcon="heart_fill.png"
ButtonRedIconVisible="False" ButtonRedIconVisible="False"
ButtonBlackIconVisible="True" ButtonBlackIconVisible="True"
ButtonTappedCommand="{Binding Navigator.NavigationCommand}" ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}"
CommandParameter="favoris/"/> CommandParameter="favoris/"/>
<contentView:SeparatorEntireView/> <contentView:SeparatorEntireView/>
@ -119,7 +119,7 @@
ButtonIcon="person_fill.png" ButtonIcon="person_fill.png"
ButtonRedIconVisible="False" ButtonRedIconVisible="False"
ButtonBlackIconVisible="True" ButtonBlackIconVisible="True"
ButtonTappedCommand="{Binding Navigator.NavigationCommand}" ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}"
CommandParameter="auteur/"/> CommandParameter="auteur/"/>
<contentView:SeparatorCutStartView/> <contentView:SeparatorCutStartView/>
@ -129,7 +129,7 @@
ButtonIcon="calendar.png" ButtonIcon="calendar.png"
ButtonRedIconVisible="False" ButtonRedIconVisible="False"
ButtonBlackIconVisible="True" ButtonBlackIconVisible="True"
ButtonTappedCommand="{Binding Navigator.NavigationCommand}" ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}"
CommandParameter="date/"/> CommandParameter="date/"/>
<contentView:SeparatorCutStartView/> <contentView:SeparatorCutStartView/>
@ -139,7 +139,7 @@
ButtonIcon="sparkles.png" ButtonIcon="sparkles.png"
ButtonRedIconVisible="False" ButtonRedIconVisible="False"
ButtonBlackIconVisible="True" ButtonBlackIconVisible="True"
ButtonTappedCommand="{Binding Navigator.NavigationCommand}" ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}"
CommandParameter="note/"/> CommandParameter="note/"/>
<contentView:SeparatorEntireView/> <contentView:SeparatorEntireView/>

@ -7,19 +7,30 @@ public partial class BibliothequeView : ContentPage
{ {
#region Properties #region Properties
public NavigatorVM Navigator { get; private set; } public BibliothequeVM BibliothequeVM { get; set; }
#endregion #endregion
#region Constructor #region Constructor
public BibliothequeView(NavigatorVM navigatorVM) public BibliothequeView(BibliothequeVM bibliothequeVM)
{ {
Navigator = navigatorVM; BibliothequeVM = bibliothequeVM;
InitializeComponent(); InitializeComponent();
BindingContext = this; BindingContext = this;
} }
#endregion #endregion
#region Methods
protected override void OnAppearing()
{
base.OnAppearing();
BibliothequeVM.Manager.GetBooksFromCollectionCommand.Execute(null);
}
#endregion
} }

@ -36,6 +36,7 @@
<contentView:SeparatorEntireView/> <contentView:SeparatorEntireView/>
<CollectionView ItemsSource="{Binding FiltrageAuteurVM.Manager.AllAuthors}" <CollectionView ItemsSource="{Binding FiltrageAuteurVM.Manager.AllAuthors}"
SelectionMode="Single"
SelectedItem="{Binding FiltrageAuteurVM.Manager.SelectedAuthor}" SelectedItem="{Binding FiltrageAuteurVM.Manager.SelectedAuthor}"
SelectionChangedCommand="{Binding FiltrageAuteurVM.Navigator.NavigationCommand}" SelectionChangedCommand="{Binding FiltrageAuteurVM.Navigator.NavigationCommand}"
SelectionChangedCommandParameter="/tous"> SelectionChangedCommandParameter="/tous">

@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:view="clr-namespace:LivreLand.View" xmlns:view="clr-namespace:LivreLand.View"
xmlns:contentView="clr-namespace:LivreLand.View.ContentViews" xmlns:contentView="clr-namespace:LivreLand.View.ContentViews"
xmlns:viewModel="clr-namespace:ViewModels;assembly=ViewModels"
x:Class="LivreLand.View.StatutLectureView" x:Class="LivreLand.View.StatutLectureView"
Title="StatutLectureView"> Title="StatutLectureView">
@ -23,123 +24,29 @@
<contentView:SearchBarView Grid.Row="2"/> <contentView:SearchBarView Grid.Row="2"/>
<ScrollView Grid.Row="4"> <ScrollView Grid.Row="4">
<Grid> <Grid>
<Grid.RowDefinitions> <CollectionView ItemsSource="{Binding StatutLectureVM.Manager.AllBooks}"
<RowDefinition Height="40"/>
<RowDefinition Height="10"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="10"/>
<RowDefinition Height="40"/>
<RowDefinition Height="10"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid BackgroundColor="{AppThemeBinding Light={StaticResource HeaderGray}, Dark={StaticResource Gray900}}"
Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label Text="Non lus"
VerticalOptions="Center"
Style="{StaticResource HeaderCollectionViewText}"
Grid.Column="1"/>
</Grid>
<CollectionView ItemsSource="{Binding NonLuBooks}"
SelectionMode="Single" SelectionMode="Single"
SelectionChanged="OnSelectionChanged" SelectionChanged="OnSelectionChanged"
Grid.Row="2"> Grid.Row="2">
<CollectionView.ItemTemplate> <!--<CollectionView.GroupHeaderTemplate>
<DataTemplate> <DataTemplate x:DataType="viewModel:BookVM">
<VerticalStackLayout Margin="10"
Spacing="20">
<VisualStateManager.VisualStateGroups x:Name="SelectionStates">
<VisualStateGroup>
<VisualState x:Name="Selected">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="Transparent" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid Grid.Column="0"
Grid.RowSpan="5">
<Border Padding="-5,-5,-5,1"
Margin="10,0,0,0"
HeightRequest="100"
WidthRequest="62"
HorizontalOptions="Center"
Stroke="{StaticResource Gray}"
StrokeShape="RoundRectangle 3"
StrokeThickness="3">
<Border HorizontalOptions="Center"
Stroke="{StaticResource Gray}"
StrokeShape="RoundRectangle 3"
StrokeThickness="3">
<Image Source="couverture_la_horde_du_contrevent.png"
Aspect="AspectFill"
Grid.Column="0"
Grid.RowSpan="5"/>
</Border>
</Border>
<Image Source="bookmark_red.png"
HeightRequest="10"
WidthRequest="10"
Margin="0,97,20,0"
VerticalOptions="End"/>
</Grid>
<Label Text="{Binding Title}"
Style="{StaticResource MasterTitleBookText}"
Grid.Column="2"
Grid.Row="0"/>
<Label Text="{Binding Author}"
Style="{StaticResource MasterAuthorBookText}"
Grid.Column="2"
Grid.Row="1"/>
<Label Text="{Binding State}"
Style="{StaticResource MasterStateBookText}"
Grid.Column="2"
Grid.Row="2"/>
<contentView:StarNotationView Grid.Column="2"
Grid.Row="4"/>
</Grid>
<contentView:SeparatorCutStartView/>
</VerticalStackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<Grid BackgroundColor="{AppThemeBinding Light={StaticResource HeaderGray}, Dark={StaticResource Gray900}}" <Grid BackgroundColor="{AppThemeBinding Light={StaticResource HeaderGray}, Dark={StaticResource Gray900}}"
Grid.Row="4"> Grid.Row="0">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/> <ColumnDefinition Width="10"/>
<ColumnDefinition Width="auto"/> <ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Text="Terminés" <Label Text="{Binding Status}"
VerticalOptions="Center" VerticalOptions="Center"
Style="{StaticResource HeaderCollectionViewText}" Style="{StaticResource HeaderCollectionViewText}"
Grid.Column="1"/> Grid.Column="1"/>
</Grid> </Grid>
<CollectionView ItemsSource="{Binding TermineBooks}" </DataTemplate>
SelectionMode="Single" </CollectionView.GroupHeaderTemplate>-->
SelectionChanged="OnSelectionChanged"
Grid.Row="6">
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate> <DataTemplate x:DataType="viewModel:BookVM">
<VerticalStackLayout Margin="10" <VerticalStackLayout Margin="10"
Spacing="20"> Spacing="20">
<VisualStateManager.VisualStateGroups x:Name="SelectionStates"> <VisualStateManager.VisualStateGroups x:Name="SelectionStates">
@ -178,7 +85,7 @@
Stroke="{StaticResource Gray}" Stroke="{StaticResource Gray}"
StrokeShape="RoundRectangle 3" StrokeShape="RoundRectangle 3"
StrokeThickness="3"> StrokeThickness="3">
<Image Source="couverture_la_horde_du_contrevent.png" <Image Source="{Binding ImageSmall}"
Aspect="AspectFill" Aspect="AspectFill"
Grid.Column="0" Grid.Column="0"
Grid.RowSpan="5"/> Grid.RowSpan="5"/>
@ -194,11 +101,11 @@
Style="{StaticResource MasterTitleBookText}" Style="{StaticResource MasterTitleBookText}"
Grid.Column="2" Grid.Column="2"
Grid.Row="0"/> Grid.Row="0"/>
<Label Text="{Binding Author}" <Label Text="Author"
Style="{StaticResource MasterAuthorBookText}" Style="{StaticResource MasterAuthorBookText}"
Grid.Column="2" Grid.Column="2"
Grid.Row="1"/> Grid.Row="1"/>
<Label Text="{Binding State}" <Label Text="{Binding Status}"
Style="{StaticResource MasterStateBookText}" Style="{StaticResource MasterStateBookText}"
Grid.Column="2" Grid.Column="2"
Grid.Row="2"/> Grid.Row="2"/>

@ -1,30 +1,40 @@
using LivreLand.Model; using LivreLand.Model;
using LivreLand.ViewModel;
namespace LivreLand.View; namespace LivreLand.View;
public partial class StatutLectureView : ContentPage public partial class StatutLectureView : ContentPage
{ {
public List<BookModel> NonLuBooks { get; set; } = new List<BookModel>() #region Properties
{
new BookModel("La horde du contrevent","Alain Damasio","Non lu", 0),
};
public List<BookModel> TermineBooks { get; set; } = new List<BookModel>() public StatutLectureVM StatutLectureVM { get; set; }
{
new BookModel("La zone du dehors","Alain Damasio","Terminé", 0), #endregion
new BookModel("L'équateur d'Einstein","Cixin Liu","Terminé", 0),
new BookModel("La forêt sombre","Cixin Liu","Terminé", 0), #region Constructor
new BookModel("Le problème à trois corps","Cixin Liu","Terminé", 0)
};
public StatutLectureView() public StatutLectureView(StatutLectureVM statutLectureVM)
{ {
BindingContext = this; StatutLectureVM = statutLectureVM;
InitializeComponent(); InitializeComponent();
BindingContext = this;
}
#endregion
#region Methods
protected override void OnAppearing()
{
base.OnAppearing();
StatutLectureVM.Manager.GetBooksFromCollectionCommand.Execute(null);
} }
void OnSelectionChanged(object sender, SelectionChangedEventArgs e) void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
//App.Current.MainPage.Navigation.PushAsync(new DetailsLivreView()); //App.Current.MainPage.Navigation.PushAsync(new DetailsLivreView());
} }
#endregion
} }

@ -0,0 +1,31 @@
using PersonalMVVMToolkit;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ViewModels;
namespace LivreLand.ViewModel
{
public class BibliothequeVM : BaseViewModel
{
#region Properties
public NavigatorVM Navigator { get; private set; }
public ManagerVM Manager { get; private set; }
#endregion
#region Constructor
public BibliothequeVM(NavigatorVM navigatorVM, ManagerVM managerVM)
{
Navigator = navigatorVM;
Manager = managerVM;
}
#endregion
}
}

@ -0,0 +1,31 @@
using PersonalMVVMToolkit;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ViewModels;
namespace LivreLand.ViewModel
{
public class StatutLectureVM : BaseViewModel
{
#region Properties
public NavigatorVM Navigator { get; private set; }
public ManagerVM Manager { get; private set; }
#endregion
#region Constructor
public StatutLectureVM(NavigatorVM navigatorVM, ManagerVM managerVM)
{
Navigator = navigatorVM;
Manager = managerVM;
}
#endregion
}
}
Loading…
Cancel
Save