Dispose previous wizard when switching between stages
- Issue MatterHackers/MCCentral#5202 SetupWizards should be modified to undo their changes if aborted/ cancelled
This commit is contained in:
parent
a5b9e475bc
commit
0163cf6849
1 changed files with 9 additions and 1 deletions
|
|
@ -56,9 +56,13 @@ namespace MatterHackers.MatterControl
|
|||
if (_activeStage != null
|
||||
&& stageButtons.TryGetValue(_activeStage, out WizardStageRow activeButton))
|
||||
{
|
||||
// Mark the leftnav widget as inactive
|
||||
activeButton.Active = false;
|
||||
}
|
||||
|
||||
// Shutdown the active Wizard
|
||||
_activeStage?.Dispose();
|
||||
|
||||
_activeStage = value;
|
||||
|
||||
if (stageButtons.TryGetValue(_activeStage, out WizardStageRow stageButton))
|
||||
|
|
@ -78,7 +82,6 @@ namespace MatterHackers.MatterControl
|
|||
this.stages = stages;
|
||||
this.homePageGenerator = homePageGenerator;
|
||||
|
||||
var activeStage = stages.First();
|
||||
var theme = AppContext.Theme;
|
||||
|
||||
var row = new FlowLayoutWidget()
|
||||
|
|
@ -155,6 +158,11 @@ namespace MatterHackers.MatterControl
|
|||
this.ActiveStage = nextStage;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Shutdown the active wizard
|
||||
this.ActiveStage?.Dispose();
|
||||
}
|
||||
|
||||
// Move to next unfinished wizard or move to summary/home page
|
||||
this.ChangeToPage(homePageGenerator());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue