Moved event logging to LibationBaseForm

This commit is contained in:
Mbucari 2021-09-23 19:29:25 -06:00
parent 803a0b7ccf
commit 71075838eb
10 changed files with 61 additions and 63 deletions

View file

@ -21,6 +21,8 @@ namespace LibationWinForms.BookLiberation
#region IProcessable event handler overrides
public override void OnBegin(object sender, LibraryBook libraryBook)
{
base.OnBegin(sender, libraryBook);
GetCoverArtDelegate = () => FileManager.PictureStorage.GetPictureSynchronously(
new FileManager.PictureDefinition(
libraryBook.Book.PictureId,
@ -41,6 +43,7 @@ namespace LibationWinForms.BookLiberation
#region IStreamable event handler overrides
public override void OnStreamingProgressChanged(object sender, DownloadProgress downloadProgress)
{
base.OnStreamingProgressChanged(sender, downloadProgress);
if (!downloadProgress.ProgressPercentage.HasValue)
return;
@ -51,16 +54,23 @@ namespace LibationWinForms.BookLiberation
}
public override void OnStreamingTimeRemaining(object sender, TimeSpan timeRemaining)
=> updateRemainingTime((int)timeRemaining.TotalSeconds);
{
base.OnStreamingTimeRemaining(sender, timeRemaining);
updateRemainingTime((int)timeRemaining.TotalSeconds);
}
#endregion
#region IAudioDecodable event handlers
public override void OnRequestCoverArt(object sender, Action<byte[]> setCoverArtDelegate)
=> setCoverArtDelegate(GetCoverArtDelegate?.Invoke());
{
base.OnRequestCoverArt(sender, setCoverArtDelegate);
setCoverArtDelegate(GetCoverArtDelegate?.Invoke());
}
public override void OnTitleDiscovered(object sender, string title)
{
base.OnTitleDiscovered(sender, title);
this.UIThreadAsync(() => this.Text = DecodeActionName + " " + title);
this.title = title;
updateBookInfo();
@ -68,18 +78,23 @@ namespace LibationWinForms.BookLiberation
public override void OnAuthorsDiscovered(object sender, string authors)
{
base.OnAuthorsDiscovered(sender, authors);
authorNames = authors;
updateBookInfo();
}
public override void OnNarratorsDiscovered(object sender, string narrators)
{
base.OnNarratorsDiscovered(sender, narrators);
narratorNames = narrators;
updateBookInfo();
}
public override void OnCoverImageDiscovered(object sender, byte[] coverArt)
=> pictureBox1.UIThreadAsync(() => pictureBox1.Image = Dinah.Core.Drawing.ImageReader.ToImage(coverArt));
public override void OnCoverImageDiscovered(object sender, byte[] coverArt)
{
base.OnCoverImageDiscovered(sender, coverArt);
pictureBox1.UIThreadAsync(() => pictureBox1.Image = Dinah.Core.Drawing.ImageReader.ToImage(coverArt));
}
#endregion
// thread-safe UI updates