qwen edit
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user