clicking on stoplight prompts with option to liberate full library

This commit is contained in:
Robert McRackan 2019-12-31 10:04:55 -05:00
parent c7c1b4505b
commit a13e1f27bb
2 changed files with 13 additions and 5 deletions

View File

@ -13,7 +13,7 @@
<!-- <PublishSingleFile>true</PublishSingleFile> -->
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<Version>3.1.0.52</Version>
<Version>3.1.0.57</Version>
</PropertyGroup>
<ItemGroup>

View File

@ -174,15 +174,23 @@ namespace LibationWinForms
var productId = getGridEntry(e.RowIndex).GetBook().AudibleProductId;
// not liberated: liberate
if (!FileManager.AudibleFileStorage.Audio.Exists(productId))
await BookLiberation.ProcessorAutomationController.BackupSingleBookAsync(productId, (_, __) => RefreshRow(productId));
// liberated: open explorer to file
else
if (FileManager.AudibleFileStorage.Audio.Exists(productId))
{
var filePath = FileManager.AudibleFileStorage.Audio.GetPath(productId);
System.Diagnostics.Process.Start("explorer.exe", $"/select, \"{filePath}\"");
return;
}
// not liberated: liberate
var msg
= "Liberate entire library instead?"
+ "\r\n\r\nClick Yes to begin liberating your entire library"
+ "\r\n\r\nClick No to liberate this book only";
if (MessageBox.Show(msg, "Liberate entire library?", MessageBoxButtons.YesNo) == DialogResult.Yes)
await BookLiberation.ProcessorAutomationController.BackupAllBooksAsync((_, libraryBook) => RefreshRow(libraryBook.Book.AudibleProductId));
else
await BookLiberation.ProcessorAutomationController.BackupSingleBookAsync(productId, (_, __) => RefreshRow(productId));
}
#endregion