ADD : Changement Status Working + Navigation Status bug fixed

fix-bugs-22-10
Lou BRODA 1 year ago
parent bb53472775
commit c63ed977fa

@ -28,5 +28,7 @@
</array> </array>
<key>XSAppIconAssets</key> <key>XSAppIconAssets</key>
<string>Assets.xcassets/appicon.appiconset</string> <string>Assets.xcassets/appicon.appiconset</string>
<key>NSCameraUsageDescription</key>
<string>This app uses camera for scanning barcodes</string>
</dict> </dict>
</plist> </plist>

@ -42,8 +42,10 @@
Grid.Column="1"/> Grid.Column="1"/>
</Grid> </Grid>
<CollectionView ItemsSource="{Binding FavorisVM.Manager.AllFavoriteBooks}" <CollectionView ItemsSource="{Binding FavorisVM.Manager.AllFavoriteBooks}"
SelectedItem="{Binding FavorisVM.Manager.SelectedBook}"
SelectionMode="Single" SelectionMode="Single"
SelectionChanged="OnSelectionChanged" SelectionChangedCommand="{Binding FavorisVM.OnSelectionChangedCommand}"
SelectionChangedCommandParameter="{Binding FavorisVM.Manager.SelectedBook}"
Grid.Row="2"> Grid.Row="2">
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate x:DataType="viewModel:BookVM"> <DataTemplate x:DataType="viewModel:BookVM">

@ -24,10 +24,5 @@ public partial class FavorisView : ContentPage
#region Methods #region Methods
void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
//App.Current.MainPage.Navigation.PushAsync(new DetailsLivreView());
}
#endregion #endregion
} }

@ -106,7 +106,7 @@ namespace LivreLand.ViewModel
private void ShowPicker() private void ShowPicker()
{ {
Manager.GetAllStatusCommand.Execute(null); Manager.GetAllStatusCommand.Execute(null);
Manager.SelectedStatus = this.Book.Status; Manager.SelectedStatus = Book.Status;
IsPickerVisible = true; IsPickerVisible = true;
} }

@ -1,9 +1,11 @@
using PersonalMVVMToolkit; using LivreLand.View;
using PersonalMVVMToolkit;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using ViewModels; using ViewModels;
namespace LivreLand.ViewModel namespace LivreLand.ViewModel
@ -16,6 +18,8 @@ namespace LivreLand.ViewModel
public ManagerVM Manager { get; private set; } public ManagerVM Manager { get; private set; }
public ICommand OnSelectionChangedCommand { get; private set; }
#endregion #endregion
#region Constructor #region Constructor
@ -24,6 +28,20 @@ namespace LivreLand.ViewModel
{ {
Navigator = navigatorVM; Navigator = navigatorVM;
Manager = managerVM; Manager = managerVM;
OnSelectionChangedCommand = new RelayCommand<BookVM>((bookVM) => OnSelectionChanged(bookVM));
}
#endregion
#region Methods
private void OnSelectionChanged(BookVM bookVM)
{
if (bookVM != null)
{
var result = new DetailsLivreVM(Manager, Navigator, bookVM);
App.Current.MainPage.Navigation.PushAsync(new DetailsLivreView(result));
}
} }
#endregion #endregion

@ -52,6 +52,7 @@ namespace ViewModels
public Status Status public Status Status
{ {
get => Model.Status; get => Model.Status;
set => SetProperty(Model.Status, value, status => Model.Status = status);
} }
public int NbPages public int NbPages

@ -487,8 +487,8 @@ namespace ViewModels
book.Status = SelectedStatus; book.Status = SelectedStatus;
await Model.UpdateBook(book); await Model.UpdateBook(book);
var updatedBook = new BookVM(book); var updatedBook = new BookVM(book);
bookVM = updatedBook; SelectedBook.Status = updatedBook.Status;
OnPropertyChanged(nameof(bookVM)); OnPropertyChanged(nameof(SelectedBook));
} }
private async Task UpdateToBeReadBook(BookVM bookVM) private async Task UpdateToBeReadBook(BookVM bookVM)

Loading…
Cancel
Save