Merge branch 'fix-bugs-22-10'

stars-notation-22-10
Lou BRODA 1 year ago
commit 150487b6fe

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

@ -102,6 +102,9 @@
<toolkit:IconTintColorBehavior TintColor="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}"/>
</Image.Behaviors>
</Image>
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding DetailsLivreVM.OpenInfoCommand}"/>
</Grid.GestureRecognizers>
</Grid>
<contentView:SeparatorCutStartView/>
@ -178,7 +181,7 @@
<Label Text="Résumé"
Style="{StaticResource DetailsLivreTitle}"
Grid.Row="0"/>
<Label Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Et malesuada fames ac turpis egestas integer eget aliquet. Nunc sed id semper risus. Nisl purus in mollis nunc sed id semper risus. Egestas congue quisque egestas diam in arcu cursus euismod. Elementum integer enim neque volutpat ac tincidunt vitae. Amet luctus venenatis lectus magna fringilla urna porttitor rhoncus dolor. Sollicitudin tempor id eu nisl nunc. Eget mauris pharetra et ultrices neque. In vitae turpis massa sed elementum tempus. Posuere ac ut consequat semper viverra nam. Quisque non tellus orci ac auctor augue mauris augue. Cursus in hac habitasse platea dictumst. Pellentesque diam volutpat commodo sed egestas egestas fringilla phasellus faucibus. Vel fringilla est ullamcorper eget nulla facilisi etiam."
<Label Text="{Binding DetailsLivreVM.Book.WorkDescription}"
Style="{StaticResource DetailsLivreBody}"
Grid.Row="1"/>
</Grid>

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

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

@ -77,6 +77,8 @@ namespace LivreLand.ViewModel
public ICommand RemoveBookCommand { get; private set; }
public ICommand OpenInfoCommand { get; private set; }
#endregion
#region Constructor
@ -92,6 +94,7 @@ namespace LivreLand.ViewModel
AddBookToReadListCommand = new RelayCommand<BookVM>((bookVM) => AddBookToReadList(bookVM));
LoanBookCommand = new RelayCommand<BookVM>((bookVM) => LoanBook(bookVM));
RemoveBookCommand = new RelayCommand<BookVM>((bookVM) => RemoveBook(bookVM));
OpenInfoCommand = new RelayCommand(() => OpenInfo());
}
#endregion
@ -106,7 +109,7 @@ namespace LivreLand.ViewModel
private void ShowPicker()
{
Manager.GetAllStatusCommand.Execute(null);
Manager.SelectedStatus = this.Book.Status;
Manager.SelectedStatus = Book.Status;
IsPickerVisible = true;
}
@ -167,6 +170,13 @@ namespace LivreLand.ViewModel
Navigator.PopupBackButtonNavigationCommand.Execute(null);
}
private async Task OpenInfo()
{
var isbn = Manager.SelectedBook.ISBN13;
string url = "https://openlibrary.org/isbn/" + isbn;
await Launcher.OpenAsync(url);
}
#endregion
}
}

@ -1,9 +1,11 @@
using PersonalMVVMToolkit;
using LivreLand.View;
using PersonalMVVMToolkit;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using ViewModels;
namespace LivreLand.ViewModel
@ -16,6 +18,8 @@ namespace LivreLand.ViewModel
public ManagerVM Manager { get; private set; }
public ICommand OnSelectionChangedCommand { get; private set; }
#endregion
#region Constructor
@ -24,6 +28,20 @@ namespace LivreLand.ViewModel
{
Navigator = navigatorVM;
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

@ -42,6 +42,13 @@ namespace ViewModels
get => Model.PublishDate;
}
public List<WorkVM> Works
{
get => Model.Works.Select(w => new WorkVM(w)).ToList();
}
public string WorkDescription => Model.Works.Count > 0 ? Model.Works.First().Description : " ";
public List<AuthorVM> Authors
{
get => Model.Authors.Select(a => new AuthorVM(a)).ToList();
@ -52,6 +59,7 @@ namespace ViewModels
public Status Status
{
get => Model.Status;
set => SetProperty(Model.Status, value, status => Model.Status = status);
}
public int NbPages

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

@ -0,0 +1,42 @@
using Model;
using PersonalMVVMToolkit;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ViewModels
{
public class WorkVM : BaseViewModel<Work>
{
#region Fields
#endregion
#region Properties
public string Id
{
get => Model.Id;
set => SetProperty(Model.Id, value, v => Model.Id = value);
}
public string Description
{
get => Model.Description;
set => SetProperty(Model.Description, value, v => Model.Description = value);
}
#endregion
#region Constructor
public WorkVM(Work w) : base(w)
{
}
#endregion
}
}
Loading…
Cancel
Save