diff --git a/sources/MyToolkitMVVM/BaseViewModel.cs b/sources/MyToolkitMVVM/BaseViewModel.cs index e7e2879..f35d2a7 100644 --- a/sources/MyToolkitMVVM/BaseViewModel.cs +++ b/sources/MyToolkitMVVM/BaseViewModel.cs @@ -4,7 +4,10 @@ namespace MyToolkitMVVM public class BaseViewModel : ObservableObject { - public TModel Model { get; private set; } + public TModel Model { + get => model; + set => SetProperty(ref model,value); + } private TModel model; public BaseViewModel(TModel model) diff --git a/sources/MyToolkitMVVM/RelayCommand.cs b/sources/MyToolkitMVVM/RelayCommand.cs index 924acd4..88a9e8a 100644 --- a/sources/MyToolkitMVVM/RelayCommand.cs +++ b/sources/MyToolkitMVVM/RelayCommand.cs @@ -27,7 +27,25 @@ namespace MyToolkitMVVM { execute((T)parameter); } + } + public class RelayCommand : RelayCommand + { + public RelayCommand(Action execute, Func canExecute = null) + : base(execute, canExecute) + { + } + /* public async Task CanExecuteAsync(object? parameter) + { + if (parameter == null) + return true; + return await CanExecuteInternalAsync((T)parameter); + }*/ + + public async Task Execute() + { + await Execute(); + } } } diff --git a/sources/PocketBook/AppShell.xaml.cs b/sources/PocketBook/AppShell.xaml.cs index a4998b7..7a80cbc 100644 --- a/sources/PocketBook/AppShell.xaml.cs +++ b/sources/PocketBook/AppShell.xaml.cs @@ -4,16 +4,15 @@ public partial class AppShell : Shell { public AppShell() { - Routing.RegisterRoute("MainPage/TousPage",typeof(TousPage)); - Routing.RegisterRoute("MainPage/StatutPage", typeof(StatutPage)); - Routing.RegisterRoute("MainPage/SharePage", typeof(SharePage)); - Routing.RegisterRoute("MainPage/LaterPage", typeof(SharePage)); - Routing.RegisterRoute("MainPage/LikePage", typeof(LikePage)); - Routing.RegisterRoute("MainPage/Auteur", typeof(SharePage)); - Routing.RegisterRoute("MainPage/DatePublic", typeof(DatePublic)); - Routing.RegisterRoute("MainPage/MarkPage", typeof(MarkPage)); - - Routing.RegisterRoute("MainPage/TousPage/BookDetail", typeof(BookDetail)); + Routing.RegisterRoute("TousPage",typeof(TousPage)); + Routing.RegisterRoute("StatutPage", typeof(StatutPage)); + Routing.RegisterRoute("SharePage", typeof(SharePage)); + Routing.RegisterRoute("LaterPage", typeof(SharePage)); + Routing.RegisterRoute("LikePage", typeof(LikePage)); + Routing.RegisterRoute("Auteur", typeof(SharePage)); + Routing.RegisterRoute("DatePublic", typeof(DatePublic)); + Routing.RegisterRoute("MarkPage", typeof(MarkPage)); + Routing.RegisterRoute("BookDetail", typeof(BookDetail)); InitializeComponent(); } } diff --git a/sources/PocketBook/Applicative_VM/NavigatorVM.cs b/sources/PocketBook/Applicative_VM/NavigatorVM.cs index ccc8a50..42dceee 100644 --- a/sources/PocketBook/Applicative_VM/NavigatorVM.cs +++ b/sources/PocketBook/Applicative_VM/NavigatorVM.cs @@ -8,11 +8,17 @@ namespace PocketBook.Applicative_VM public class NavigatorVM { public ICommand Navigateto { get; private set; } + public ICommand SeeDetailPage { get; private set; } + public NavigatorVM() { Navigateto = new Command( async (string page) => await Shell.Current.GoToAsync(page) ); + + SeeDetailPage = new Command( + async () => await Shell.Current.GoToAsync("BookDetail") + ); } } } diff --git a/sources/PocketBook/Applicative_VM/ScanMenuVM.cs b/sources/PocketBook/Applicative_VM/ScanMenuVM.cs index 739fb13..15b1e0e 100644 --- a/sources/PocketBook/Applicative_VM/ScanMenuVM.cs +++ b/sources/PocketBook/Applicative_VM/ScanMenuVM.cs @@ -16,11 +16,8 @@ namespace PocketBook.Applicative_VM public bool ScanMenuIsVisible { - get { return scanMenuIsVisible; } - set - { - SetProperty(ref scanMenuIsVisible,value); - } + get => scanMenuIsVisible; + set => SetProperty(ref scanMenuIsVisible,value); } public ScanMenuVM() diff --git a/sources/PocketBook/MauiProgram.cs b/sources/PocketBook/MauiProgram.cs index d8ede8c..268316d 100644 --- a/sources/PocketBook/MauiProgram.cs +++ b/sources/PocketBook/MauiProgram.cs @@ -1,6 +1,9 @@ using Microsoft.Extensions.Logging; using CommunityToolkit.Maui; using PocketBook.Applicative_VM; +using ViewModel; +using StubLib; +using Model; namespace PocketBook; @@ -39,6 +42,8 @@ public static class MauiProgram }); builder.Services + .AddSingleton() + .AddSingleton() .AddSingleton() .AddSingleton() .AddSingleton() @@ -49,6 +54,7 @@ public static class MauiProgram .AddSingleton() .AddSingleton() .AddSingleton() + .AddSingleton() .AddSingleton() .AddSingleton() ; diff --git a/sources/PocketBook/Pages/Composants/ContentView/ContentViewBook.xaml b/sources/PocketBook/Pages/Composants/ContentView/ContentViewBook.xaml index 1966585..33cf6ac 100644 --- a/sources/PocketBook/Pages/Composants/ContentView/ContentViewBook.xaml +++ b/sources/PocketBook/Pages/Composants/ContentView/ContentViewBook.xaml @@ -15,7 +15,7 @@