Files
BookReader/BookReader/Views/BookshelfPage.xaml.cs
Курнат Андрей 1d9224a025 qwen edit
2026-02-18 14:36:57 +03:00

43 lines
1.4 KiB
C#
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using BookReader.Services;
using BookReader.ViewModels;
namespace BookReader.Views;
public partial class BookshelfPage : ContentPage
{
private readonly BookshelfViewModel _viewModel;
private readonly INavigationService _navigationService;
public BookshelfPage(BookshelfViewModel viewModel, INavigationService navigationService, ICachedImageLoadingService imageLoadingService)
{
InitializeComponent();
_viewModel = viewModel;
_navigationService = navigationService;
BindingContext = viewModel;
}
protected override async void OnAppearing()
{
base.OnAppearing();
await _viewModel.LoadBooksCommand.ExecuteAsync(null);
}
private async void OnMenuClicked(object? sender, EventArgs e)
{
var action = await _navigationService.DisplayActionSheetAsync("Menu", "Cancel",
"⚙️ Settings", "☁️ Calibre Library", " About");
switch (action)
{
case "⚙️ Settings":
await _viewModel.OpenSettingsCommand.ExecuteAsync(null);
break;
case "☁️ Calibre Library":
await _viewModel.OpenCalibreLibraryCommand.ExecuteAsync(null);
break;
case " About":
await _navigationService.DisplayAlertAsync("About", "BookReader v1.0\nEPUB & FB2 Reader", "OK");
break;
}
}
}