Prevent GCode load during slicing

- Issue MatterHackers/MCCentral#5453
Crash after switching to 3D GCode view while slicing
This commit is contained in:
jlewin 2019-05-06 16:03:13 -07:00
parent 75fb57b805
commit 4d345c73ee
3 changed files with 7 additions and 0 deletions

View file

@ -2606,6 +2606,8 @@ namespace MatterHackers.MatterControl
// Slice
bool slicingSucceeded = false;
printer.ViewState.SlicingItem = true;
await this.Tasks.Execute("Slicing".Localize(), printer, async (reporter, cancellationToken) =>
{
slicingSucceeded = await Slicer.SliceItem(
@ -2616,6 +2618,8 @@ namespace MatterHackers.MatterControl
cancellationToken);
});
printer.ViewState.SlicingItem = false;
// Skip loading GCode output if slicing failed
if (!slicingSucceeded)
{

View file

@ -369,6 +369,7 @@ namespace MatterHackers.MatterControl
internal void EnsureGCodeLoaded()
{
if (this.LoadedGCode == null
&& !this.Printer.ViewState.SlicingItem
&& File.Exists(this.EditContext?.GCodeFilePath(this.Printer)))
{
UiThread.RunOnIdle(async () =>

View file

@ -185,5 +185,7 @@ namespace MatterHackers.MatterControl
UserSettings.Instance.set(UserSettingsKey.SelectedObjectPanelWidth, minimumValue.ToString());
}
}
public bool SlicingItem { get; set; }
}
}