master
Enzo 2 years ago
parent 8143826786
commit 3e74322c14

Binary file not shown.

Binary file not shown.

@ -3,7 +3,7 @@
<PropertyGroup>
<IsFirstTimeProjectOpen>False</IsFirstTimeProjectOpen>
<ActiveDebugFramework>net7.0-android</ActiveDebugFramework>
<ActiveDebugProfile>Samsung SM-A705FN (Android 11.0 - API 30)</ActiveDebugProfile>
<ActiveDebugProfile>Émulateur Android</ActiveDebugProfile>
<SelectedPlatformGroup>PhysicalDevice</SelectedPlatformGroup>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetPlatformIdentifier)'=='iOS'">

@ -4,10 +4,11 @@ namespace MVVM.Pages;
public partial class MyLibraryPage : ContentPage
{
public NavigationViewModel navigationViewModel { get; set;} = new NavigationViewModel();
public NavigateAndLoadBooks navigationViewModel { get; set;}
public MyLibraryPage()
public MyLibraryPage(NavigateAndLoadBooks navigateAndLoadBooks)
{
this.navigationViewModel = navigateAndLoadBooks;
InitializeComponent();
BindingContext = this;
}

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Wrapper;
namespace MVVM.VmApplicatif
{
public class NavigateAndLoadBooks
{
NavigationViewModel NavigateViewModel { get; set; }
BookViewModel BookViewModel { get; set; }
public NavigateAndLoadBooks(NavigationViewModel navigateViewModel, BookViewModel bookViewModel)
{
this.NavigateViewModel = navigateViewModel;
this.BookViewModel = bookViewModel;
}
}
}

@ -5,6 +5,7 @@ using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace ToolKit
{
@ -12,10 +13,25 @@ namespace ToolKit
{
public event PropertyChangedEventHandler? PropertyChanged;
protected void NotifyPropertyChange([CallerMemberName] string name = null )
private void NotifyPropertyChange(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
protected virtual void setProperty<T>(T member, T value, Action action, [CallerMemberName] string propertyName = "")
{
OnPropertyChanged();
if (EqualityComparer<T>.Default.Equals(member, value)) { return; }
member = value;
action();
NotifyPropertyChange(propertyName);
}
protected virtual void setProperty<T>(ref T member, T value, [CallerMemberName] string propertyName = "")
{
if (EqualityComparer<T>.Default.Equals(member, value)) { return; }
member = value;
NotifyPropertyChange(propertyName);
}
}
}

@ -1,6 +1,7 @@
using Model;
using Model.Group;
using System.Collections.ObjectModel;
using System.Reflection.Metadata.Ecma335;
using System.Xml.Linq;
using ToolKit;
@ -10,95 +11,58 @@ namespace Wrapper
{
ILibraryManager LibraryManager { get; set; }
private string _valeurTmp { get; set; }
public string ValeurTmp
/*
public ReadOnlyObservableCollection<Book> Books { get; set; }
private ReadOnlyObservableCollection<Book> books
{
get => _valeurTmp;
get => Books;
set
{
if (string.Equals(_valeurTmp, value)) return;
_valeurTmp = value;
NotifyPropertyChange();
if (value == null) { return; }
setProperty(books, value);
}
}
}*/
public ObservableCollection<GroupeLivre> listeGroupLivre { get; set; } = new ObservableCollection<GroupeLivre>();
public BookViewModel(ILibraryManager _libraryManager)
{
this.LibraryManager = _libraryManager;
getLivre();
}
public void getBooks()
{
//LibraryManager.GetBooksByAuthor();
public int Index {
get { return index; }
private set
{
setProperty(ref index, value);
}
}
private int index;
private void getLivre()
{
/*
LibraryManager.
listeGroupLivre.Clear();
foreach (var item in LibraryManager.GetBooksByAuthor)
public int Count
{
get { return count; }
private set
{
listeGroupLivre.Add(item);
}*/
/*
listeGroupLivre.Add(new GroupeLivre("Eiichirō Oda",
new List<Livre> {
new Livre { Auteur = "Eiichirō Oda",
Titre = "One piece tome 1",
Note ="5",
Statut = "Lu",
Image = "onepiece1"},
new Livre { Auteur = "Eiichirō Oda",
Titre = "One piece tome 2",
Note = "4",
Statut = "Lu",
Image = "onepiece2",
Separateur = false}}));
setProperty(ref count, value);
}
}
private int count;
listeGroupLivre.Add(new GroupeLivre("Tite Kubo",
new List<Livre>
{
new Livre { Auteur = "Tite Kubo",
Titre = "Bleach tome 1",
Note = "3",
Statut = "Lu",
Image = "bleach1",
Separateur = false}
}));
listeGroupLivre.Add(new GroupeLivre("Masashi Kishimoto", new List<Livre> {
new Livre { Auteur = "Masashi Kishimoto",
Titre = "Naruto tome 1",
Note = "5",
Statut = "Lu",
Image = "naruto1"},
new Livre { Auteur = "Masashi Kishimoto",
Titre = "Naruto tome 2",
Note = "2",
Statut = "Lu",
Image = "naruto2"},
new Livre
{
Auteur = "Masashi Kishimoto",
Titre = "Naruto tome 3",
Note = "3",
Statut = "Lu",
Image = "naruto3",
Separateur = false
}}));*/
public int NbBook
{
get { return nbBook; }
private set
{
setProperty(ref nbBook, value);
}
}
private int nbBook;
}
}
Loading…
Cancel
Save