Files
BookReader/BookReader/Views/BookshelfPage.xaml.cs
2026-02-14 16:45:01 +03:00

40 lines
1.1 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.ViewModels;
namespace BookReader.Views;
public partial class BookshelfPage : ContentPage
{
private readonly BookshelfViewModel _viewModel;
public BookshelfPage(BookshelfViewModel viewModel)
{
InitializeComponent();
_viewModel = viewModel;
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 DisplayActionSheet("Menu", "Cancel", null,
"⚙️ 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 DisplayAlert("About", "BookReader v1.0\nEPUB & FB2 Reader", "OK");
break;
}
}
}