ADD : ButtonsCommand Header Pages + Delete ok (bug nb pages int, navigation after delete)

commands-19-09
Lou BRODA 1 year ago
parent 4664a2e79f
commit 3f52cb2e78

@ -18,6 +18,8 @@
HeaderBackButtonText="Mes livres"
HeaderPlusButtonVisible="True"
HeaderSwitchButtonVisible="True"
ButtonPlusTappedCommand="{Binding ALirePlusTardVM.Navigator.PopupHomePlusNavigationCommand}"
ButtonBackTappedCommand="{Binding ALirePlusTardVM.Navigator.PopupBackButtonNavigationCommand}"
Grid.Row="0"/>
<ScrollView Grid.Row="2">
<Grid>

@ -5,6 +5,7 @@
xmlns:view="clr-namespace:LivreLand.View"
xmlns:contentView="clr-namespace:LivreLand.View.ContentViews"
xmlns:viewModel="clr-namespace:ViewModels;assembly=ViewModels"
xmlns:model="clr-namespace:Model;assembly=Model"
x:Class="LivreLand.View.DetailsLivreView"
Title="DetailsLivreView">
<Grid>
@ -19,7 +20,9 @@
HeaderBackButtonText="Tous"
HeaderPlusButtonVisible="False"
HeaderSwitchButtonVisible="False"
HeaderColor="{StaticResource HeaderGray}"/>
HeaderColor="{StaticResource HeaderGray}"
ButtonPlusTappedCommand="{Binding DetailsLivreVM.Navigator.PopupHomePlusNavigationCommand}"
ButtonBackTappedCommand="{Binding DetailsLivreVM.Navigator.PopupBackButtonNavigationCommand}"/>
<contentView:SeparatorEntireView/>
</VerticalStackLayout>
@ -299,7 +302,8 @@
<contentView:SeparatorCutStartView/>
</VerticalStackLayout>
<!--Buttons-->
<VerticalStackLayout Grid.Row="2">
<contentView:SeparatorCutStartView/>
@ -316,7 +320,7 @@
<contentView:SeparatorCutStartView/>
<contentView:DetailsLivreButtonView ButtonIcon="rounded_plus"
<contentView:DetailsLivreButtonView ButtonIcon="rounded_plus.png"
ButtonTitle="Ajouter à la liste À lire plus tard"
ButtonCommand="{Binding DetailsLivreVM.Manager.UpdateToBeReadBookCommand}"
ButtonCommandParameter="{Binding DetailsLivreVM.Book}"/>
@ -325,14 +329,35 @@
<contentView:DetailsLivreButtonView ButtonIcon="eyeglasses.png"
ButtonTitle="Changer le statut de lecture"
ButtonCommand="{Binding DetailsLivreVM.Manager.UpdateStatusBookCommand}"/>
ButtonCommand="{Binding DetailsLivreVM.ShowPickerCommand}"/>
<contentView:SeparatorCutStartView/>
<contentView:DetailsLivreButtonView ButtonIcon="person.png"
ButtonTitle="Prêter le livre"/>
<contentView:SeparatorCutStartView/>
<contentView:DetailsLivreButtonView ButtonTitle="Supprimer le livre"
ButtonCommand="{Binding DetailsLivreVM.Manager.RemoveBookCommand}"
ButtonCommandParameter="{Binding DetailsLivreVM.Book}"/>
</VerticalStackLayout>
<!--Buttons-->
<Picker SelectedItem="{Binding DetailsLivreVM.Manager.SelectedStatus}"
IsVisible="true"
Grid.RowSpan="3"
HorizontalOptions="Center"
VerticalOptions="Center">
<Picker.ItemsSource>
<x:Array Type="{x:Type model:Status}"/>
</Picker.ItemsSource>
<Picker.Behaviors>
<toolkit:EventToCommandBehavior Command="{Binding DetailsLivreVM.Manager.UpdateStatusBookCommand}"
CommandParameter="{Binding DetailsLivreVM.Book}"/>
</Picker.Behaviors>
</Picker>
</Grid>
</ScrollView>
</Grid>

@ -20,6 +20,8 @@
HeaderBackButtonText="Mes livres"
HeaderPlusButtonVisible="True"
HeaderSwitchButtonVisible="True"
ButtonPlusTappedCommand="{Binding EmpruntsPretsVM.Navigator.PopupHomePlusNavigationCommand}"
ButtonBackTappedCommand="{Binding EmpruntsPretsVM.Navigator.PopupBackButtonNavigationCommand}"
Grid.Row="0"/>
<contentView:EmpruntsPretsButtonView Grid.Row="2"
PretButtonBackgroundColor="{Binding EmpruntsPretsVM.PretButtonBackgroundColor}"

@ -18,6 +18,8 @@
HeaderBackButtonText="Mes livres"
HeaderPlusButtonVisible="True"
HeaderSwitchButtonVisible="True"
ButtonPlusTappedCommand="{Binding FavorisVM.Navigator.PopupHomePlusNavigationCommand}"
ButtonBackTappedCommand="{Binding FavorisVM.Navigator.PopupBackButtonNavigationCommand}"
Grid.Row="0"/>
<ScrollView Grid.Row="2">
<Grid>

@ -21,7 +21,9 @@
HeaderTitle="Auteur"
HeaderBackButtonText="Mes livres"
HeaderPlusButtonVisible="False"
HeaderSwitchButtonVisible="True"/>
HeaderSwitchButtonVisible="True"
ButtonPlusTappedCommand="{Binding FiltrageAuteurVM.Navigator.PopupHomePlusNavigationCommand}"
ButtonBackTappedCommand="{Binding FiltrageAuteurVM.Navigator.PopupBackButtonNavigationCommand}"/>
<VerticalStackLayout BackgroundColor="{DynamicResource Light}"
Spacing="10"

@ -20,6 +20,8 @@
<view:HeaderPage HeaderTitle="Date de publication"
HeaderPlusButtonVisible="False"
HeaderSwitchButtonVisible="True"
ButtonPlusTappedCommand="{Binding FiltrageDateVM.Navigator.PopupHomePlusNavigationCommand}"
ButtonBackTappedCommand="{Binding FiltrageDateVM.Navigator.PopupBackButtonNavigationCommand}"
Grid.Row="0"/>
<VerticalStackLayout BackgroundColor="{DynamicResource Light}"

@ -21,7 +21,9 @@
HeaderTitle="Note"
HeaderBackButtonText="Mes livres"
HeaderPlusButtonVisible="False"
HeaderSwitchButtonVisible="True"/>
HeaderSwitchButtonVisible="True"
ButtonPlusTappedCommand="{Binding FiltrageNoteVM.Navigator.PopupHomePlusNavigationCommand}"
ButtonBackTappedCommand="{Binding FiltrageNoteVM.Navigator.PopupBackButtonNavigationCommand}"/>
<VerticalStackLayout BackgroundColor="{DynamicResource Light}"
Spacing="10"

@ -20,6 +20,8 @@
HeaderBackButtonText="Mes livres"
HeaderPlusButtonVisible="True"
HeaderSwitchButtonVisible="True"
ButtonPlusTappedCommand="{Binding StatutLectureVM.Navigator.PopupHomePlusNavigationCommand}"
ButtonBackTappedCommand="{Binding StatutLectureVM.Navigator.PopupBackButtonNavigationCommand}"
Grid.Row="0"/>
<contentView:SearchBarView Grid.Row="2"/>
<ScrollView Grid.Row="4">

@ -22,9 +22,9 @@
HeaderBackButtonText="Mes livres"
HeaderPlusButtonVisible="True"
HeaderSwitchButtonVisible="True"
Grid.Row="0"
ButtonPlusTappedCommand="{Binding TousVM.Navigator.PopupHomePlusNavigationCommand}"
ButtonBackTappedCommand="{Binding TousVM.Navigator.PopupBackButtonNavigationCommand}"/>
ButtonBackTappedCommand="{Binding TousVM.Navigator.PopupBackButtonNavigationCommand}"
Grid.Row="0"/>
<ScrollView Grid.Row="1">
<Grid>
<Grid.RowDefinitions>
@ -153,7 +153,9 @@
Rotation="180"
Command="{Binding TousVM.Manager.PreviousCommand}"
Grid.Column="1"/>
<Label Grid.Column="3">
<Label Style="{StaticResource MasterTitleBookText}"
VerticalOptions="FillAndExpand"
Grid.Column="3">
<Label.FormattedText>
<FormattedString>
<Span Text="{Binding TousVM.Manager.Index}"/>

@ -4,18 +4,40 @@ 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 DetailsLivreVM : BaseViewModel
{
#region Fields
private bool isPickerVisible;
#endregion
#region Properties
public ManagerVM Manager { get; private set; }
public BookVM Book { get; private set; }
public bool IsPickerVisible
{
get => isPickerVisible;
set
{
if (isPickerVisible != value)
{
isPickerVisible = value;
OnPropertyChanged(nameof(IsPickerVisible));
}
}
}
public ICommand ShowPickerCommand { get; private set; }
#endregion
#region Constructor
@ -24,6 +46,16 @@ namespace LivreLand.ViewModel
{
Manager = managerVM;
Book = bookVM;
ShowPickerCommand = new RelayCommand(() => ShowPicker());
}
#endregion
#region Methods
private void ShowPicker()
{
IsPickerVisible = true;
}
#endregion

@ -84,7 +84,7 @@ namespace ViewModels
public RatingsVM SelectedRating { get; private set; }
public Status SelectedStatus { get; private set; }
public Status SelectedStatus { get; set; }
public string SearchTitle { get; private set; }
@ -105,6 +105,7 @@ namespace ViewModels
OnPropertyChanged(nameof(NbPages));
}
}
public int NbPages => (int)(NbBooks / Count);
public ICommand PreviousCommand { get; private set; }
@ -243,6 +244,8 @@ namespace ViewModels
{
var book = await Model.GetBookById(bookVM.Id);
await Model.RemoveBook(book);
OnPropertyChanged(nameof(NbBooks));
await GetBooksFromCollection();
}
private async Task GetBooksByAuthor()

Loading…
Cancel
Save