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

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

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

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

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

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