Add (Back-End): Navigation terminer
continuous-integration/drone/push Build is failing Details

Back-End
Louis DUFOUR 2 years ago
parent d87d16c481
commit 080b2702f8

@ -15,19 +15,21 @@
</Tab>
<Tab Title="My lists"
Icon="list_bullet.svg">
<ShellContent ContentTemplate="{DataTemplate pages:EmpruntsPrets}"/>
<ShellContent ContentTemplate="{DataTemplate local:MainPage}" Route="Mainpage"/>
</Tab>
<Tab Title="My Readings"
Icon="bookmark_fill.svg">
<ShellContent ContentTemplate="{DataTemplate pages:Tous}" />
<ShellContent ContentTemplate="{DataTemplate local:MainPage}" Route="Mainpage"/>
</Tab>
<Tab Title="Search"
Icon="magnifyingglass.svg">
<ShellContent ContentTemplate="{DataTemplate pages:Filtrage}" />
<ShellContent ContentTemplate="{DataTemplate local:MainPage}" Route="Mainpage"/>
</Tab>
</TabBar>
<ShellContent Route="FiltragePage" ContentTemplate="{DataTemplate pages:Filtrage}" />
<ShellContent Route="TousPage" ContentTemplate="{DataTemplate pages:Tous}" />
<ShellContent Route="EmpruntsPretsPage" ContentTemplate="{DataTemplate pages:EmpruntsPrets}" />
<ShellContent Route="DetailBookPage" ContentTemplate="{DataTemplate pages:DetailBook}" />
</Shell>

@ -10,7 +10,8 @@ namespace BookApp
Routing.RegisterRoute("FiltragePage", typeof(Filtrage));
Routing.RegisterRoute("TousPage", typeof(Tous));
Routing.RegisterRoute("Mainpage", typeof(MainPage));
Routing.RegisterRoute("EmpruntsPrets", typeof(EmpruntsPrets));
Routing.RegisterRoute("EmpruntsPretsPage", typeof(EmpruntsPrets));
Routing.RegisterRoute("DetailBookPage", typeof(DetailBook));
}
}
}

@ -6,7 +6,7 @@
xmlns:model="clr-namespace:Model;assembly=Model"
x:DataType="vm:ViewModelManager"
x:Class="BookApp.Composants.CollectionFiltrage">
<CollectionView ItemsSource="{Binding Authors}">
<CollectionView ItemsSource="{Binding bookViewModel.authorList}">
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="model:Author">
<StackLayout Padding="5">

@ -2,6 +2,7 @@
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:composants="clr-namespace:BookApp.Composants"
xmlns:model="clr-namespace:Model;assembly=Model"
x:Class="BookApp.Composants.GroupCollection">
<ContentView.Resources>
<Style TargetType="StackLayout">
@ -20,7 +21,9 @@
</Setter>
</Style>
</ContentView.Resources>
<CollectionView ItemsSource="{Binding AuteurGroups}" IsGrouped="True" SelectionMode="Single" SelectionChanged="OnSelectionChanged">
<CollectionView ItemsSource="{Binding bookViewModel.AuteurGroups}" IsGrouped="True" SelectionMode="Single"
SelectionChangedCommand="{Binding ViewModelNavigation.BookSelected}"
SelectedItem="{Binding ViewModelNavigation.SelectedBook}">
<CollectionView.GroupHeaderTemplate>
<DataTemplate>
<Label Text="{Binding Name}"

@ -1,4 +1,5 @@
using BookApp.Pages;
using BookApp.ViewModel;
using Model;
namespace BookApp.Composants
@ -10,12 +11,10 @@ namespace BookApp.Composants
InitializeComponent();
}
private async void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
public GroupCollection(ViewModelManager data)
: this()
{
if (e.CurrentSelection.FirstOrDefault() is Book selectedItem)
{
await Navigation.PushAsync(new DetailBook(selectedItem));
}
BindingContext = data;
}
}
}

@ -61,7 +61,7 @@
<Label FontSize="35" FontFamily="SF-Pro-Display-Bold" Padding="10">Mes livres</Label>
<Rectangle HeightRequest="1" BackgroundColor="black" VerticalOptions="End" />
<CollectionView ItemsSource="{Binding ViewModelMenu.MenuItemsLivre}"
SelectionChangedCommand="{Binding ViewModelNavigation.ItemSelectedCommand}"
SelectionChangedCommand="{Binding ViewModelNavigation.ItemSelectedCommandMain}"
SelectedItem="{Binding ViewModelNavigation.SelectedItem, Mode=TwoWay}"
SelectionMode="Single" Margin="25,0,0,0" BackgroundColor="#F9F9F9">
@ -116,9 +116,9 @@
<Rectangle HeightRequest="1" BackgroundColor="black" VerticalOptions="End"/>
<CollectionView ItemsSource="{Binding ViewModelMenu.MenuItemsFiltre}"
SelectionChangedCommand="{Binding ViewModelNavigation.ItemSelectedCommand}"
SelectionChangedCommand="{Binding ViewModelNavigation.ItemSelectedCommandFiltre}"
SelectedItem="{Binding ViewModelNavigation.SelectedItem, Mode=TwoWay}"
Margin="25,0,0,0" BackgroundColor="#F9F9F9">
SelectionMode="Single" Margin="25,0,0,0" BackgroundColor="#F9F9F9">
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="vm:ViewModelMenuItem">
<Grid RowDefinitions="Auto" >
@ -147,11 +147,10 @@
VerticalOptions="Center"
Margin="0,0,40,0"
HorizontalOptions="End"/>
<Button Grid.Column="2"
ImageSource="chevron_right.svg"
HeightRequest="35"
WidthRequest="35"
BackgroundColor="#F9F9F9"
<Image Grid.Column="2"
Source="chevron_right.svg"
HeightRequest="25"
WidthRequest="25"
HorizontalOptions="End"/>
</Grid>
<Rectangle Grid.ColumnSpan="4" HeightRequest="1" BackgroundColor="LightGray" VerticalOptions="End">

@ -36,6 +36,9 @@ namespace BookApp
builder.Services.AddSingleton<Tous>();
builder.Services.AddSingleton<MainPage>();
builder.Services.AddSingleton<ViewModelNavigation>();
builder.Services.AddSingleton<EmpruntsPrets>();
builder.Services.AddSingleton<GroupCollection>();
builder.Services.AddSingleton<DetailBook>();
builder.Services.AddTransient<ViewModelMenu>();

@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:vm="clr-namespace:BookApp.ViewModel"
x:Class="BookApp.Pages.DetailBook">
<Shell.BackButtonBehavior>
<BackButtonBehavior IsVisible="False" IsEnabled="False"/>
@ -18,7 +19,9 @@
Source="Chevron_left.svg"
HorizontalOptions="Start">
<Image.GestureRecognizers>
<!-- <TapGestureRecognizer Tapped="BackButton" NumberOfTapsRequired="1"/> -->
<TapGestureRecognizer
Command="{Binding ViewModelNavigation.BackButtonCommand}"
NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
<Image.Behaviors>
<toolkit:IconTintColorBehavior TintColor="Red" />
@ -54,9 +57,9 @@
<ColumnDefinition Width="125"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Margin="10,10,10,0" Grid.Column="0" Source="{Binding BookDetail.ImageBook}"/>
<Image Margin="10,10,10,0" Grid.Column="0" Source="{Binding ViewModelNavigation.SelectedBook.ImageLarge}"/>
<StackLayout Grid.Column="1">
<Label FontAttributes="Bold" FontSize="20" Text="{Binding BookDetail.Name}"/>
<Label FontAttributes="Bold" FontSize="20" Text="{Binding ViewModelNavigation.SelectedBook.Title }"/>
<Grid RowDefinitions="auto" VerticalOptions="EndAndExpand">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
@ -81,13 +84,13 @@
</Grid>
<Rectangle Margin="25,0,0,10" HeightRequest="1" BackgroundColor="LightGray" VerticalOptions="End"/>
<Label FontAttributes="Bold" Margin="25,0,0,0" VerticalTextAlignment="Center" Text="Auteur"/>
<Label Margin="25,0,0,0" VerticalTextAlignment="Center" Text="{Binding BookDetail.Auteur.Name}"/>
<Label Margin="25,0,0,0" VerticalTextAlignment="Center" Text="{Binding ViewModelNavigation.SelectedBook.Authors}"/>
<Rectangle Margin="25,10,0,10" HeightRequest="1" BackgroundColor="LightGray" VerticalOptions="End"/>
<Label FontAttributes="Bold" Margin="25,0,0,0" VerticalTextAlignment="Center" Text="Maison d'édition"/>
<Label Margin="25,0,0,0" VerticalTextAlignment="Center" Text="{Binding BookDetail.MaisonEdit}"/>
<Label Margin="25,0,0,0" VerticalTextAlignment="Center" Text="{Binding ViewModelNavigation.SelectedBook.MaisonEdit}"/>
<Rectangle Margin="25,10,0,10" HeightRequest="1" BackgroundColor="LightGray" VerticalOptions="End"/>
<Label FontAttributes="Bold" Margin="25,0,0,0" VerticalTextAlignment="Center" Text="Résumer"/>
<Label Margin="25,0,0,0" VerticalTextAlignment="Center" Text="Le Lorem Ipsum est simplement du faux texte employé dans la composition et la mise en page avant impression. Le Lorem Ipsum est le faux texte standard de l'imprimerie depuis les années 1500, quand un imprimeur anonyme assembla ensemble des morceaux de texte pour réaliser un livre spécimen de polices de texte. Il n'a pas fait que survivre cinq siècles, mais s'est aussi adapté à la bureautique informatique, sans que son contenu n'en soit modifié. Il a été popularisé dans les années 1960 grâce à la vente de feuilles Letraset contenant des passages du Lorem Ipsum, et, plus récemment, par son inclusion dans des applications de mise en page de texte, comme Aldus PageMaker."/>
<Label Margin="25,0,0,0" VerticalTextAlignment="Center" Text="{Binding ViewModelNavigation.SelectedBook.Format}"/>
<Rectangle Margin="25,10,0,10" HeightRequest="1" BackgroundColor="LightGray" VerticalOptions="End" />
<Label FontAttributes="Bold" Margin="25,0,0,0" VerticalTextAlignment="Center" Text="Details"/>
<Grid Margin="25,0,20,0">
@ -101,11 +104,11 @@
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Text="Nombre de pages"/>
<Label Grid.Row="0" Grid.Column="1" HorizontalTextAlignment="End" Text="{Binding BookDetail.NbPage}"/>
<Label Grid.Row="0" Grid.Column="1" HorizontalTextAlignment="End" Text="{Binding ViewModelNavigation.SelectedBook.NbPages}"/>
<Label Grid.Row="1" Grid.Column="0" Text="Langue"/>
<Label Grid.Row="1" Grid.Column="1" HorizontalTextAlignment="End" Text="{Binding BookDetail.Langue}"/>
<Label Grid.Row="1" Grid.Column="1" HorizontalTextAlignment="End" Text="{Binding ViewModelNavigation.SelectedBook.Language}"/>
<Label Grid.Row="2" Grid.Column="0" Text="ISBN"/>
<Label Grid.Row="2" Grid.Column="1" HorizontalTextAlignment="End" Text="{Binding BookDetail.ISBN}"/>
<Label Grid.Row="2" Grid.Column="1" HorizontalTextAlignment="End" Text="{Binding ViewModelNavigation.SelectedBook.Status}"/>
</Grid>
<Rectangle Margin="25,10,0,10" HeightRequest="1" BackgroundColor="LightGray" VerticalOptions="End" />
<Label FontAttributes="Bold" Margin="25,0,0,0" VerticalTextAlignment="Center" Text="Status de lecture"/>
@ -115,7 +118,7 @@
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="Status"/>
<Label Grid.Column="1" HorizontalTextAlignment="End" Text="{Binding BookDetail.Statut}"/>
<Label Grid.Column="1" HorizontalTextAlignment="End" Text="{Binding ViewModelNavigation.SelectedBook.Status}"/>
</Grid>
<Rectangle Margin="25,10,0,10" HeightRequest="1" BackgroundColor="LightGray" VerticalOptions="End" />
<Label FontAttributes="Bold" Margin="25,0,0,0" VerticalTextAlignment="Center" Text="biliothèque"/>
@ -125,7 +128,7 @@
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="Ajouter le"/>
<Label Grid.Column="1" HorizontalTextAlignment="End" Text="{Binding BookDetail.dateAjout}"/>
<Label Grid.Column="1" HorizontalTextAlignment="End" Text="{Binding ViewModelNavigation.SelectedBook.PublishDate}"/>
</Grid>
<Rectangle Margin="25,10,0,10" HeightRequest="1" BackgroundColor="LightGray" VerticalOptions="End" />
<Rectangle HeightRequest="100" Fill="Transparent"/>

@ -1,67 +1,14 @@
using BookApp.ViewModel;
using Model;
using System.Collections.ObjectModel;
namespace BookApp.Pages;
public partial class DetailBook : ContentPage
{
/*private int maxStars = 5;
private int currentRating = 0;
public Book BookDetail { get; set; }
*/
public DetailBook(Model.Book selectedItem) //Book ItemBook)
public DetailBook(ViewModelManager data)
{
InitializeComponent();
/* for (int i = 1; i <= maxStars; i++)
{
var star = new Image
{
Source = "empty_star.svg", // image d'une étoile vide
WidthRequest = 25,
HeightRequest = 25
};
int currentStar = i;
star.GestureRecognizers.Add(
new TapGestureRecognizer { Command = new Command(() => StarTapped(currentStar)), }
);
StarLayout.Children.Add(star);
}
UpdateStars();
BookDetail = ItemBook;
BindingContext = this;*/
}
/*
private void StarTapped(int rating)
{
if (rating > maxStars)
{
System.Diagnostics.Debug.WriteLine("Erreur : rating trop élevé!");
return;
}
currentRating = rating;
UpdateStars();
RatingLabel.Text = $"Note: {currentRating}/{maxStars}";
BindingContext = data;
}
private void UpdateStars()
{
for (int i = 0; i < maxStars; i++)
{
var star = (Image)StarLayout.Children[i];
if (i < currentRating)
star.Source = "filled_star.svg"; // image d'une étoile remplie
else
star.Source = "empty_star.svg";
}
}
async void BackButton(object sender, EventArgs args)
{
await Shell.Current.Navigation.PopAsync();
}*/
}

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BookApp.Pages.EmpruntsPrets"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
Title="EmpruntsPrets">
xmlns:vm="clr-namespace:BookApp.ViewModel"
x:Class="BookApp.Pages.EmpruntsPrets">
<Shell.BackButtonBehavior>
<BackButtonBehavior IsVisible="False" IsEnabled="False"/>
</Shell.BackButtonBehavior>
@ -19,7 +19,9 @@
Source="Chevron_left.svg"
HorizontalOptions="Start">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="BackButton" NumberOfTapsRequired="1"/>
<TapGestureRecognizer
Command="{Binding ViewModelNavigation.BackButtonCommand}"
NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
<Image.Behaviors>
<toolkit:IconTintColorBehavior TintColor="Red" />
@ -71,7 +73,7 @@
<StackLayout>
<ContentView>
<ContentView.GestureRecognizers>
<TapGestureRecognizer Command="{Binding TapCommand}" NumberOfTapsRequired="1" />
<!-- <TapGestureRecognizer Command="{Binding TapCommand}" NumberOfTapsRequired="1" /> -->
</ContentView.GestureRecognizers>
<Grid WidthRequest="150" HeightRequest="50"
@ -79,10 +81,8 @@
VerticalOptions="Center"
HorizontalOptions="Center">
<!-- Le Switch -->
<Switch x:Name="MySwitch" IsToggled="{Binding IsToggled}"
HorizontalOptions="Start"
VerticalOptions="Center"/>
<!-- Le Switch <Switch x:Name="MySwitch" IsToggled="{Binding IsToggled}" HorizontalOptions="Start" VerticalOptions="Center"/> -->
<!-- Le Texte -->
<Label Text="Mon Switch"

@ -1,35 +1,33 @@
using BookApp.ViewModel;
using System.Windows.Input;
namespace BookApp.Pages;
public partial class EmpruntsPrets : ContentPage
namespace BookApp.Pages
{
public ICommand TapCommand => new Command(ToggleSwitch);
private bool _isToggled;
public bool IsToggled
public partial class EmpruntsPrets : ContentPage
{
get => _isToggled;
set
/* public ICommand TapCommand => new Command(ToggleSwitch);
private bool _isToggled;
public bool IsToggled
{
get => _isToggled;
set
{
_isToggled = value;
OnPropertyChanged();
}
}*/
public EmpruntsPrets(ViewModelManager data)
{
_isToggled = value;
OnPropertyChanged();
InitializeComponent();
BindingContext = data;
}
}
public EmpruntsPrets()
{
InitializeComponent();
}
async void BackButton(object sender, EventArgs args)
{
await Shell.Current.Navigation.PopAsync();
}
private void ToggleSwitch()
{
IsToggled = !IsToggled;
/*private void ToggleSwitch()
{
IsToggled = !IsToggled;
}*/
}
}

@ -5,8 +5,8 @@
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:composants="clr-namespace:BookApp.Composants"
xmlns:model="clr-namespace:Model;assembly=Model"
xmlns:vm="clr-namespace:BookApp.ViewModel"
xmlns:vmw="clr-namespace:VMWrapper;assembly=VMWrapper"
x:DataType="vmw:BookViewModel"
x:Class="BookApp.Pages.Filtrage">
<Shell.BackButtonBehavior>
<BackButtonBehavior IsVisible="False" IsEnabled="False"/>
@ -23,7 +23,9 @@
Source="Chevron_left.svg"
HorizontalOptions="Start">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="BackButton" NumberOfTapsRequired="1"/>
<TapGestureRecognizer
Command="{Binding ViewModelNavigation.BackButtonCommand}"
NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
<Image.Behaviors>
<toolkit:IconTintColorBehavior TintColor="Red" />
@ -66,7 +68,7 @@
<StackLayout>
<Rectangle HeightRequest="1" BackgroundColor="LightGray"/>
<SearchBar Placeholder="Search items..."/>
<CollectionView ItemsSource="{Binding authorList}" VerticalOptions="FillAndExpand">
<CollectionView ItemsSource="{Binding bookViewModel.authorList}" VerticalOptions="FillAndExpand">
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="model:Author">
<StackLayout Padding="5">

@ -7,15 +7,10 @@ namespace BookApp.Pages
{
SearchBar searchBar = new SearchBar { Placeholder = "Search items..." };
public Filtrage(BookViewModel data)
public Filtrage(ViewModelManager data)
{
InitializeComponent();
BindingContext = data;
}
async void BackButton(object sender, EventArgs args)
{
await Shell.Current.Navigation.PopAsync();
}
}
}

@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:composants="clr-namespace:BookApp.Composants"
xmlns:vm="clr-namespace:BookApp.ViewModel"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Class="BookApp.Pages.Tous">
<Shell.BackButtonBehavior>
@ -20,7 +21,9 @@
Source="Chevron_left.svg"
HorizontalOptions="Start">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="BackButton" NumberOfTapsRequired="1"/>
<TapGestureRecognizer
Command="{Binding ViewModelNavigation.BackButtonCommand}"
NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
<Image.Behaviors>
<toolkit:IconTintColorBehavior TintColor="Red" />

@ -1,21 +1,15 @@
using BookApp.ViewModel;
using System.Collections.ObjectModel;
using System.Diagnostics;
using VMWrapper;
namespace BookApp.Pages
{
public partial class Tous : ContentPage
{
public Tous(BookViewModel data)
public Tous(ViewModelManager data)
{
InitializeComponent();
Debug.WriteLine("TousPage is initialized.");
BindingContext = data;
}
async void BackButton(object sender, EventArgs args)
{
await Shell.Current.Navigation.PopAsync();
}
}
}

@ -7,14 +7,12 @@ namespace BookApp.ViewModel;
public class ViewModelManager : BaseViewModel
{
BookViewModel _viewModel;
public ObservableCollection<Author> Authors { get; set; } = new ObservableCollection<Author>();
public BookViewModel bookViewModel { get; }
public ViewModelMenu ViewModelMenu { get; } = new ViewModelMenu();
public ViewModelNavigation ViewModelNavigation { get; } = new ViewModelNavigation();
public ViewModelManager(BookViewModel viewModel)
{
_viewModel = viewModel;
bookViewModel = viewModel;
}
}

@ -21,7 +21,7 @@ namespace BookApp.ViewModel
"En prêt",
"../Resources/Images/person_badge_clock_fill.svg",
250,
"EmpruntsPrets"
"EmpruntsPretsPage"
),
new ViewModelMenuItem(
"À lire plus tard",
@ -51,7 +51,7 @@ namespace BookApp.ViewModel
"Auteur",
"../Resources/Images/person_fill.svg",
250,
"Filtrage"
"FiltragePage"
),
new ViewModelMenuItem(
"Date de publication",

@ -1,8 +1,7 @@
using ToolKit;
using System.Windows.Input;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using Model;
namespace BookApp.ViewModel
{
@ -15,11 +14,28 @@ namespace BookApp.ViewModel
set { SetProperty(ref _selectedItem, value); }
}
public ICommand ItemSelectedCommand { get; private set; }
private Book _selectedBook;
public Book SelectedBook
{
get { return _selectedBook; }
set { SetProperty(ref _selectedBook, value); }
}
public INavigation Navigation { get; set; }
public ICommand MenuItemsFiltre { get; private set; }
public ICommand ItemSelectedCommandMain { get; private set; }
public ICommand BookSelected { get; private set; }
public ICommand BackButtonCommand { get; private set; }
public ViewModelNavigation()
{
ItemSelectedCommand = new Command(async () => await OnItemSelected(SelectedItem));
MenuItemsFiltre = new Command(async () => await OnItemSelected(SelectedItem));
ItemSelectedCommandMain = new Command(async () => await OnItemSelected(SelectedItem));
BackButtonCommand = new Command(async () => await BackButton(this, EventArgs.Empty));
BookSelected = new Command(async () => await OnBookSelected(SelectedBook));
}
private async Task OnItemSelected(ViewModelMenuItem selectedItem)
@ -27,12 +43,12 @@ namespace BookApp.ViewModel
SelectedItem = selectedItem;
if (string.IsNullOrEmpty(SelectedItem?.Route))
{
return;
}
try
{
await Shell.Current.GoToAsync(selectedItem.Route);
selectedItem = null;
}
catch (Exception ex)
{
@ -40,14 +56,28 @@ namespace BookApp.ViewModel
}
}
async void ButtonTous(object sender, EventArgs args)
private async Task OnBookSelected(Book SelectedBook)
{
await Shell.Current.GoToAsync("TousPage");
if (SelectedBook == null)
{
return;
}
try
{
await Shell.Current.GoToAsync("DetailBookPage");
}
catch (Exception ex)
{
Debug.WriteLine($"Navigation failed: {ex.Message}");
}
}
async void ButtonAuteur(object sender, EventArgs args)
async Task BackButton(object sender, EventArgs args)
{
await Shell.Current.GoToAsync("FiltragePage");
if (Shell.Current.Navigation.NavigationStack.Count > 1)
{
await Shell.Current.Navigation.PopAsync();
}
}
}
}

Loading…
Cancel
Save