Changes discussed in email

This commit is contained in:
Michael Bucari-Tovo 2022-05-16 14:27:34 -06:00
parent 109ce0dd1f
commit 843fddabde
6 changed files with 90 additions and 58 deletions

View file

@ -42,6 +42,8 @@ namespace LibationWinForms.ProcessQueue
public bool Running => !QueueRunner?.IsCompleted ?? false;
public ToolStripButton popoutBtn = new();
private System.Threading.SynchronizationContext syncContext { get; } = System.Threading.SynchronizationContext.Current;
public ProcessQueueControl()
{
InitializeComponent();
@ -122,12 +124,13 @@ namespace LibationWinForms.ProcessQueue
private void AddToQueue(ProcessBook pbook)
{
BeginInvoke(() =>
syncContext.Post(_ =>
{
Queue.Enqueue(pbook);
if (!Running)
QueueRunner = QueueLoop();
});
},
null);
}
DateTime StartintTime;
@ -264,7 +267,7 @@ namespace LibationWinForms.ProcessQueue
var proc = Queue[queueIndex];
Panels[i].Invoke(() =>
syncContext.Send(_ =>
{
Panels[i].SuspendLayout();
if (propertyName is null || propertyName == nameof(proc.Cover))
@ -285,7 +288,7 @@ namespace LibationWinForms.ProcessQueue
if (propertyName is null || propertyName == nameof(proc.TimeRemaining))
Panels[i].SetRemainingTime(proc.TimeRemaining);
Panels[i].ResumeLayout();
});
}, null);
}
private void UpdateAllControls()