Persist user workspaces on signout, guest workspaces on signin
- Issue MatterHackers/MCCentral#4699 Bed plate should be saved on sign out
This commit is contained in:
parent
5afdfdb989
commit
0d111a09a3
3 changed files with 13 additions and 18 deletions
|
|
@ -340,8 +340,15 @@ namespace MatterHackers.MatterControl
|
|||
return popupMenu;
|
||||
}
|
||||
|
||||
public void PersistUserTabs()
|
||||
public async Task PersistUserTabs()
|
||||
{
|
||||
// Persist all pending changes in all workspaces to disk
|
||||
foreach (var workspace in this.Workspaces)
|
||||
{
|
||||
await this.Tasks.Execute("Saving ".Localize() + $" \"{workspace.Name}\" ...", workspace, workspace.SceneContext.SaveChanges);
|
||||
}
|
||||
|
||||
// Project workspace definitions to serializable structure
|
||||
var workspaces = this.Workspaces.Select(w =>
|
||||
{
|
||||
if (w.Printer == null)
|
||||
|
|
@ -360,7 +367,7 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
});
|
||||
|
||||
// Persist part workspaces
|
||||
// Persist workspace definitions to disk
|
||||
File.WriteAllText(
|
||||
ProfileManager.Instance.OpenTabsPath,
|
||||
JsonConvert.SerializeObject(
|
||||
|
|
|
|||
|
|
@ -297,29 +297,17 @@ namespace MatterHackers.MatterControl
|
|||
// cancel the close so that we can save all our active work spaces
|
||||
eventArgs.Cancel = true;
|
||||
|
||||
ApplicationController.Instance.PersistUserTabs();
|
||||
|
||||
UiThread.RunOnIdle(async () =>
|
||||
{
|
||||
var application = ApplicationController.Instance;
|
||||
|
||||
// Save changes before close
|
||||
foreach (var printer in ApplicationController.Instance.ActivePrinters)
|
||||
{
|
||||
if (printer != PrinterConfig.EmptyPrinter)
|
||||
{
|
||||
await application.Tasks.Execute("Saving Print Bed".Localize() + "...", printer, printer.Bed.SaveChanges);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var workspace in application.Workspaces)
|
||||
{
|
||||
await application.Tasks.Execute("Saving Print Bed".Localize() + "...", workspace, workspace.SceneContext.SaveChanges);
|
||||
}
|
||||
await application.PersistUserTabs();
|
||||
|
||||
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();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ namespace MatterHackers.MatterControl
|
|||
ApplicationController.Instance.ChangeCloudSyncStatus(userAuthenticated: true);
|
||||
AuthSessionChanged.CallEvents(null, null);
|
||||
}
|
||||
|
||||
|
||||
public bool ClientAuthenticatedSessionValid
|
||||
{
|
||||
get
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue