Change from background workers to async functions
Made the SlicingOutputMessage and SlicingDone events not rooted (as print item wrappers aren't)
This commit is contained in:
parent
f4c63cba58
commit
4dbc03edb8
15 changed files with 163 additions and 209 deletions
|
|
@ -89,8 +89,6 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
itemCountBeingWorkedOn = 0;
|
||||
}
|
||||
|
||||
private EventHandler unregisterEvents;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if (allFilesToExport.Count > 0)
|
||||
|
|
@ -108,8 +106,8 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
if (MeshFileIo.ValidFileExtensions().Contains(extension))
|
||||
{
|
||||
SlicingQueue.Instance.QueuePartForSlicing(printItemWrapper);
|
||||
printItemWrapper.SlicingDone.RegisterEvent(sliceItem_Done, ref unregisterEvents);
|
||||
printItemWrapper.SlicingOutputMessage.RegisterEvent(printItemWrapper_SlicingOutputMessage, ref unregisterEvents);
|
||||
printItemWrapper.SlicingDone += sliceItem_Done;
|
||||
printItemWrapper.SlicingOutputMessage += printItemWrapper_SlicingOutputMessage;
|
||||
}
|
||||
else if (Path.GetExtension(part.FileLocation).ToUpper() == ".GCODE")
|
||||
{
|
||||
|
|
@ -132,8 +130,9 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
{
|
||||
PrintItemWrapper sliceItem = (PrintItemWrapper)sender;
|
||||
|
||||
sliceItem.SlicingDone.UnregisterEvent(sliceItem_Done, ref unregisterEvents);
|
||||
sliceItem.SlicingOutputMessage.UnregisterEvent(printItemWrapper_SlicingOutputMessage, ref unregisterEvents);
|
||||
sliceItem.SlicingDone -= sliceItem_Done;
|
||||
sliceItem.SlicingOutputMessage -= printItemWrapper_SlicingOutputMessage;
|
||||
|
||||
if (File.Exists(sliceItem.FileLocation))
|
||||
{
|
||||
savedGCodeFileNames.Add(sliceItem.GetGCodePathAndFileName());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue