qwen edit

This commit is contained in:
Курнат Андрей
2026-02-18 14:21:53 +03:00
parent 55c620f5a3
commit 8cb459c832
21 changed files with 287 additions and 125 deletions

View File

@@ -12,6 +12,7 @@ public partial class CalibreLibraryViewModel : BaseViewModel
private readonly IBookParserService _bookParserService;
private readonly IDatabaseService _databaseService;
private readonly ISettingsService _settingsService;
private readonly INavigationService _navigationService;
public ObservableCollection<CalibreBook> Books { get; } = new();
@@ -30,12 +31,14 @@ public partial class CalibreLibraryViewModel : BaseViewModel
ICalibreWebService calibreWebService,
IBookParserService bookParserService,
IDatabaseService databaseService,
ISettingsService settingsService)
ISettingsService settingsService,
INavigationService navigationService)
{
_calibreWebService = calibreWebService;
_bookParserService = bookParserService;
_databaseService = databaseService;
_settingsService = settingsService;
_navigationService = navigationService;
Title = "Calibre Library";
}
@@ -73,7 +76,7 @@ public partial class CalibreLibraryViewModel : BaseViewModel
}
catch (Exception ex)
{
await Shell.Current.DisplayAlert("Error", $"Failed to load library: {ex.Message}", "OK");
await _navigationService.DisplayAlertAsync("Error", $"Failed to load library: {ex.Message}", "OK");
}
finally
{
@@ -136,11 +139,11 @@ public partial class CalibreLibraryViewModel : BaseViewModel
await _databaseService.UpdateBookAsync(book);
DownloadStatus = "Download complete!";
await Shell.Current.DisplayAlert("Success", $"\"{calibreBook.Title}\" has been added to your library.", "OK");
await _navigationService.DisplayAlertAsync("Success", $"\"{calibreBook.Title}\" has been added to your library.", "OK");
}
catch (Exception ex)
{
await Shell.Current.DisplayAlert("Error", $"Failed to download: {ex.Message}", "OK");
await _navigationService.DisplayAlertAsync("Error", $"Failed to download: {ex.Message}", "OK");
}
finally
{
@@ -152,6 +155,6 @@ public partial class CalibreLibraryViewModel : BaseViewModel
[RelayCommand]
public async Task OpenSettingsAsync()
{
await Shell.Current.GoToAsync("settings");
await _navigationService.GoToAsync("settings");
}
}