40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
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;
|
||
}
|
||
}
|
||
} |