Made to so we save all workspaces before exit
issue: MatterHackers/MCCentral#4318 Part tab fails to persist on close
This commit is contained in:
parent
249275ea98
commit
d2f6dcf8bc
5 changed files with 30 additions and 14 deletions
|
|
@ -1547,7 +1547,7 @@ namespace MatterHackers.MatterControl
|
|||
return mappedEditors;
|
||||
}
|
||||
|
||||
internal void Shutdown()
|
||||
public void Shutdown()
|
||||
{
|
||||
// Ensure all threads shutdown gracefully on close
|
||||
|
||||
|
|
@ -1757,13 +1757,6 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
this.Thumbnails.Shutdown();
|
||||
|
||||
// Save changes before close
|
||||
if (this.ActivePrinter != null
|
||||
&& this.ActivePrinter != PrinterConfig.EmptyPrinter)
|
||||
{
|
||||
await this.ActivePrinter.Bed.SaveChanges(null, CancellationToken.None);
|
||||
}
|
||||
|
||||
ApplicationSettings.Instance.ReleaseClientToken();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -289,12 +289,34 @@ namespace MatterHackers.MatterControl
|
|||
StyledMessageBox.MessageType.YES_NO_WITHOUT_HIGHLIGHT);
|
||||
});
|
||||
}
|
||||
else
|
||||
else if(!ApplicationController.Instance.ApplicationExiting)
|
||||
{
|
||||
ApplicationController.Instance.ApplicationExiting = true;
|
||||
// Make sure we tell the Application Controller to shut down. This will release the slicing thread if running.
|
||||
ApplicationController.Instance.Shutdown();
|
||||
// cancel the close so that we can save all our active work spaces
|
||||
eventArgs.Cancel = true;
|
||||
|
||||
UiThread.RunOnIdle(async () =>
|
||||
{
|
||||
var application = ApplicationController.Instance;
|
||||
// Save changes before close
|
||||
if (application.ActivePrinter != null
|
||||
&& application.ActivePrinter != PrinterConfig.EmptyPrinter)
|
||||
{
|
||||
await application.Tasks.Execute("Saving Print Bed".Localize() + "...", application.ActivePrinter.Bed.SaveChanges);
|
||||
}
|
||||
|
||||
foreach (var workspace in application.Workspaces)
|
||||
{
|
||||
await application.Tasks.Execute("Saving Print Bed".Localize() + "...", workspace.SceneContext.SaveChanges);
|
||||
}
|
||||
|
||||
application.ApplicationExiting = true;
|
||||
// Make sure we tell the Application Controller to shut down. This will release the slicing thread if running.
|
||||
application.Shutdown();
|
||||
this.CloseOnIdle();
|
||||
});
|
||||
}
|
||||
|
||||
// we are exiting and have finished saving
|
||||
}
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ namespace MatterHackers.MatterControl
|
|||
config.Bind("Agg:GraphicsMode", AggContext.Config.GraphicsMode);
|
||||
|
||||
Slicer.RunInProcess = config.GetValue<bool>("MatterControl:Slicer:Debug");
|
||||
Slicer.RunInProcess = true;
|
||||
|
||||
// Make sure we have the right working directory as we assume everything relative to the executable.
|
||||
Directory.SetCurrentDirectory(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location));
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit fafbca2512fb34724eca996fc3fe4ba489b27ae7
|
||||
Subproject commit ac9ff0914ad8b0a2c379ef47657f051f4e1edfa0
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 7af8c7cde04feba99adf51d85ac90d413bd7992b
|
||||
Subproject commit 190c148a7494d0a13ee318f5f3a80dc9f6989e61
|
||||
Loading…
Add table
Add a link
Reference in a new issue