diff --git a/sources/PocketBook/BookDetail.xaml b/sources/PocketBook/BookDetail.xaml new file mode 100644 index 0000000..61167a8 --- /dev/null +++ b/sources/PocketBook/BookDetail.xaml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sources/PocketBook/BookDetail.xaml.cs b/sources/PocketBook/BookDetail.xaml.cs new file mode 100644 index 0000000..d65ba4a --- /dev/null +++ b/sources/PocketBook/BookDetail.xaml.cs @@ -0,0 +1,9 @@ +namespace PocketBook; + +public partial class BookDetail : ContentPage +{ + public BookDetail(Book book) + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/sources/PocketBook/ContentViewBook.xaml b/sources/PocketBook/ContentViewBook.xaml new file mode 100644 index 0000000..0666cfa --- /dev/null +++ b/sources/PocketBook/ContentViewBook.xaml @@ -0,0 +1,23 @@ + + + + + + + + + + + diff --git a/sources/PocketBook/ContentViewBook.xaml.cs b/sources/PocketBook/ContentViewBook.xaml.cs new file mode 100644 index 0000000..543f4ff --- /dev/null +++ b/sources/PocketBook/ContentViewBook.xaml.cs @@ -0,0 +1,46 @@ +namespace PocketBook; +public partial class ContentViewBook : ContentView +{ + + public static readonly BindableProperty BookNameProperty = + BindableProperty.Create(nameof(BookName), typeof(string), typeof(ContentViewBook), string.Empty); + + public static readonly BindableProperty AutorNameProperty = + BindableProperty.Create(nameof(AutorName), typeof(string), typeof(ContentViewBook), string.Empty); + + public static readonly BindableProperty BookStatusProperty = + BindableProperty.Create(nameof(BookStatus), typeof(string), typeof(ContentViewBook), string.Empty); + + public static readonly BindableProperty BookImageProperty = + BindableProperty.Create(nameof(BookImage), typeof(string), typeof(ContentViewBook), string.Empty); + + public string BookName + { + get { return (string)GetValue(BookNameProperty); } + set { SetValue(BookNameProperty, value); } + } + public string BookImage + { + get { return (string)GetValue(BookImageProperty); } + set { SetValue(BookImageProperty, value); } + } + + public string AutorName + { + get { return (string)GetValue(AutorNameProperty); } + set { SetValue(AutorNameProperty, value); } + } + public string BookStatus + { + get { return (string)GetValue(BookStatusProperty); } + set { SetValue(BookStatusProperty, value); } + } + public ContentViewBook() + { + InitializeComponent(); + bookName.SetBinding(Label.TextProperty, new Binding(nameof(BookName), source: this)); + autorName.SetBinding(Label.TextProperty, new Binding(nameof(AutorName), source: this)); + bookStatus.SetBinding(Label.TextProperty, new Binding(nameof(BookStatus), source: this)); + bookImage.SetBinding(Image.SourceProperty, new Binding(nameof(BookImage), source: this)); + } +} \ No newline at end of file diff --git a/sources/PocketBook/PocketBook.csproj b/sources/PocketBook/PocketBook.csproj index 7c83ab2..7cc7f9c 100644 --- a/sources/PocketBook/PocketBook.csproj +++ b/sources/PocketBook/PocketBook.csproj @@ -56,6 +56,12 @@ MSBuild:Compile + + MSBuild:Compile + + + MSBuild:Compile + MSBuild:Compile @@ -67,4 +73,6 @@ + + diff --git a/sources/PocketBook/Resources/Images/buveurencre.jpg b/sources/PocketBook/Resources/Images/buveurencre.jpg new file mode 100644 index 0000000..09a0a63 Binary files /dev/null and b/sources/PocketBook/Resources/Images/buveurencre.jpg differ diff --git a/sources/PocketBook/TousPage.xaml b/sources/PocketBook/TousPage.xaml index 69ea646..57b391e 100644 --- a/sources/PocketBook/TousPage.xaml +++ b/sources/PocketBook/TousPage.xaml @@ -14,46 +14,38 @@ - - - - - - - - - - - - - - - - - + + + + diff --git a/sources/PocketBook/TousPage.xaml.cs b/sources/PocketBook/TousPage.xaml.cs index 36bba43..6f35c6e 100644 --- a/sources/PocketBook/TousPage.xaml.cs +++ b/sources/PocketBook/TousPage.xaml.cs @@ -1,10 +1,58 @@ namespace PocketBook; +public partial class Book +{ + public string name { get; set; } + public string type { get; set; } + public string auteur { get; set; } + public string image { get; set; } + + public Book(string name, string type,string auteur) + { + this.name = name; + this.auteur = auteur; + this.type = type; + } +} + +public partial class Auteur +{ + public string name { get; set; } + public List books { get; set; } + + public Auteur(string name) + { + this.name = name; + books= new List(); + books.Add(new Book("Buveur d'encre", "En lecture",name)); + books.Add(new Book("Caca boudin", "En lecture", name)); + books.Add(new Book("Prout", "En lecture", name)); + books.Add(new Book("Benjamin", "En lecture", name)); + } +} + public partial class TousPage : ContentPage { + public List mesAuteurs { get; set; } + public List books { get; set; } + public TousPage() { + mesAuteurs = new List + { + new Auteur("Paul caca"), + new Auteur("Caca paul") + }; InitializeComponent(); + BindingContext=this; + } + public async void OnCollectionViewSelectionChanged(object sender, SelectionChangedEventArgs e) + { + Console.WriteLine("COUCOU"); + if (e.CurrentSelection.FirstOrDefault() is Book livreSelectionne) + { + await Navigation.PushAsync(new BookDetail(livreSelectionne)); + } } } \ No newline at end of file