ADD : Avancement avec premier affichage des livres fonctionnel 🔥

commands-19-09
Lou BRODA 1 year ago
parent 7a2ae56ca8
commit a37283cabd

@ -93,7 +93,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"/>
@ -109,11 +109,20 @@
Style="{StaticResource MasterTitleBookText}" Style="{StaticResource MasterTitleBookText}"
Grid.Column="2" Grid.Column="2"
Grid.Row="0"/> Grid.Row="0"/>
<Label Text="Author" <CollectionView ItemsSource="{Binding Authors}"
Style="{StaticResource MasterAuthorBookText}" Grid.Column="2"
Grid.Column="2" Grid.Row="1">
Grid.Row="1"/> <CollectionView.ItemsLayout>
<Label Text="State" <LinearItemsLayout Orientation="Horizontal" />
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="viewModel:AuthorVM">
<Label Text="{Binding Name}"
Style="{StaticResource MasterAuthorBookText}"/>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<Label Text="{Binding Status}"
Style="{StaticResource MasterStateBookText}" Style="{StaticResource MasterStateBookText}"
Grid.Column="2" Grid.Column="2"
Grid.Row="2"/> Grid.Row="2"/>
@ -138,82 +147,27 @@
Style="{StaticResource HeaderCollectionViewText}" Style="{StaticResource HeaderCollectionViewText}"
Grid.Column="1"/> Grid.Column="1"/>
</Grid> </Grid>
<CollectionView ItemsSource="{Binding LiuBooks}" <Grid Grid.Row="6">
SelectionMode="Single" <Grid.ColumnDefinitions>
SelectionChanged="OnSelectionChanged" <ColumnDefinition Width="*"/>
Grid.Row="6"> <ColumnDefinition Width="auto"/>
<CollectionView.ItemTemplate> <ColumnDefinition Width="5"/>
<DataTemplate> <ColumnDefinition Width="auto"/>
<VerticalStackLayout Margin="10" <ColumnDefinition Width="5"/>
Spacing="20"> <ColumnDefinition Width="auto"/>
<VisualStateManager.VisualStateGroups x:Name="SelectionStates"> <ColumnDefinition Width="*"/>
<VisualStateGroup> </Grid.ColumnDefinitions>
<VisualState x:Name="Selected">
<VisualState.Setters> <ImageButton Source="chevron_right.png"
<Setter Property="BackgroundColor" Value="Transparent" /> Rotation="180"
</VisualState.Setters> Command="{Binding TousVM.Manager.PreviousCommand}"
</VisualState> Grid.Column="1"/>
</VisualStateGroup> <Label Text="{Binding TousVM.Manager.Index, TousVM.Manager.NbPages, StringFormat='{0}/{1}'}"
</VisualStateManager.VisualStateGroups> Grid.Column="3"/>
<Grid> <ImageButton Source="chevron_right.png"
<Grid.ColumnDefinitions> Command="{Binding TousVM.Manager.NextCommand}"
<ColumnDefinition Width="auto"/> Grid.Column="5"/>
<ColumnDefinition Width="10"/> </Grid>
<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> </Grid>
</ScrollView> </ScrollView>
<Grid HorizontalOptions="End" <Grid HorizontalOptions="End"

@ -44,5 +44,12 @@ public partial class TousView : ContentPage
App.Current.MainPage.Navigation.PushAsync(new DetailsLivreView()); App.Current.MainPage.Navigation.PushAsync(new DetailsLivreView());
} }
protected override void OnAppearing()
{
base.OnAppearing();
TousVM.Manager.GetBooksFromCollectionCommand.Execute(null);
}
#endregion #endregion
} }

@ -41,14 +41,16 @@ namespace ViewModels
set => SetProperty(Model.PublishDate, value, v => Model.PublishDate = value); set => SetProperty(Model.PublishDate, value, v => Model.PublishDate = value);
} }
//public List<AuthorVM> Authors public List<AuthorVM> Authors
//{ {
// get => model.Authors; get => Model.Authors.Select(a => new AuthorVM(a)).ToList();
// set }
// {
// model.Authors = value; public Status Status
// } {
//} get => Model.Status;
set => SetProperty(Model.Status, value, v => Model.Status = value);
}
public int NbPages public int NbPages
{ {

@ -10,7 +10,7 @@ namespace ViewModels
#region Fields #region Fields
private readonly ObservableCollection<BookVM> books; private readonly ObservableCollection<BookVM> books = new ObservableCollection<BookVM>();
private int index; private int index;
private long nbBooks; private long nbBooks;
@ -18,7 +18,10 @@ namespace ViewModels
#region Properties #region Properties
public ReadOnlyObservableCollection<BookVM> AllBooks { get; private set; } public ObservableCollection<BookVM> AllBooks
{
get => books;
}
public string SearchTitle { get; private set; } public string SearchTitle { get; private set; }
@ -55,7 +58,6 @@ namespace ViewModels
public ManagerVM(Manager model) : base(model) public ManagerVM(Manager model) : base(model)
{ {
//AllBooks = new ReadOnlyObservableCollection<BookVM>(books);
PreviousCommand = new RelayCommand(() => Previous()); PreviousCommand = new RelayCommand(() => Previous());
NextCommand = new RelayCommand(() => Next()); NextCommand = new RelayCommand(() => Next());
GetBooksFromCollectionCommand = new RelayCommand(() => GetBooksFromCollection()); GetBooksFromCollectionCommand = new RelayCommand(() => GetBooksFromCollection());
@ -96,6 +98,7 @@ namespace ViewModels
{ {
books.Add(b); books.Add(b);
} }
OnPropertyChanged(nameof(AllBooks));
} }
#endregion #endregion

Loading…
Cancel
Save