More process control refinements

This commit is contained in:
Michael Bucari-Tovo 2021-08-11 21:07:07 -06:00
parent 687591e08e
commit 1c239dc546
8 changed files with 30 additions and 94 deletions

View file

@ -19,9 +19,9 @@ namespace LibationWinForms.BookLiberation
private string narratorNames;
#region ProcessBaseForm overrides
public override void SetProcessable(IStreamable streamProcessable, Action<string> infoLog)
public override void SetProcessable(IStreamable streamProcessable, LogMe logMe)
{
base.SetProcessable(streamProcessable, infoLog);
base.SetProcessable(streamProcessable, logMe);
if (Streamable is not null && Streamable is IAudioDecodable audioDecodable)
{
@ -35,7 +35,6 @@ namespace LibationWinForms.BookLiberation
Disposed += OnUnsubscribeAll;
}
}
#endregion

View file

@ -8,10 +8,10 @@ namespace LibationWinForms.BookLiberation
{
public class ProcessBaseForm : StreamBaseForm
{
protected Action<string> InfoLogAction { get; private set; }
public virtual void SetProcessable(IStreamable streamable, Action<string> infoLog)
protected LogMe LogMe { get; private set; }
public virtual void SetProcessable(IStreamable streamable, LogMe logMe)
{
InfoLogAction = infoLog;
LogMe = logMe;
SetStreamable(streamable);
if (Streamable is not null && Streamable is IProcessable processable)
@ -38,9 +38,9 @@ namespace LibationWinForms.BookLiberation
}
#region IProcessable event handlers
public virtual void OnBegin(object sender, LibraryBook libraryBook) => InfoLogAction($"Begin: {libraryBook.Book}");
public virtual void OnStatusUpdate(object sender, string statusUpdate) => InfoLogAction("- " + statusUpdate);
public virtual void OnCompleted(object sender, LibraryBook libraryBook) => InfoLogAction($"Completed: {libraryBook.Book}{Environment.NewLine}");
public virtual void OnBegin(object sender, LibraryBook libraryBook) => LogMe.Info($"Begin: {libraryBook.Book}");
public virtual void OnStatusUpdate(object sender, string statusUpdate) => LogMe.Info("- " + statusUpdate);
public virtual void OnCompleted(object sender, LibraryBook libraryBook) => LogMe.Info($"Completed: {libraryBook.Book}{Environment.NewLine}");
#endregion
}
}