Merge pull request #4290 from jlewin/master

Revise wizard system
This commit is contained in:
johnlewin 2019-02-19 10:55:33 -08:00 committed by GitHub
commit 383877b76d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 128 additions and 233 deletions

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -36,7 +36,6 @@ using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.MatterControl.SlicerConfiguration;
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
@ -83,7 +82,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
return extruderCount > 1 && !printer.Settings.GetValue<bool>(SettingsKey.filament_1_has_been_loaded);
}
protected override IEnumerator<PrinterSetupWizardPage> GetWizardSteps()
protected override IEnumerator<WizardPage> GetWizardSteps()
{
var extruderCount = printer.Settings.GetValue<int>(SettingsKey.extruder_count);
@ -103,13 +102,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
// show the trim filament message
{
PrinterSetupWizardPage trimFilamentPage = null;
trimFilamentPage = new PrinterSetupWizardPage(
this,
"Trim Filament".Localize(),
"")
var trimFilamentPage = new WizardPage(this, "Trim Filament".Localize(), "")
{
BecomingActive = () =>
PageLoad = (page) =>
{
// start heating up the extruder
printer.Connection.SetTargetHotendTemperature(extruderIndex, printer.Settings.GetValue<double>(SettingsKey.temperature));
@ -117,7 +112,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
var markdownText = printer.Settings.GetValue(SettingsKey.trim_filament_markdown);
var markdownWidget = new MarkdownWidget(theme);
markdownWidget.Markdown = markdownText = markdownText.Replace("\\n", "\n");
trimFilamentPage.ContentRow.AddChild(markdownWidget);
page.ContentRow.AddChild(markdownWidget);
}
};
yield return trimFilamentPage;
@ -135,13 +130,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
// show the insert filament page
{
RunningInterval runningGCodeCommands = null;
PrinterSetupWizardPage insertFilamentPage = null;
insertFilamentPage = new PrinterSetupWizardPage(
this,
"Insert Filament".Localize(),
"")
var insertFilamentPage = new WizardPage(this, "Insert Filament".Localize(), "")
{
BecomingActive = () =>
PageLoad = (page) =>
{
var markdownText = printer.Settings.GetValue(SettingsKey.insert_filament_markdown2);
if(extruderIndex == 1)
@ -150,7 +141,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
}
var markdownWidget = new MarkdownWidget(theme);
markdownWidget.Markdown = markdownText = markdownText.Replace("\\n", "\n");
insertFilamentPage.ContentRow.AddChild(markdownWidget);
page.ContentRow.AddChild(markdownWidget);
// turn off the fan
printer.Connection.FanSpeed0To255 = 0;
@ -175,7 +166,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
},
.1);
},
BecomingInactive = () =>
PageClose = () =>
{
if (runningGCodeCommands != null)
{
@ -197,15 +188,11 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
// show the loading filament progress bar
{
RunningInterval runningGCodeCommands = null;
PrinterSetupWizardPage loadingFilamentPage = null;
loadingFilamentPage = new PrinterSetupWizardPage(
this,
"Loading Filament".Localize(),
"")
var loadingFilamentPage = new WizardPage(this, "Loading Filament".Localize(), "")
{
BecomingActive = () =>
PageLoad = (page) =>
{
loadingFilamentPage.NextButton.Enabled = false;
page.NextButton.Enabled = false;
// add the progress bar
var holder = new FlowLayoutWidget()
@ -227,7 +214,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
};
holder.AddChild(progressBar);
holder.AddChild(progressBarText);
loadingFilamentPage.ContentRow.AddChild(holder);
page.ContentRow.AddChild(holder);
// Allow extrusion at any temperature. S0 only works on Marlin S1 works on repetier and marlin
printer.Connection.QueueLine("M302 S1");
@ -274,12 +261,12 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
&& remainingLengthMm <= .001)
{
UiThread.ClearInterval(runningGCodeCommands);
loadingFilamentPage.NextButton.InvokeClick();
page.NextButton.InvokeClick();
}
},
.1);
},
BecomingInactive = () =>
PageClose = () =>
{
UiThread.ClearInterval(runningGCodeCommands);
}
@ -312,13 +299,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
// extrude slowly so that we can prime the extruder
{
RunningInterval runningGCodeCommands = null;
PrinterSetupWizardPage runningCleanPage = null;
runningCleanPage = new PrinterSetupWizardPage(
this,
"Wait For Running Clean".Localize(),
"")
var runningCleanPage = new WizardPage(this, "Wait For Running Clean".Localize(), "")
{
BecomingActive = () =>
PageLoad = (page) =>
{
var markdownText = printer.Settings.GetValue(SettingsKey.running_clean_markdown2);
if(extruderIndex == 1)
@ -327,7 +310,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
}
var markdownWidget = new MarkdownWidget(theme);
markdownWidget.Markdown = markdownText = markdownText.Replace("\\n", "\n");
runningCleanPage.ContentRow.AddChild(markdownWidget);
page.ContentRow.AddChild(markdownWidget);
var runningTime = Stopwatch.StartNew();
runningGCodeCommands = UiThread.SetInterval(() =>
@ -346,7 +329,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
},
.1);
},
BecomingInactive = () =>
PageClose = () =>
{
UiThread.ClearInterval(runningGCodeCommands);
}
@ -374,7 +357,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
}
}
public class DoneLoadingPage : PrinterSetupWizardPage
public class DoneLoadingPage : WizardPage
{
public DoneLoadingPage(PrinterSetupWizard setupWizard, int extruderIndex)
: base(setupWizard, "Success".Localize(), "Success!\n\nYour filament should now be loaded".Localize())
@ -413,11 +396,11 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
}
}
public override void PageIsBecomingActive()
public override void OnLoad(EventArgs args)
{
ShowWizardFinished();
this.ShowWizardFinished();
base.PageIsBecomingActive();
base.OnLoad(args);
}
}
}

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -27,14 +27,13 @@ of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Collections.Generic;
using MatterHackers.Agg;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.MatterControl.PrinterCommunication.Io;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.VectorMath;
using System;
using System.Collections.Generic;
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
@ -136,7 +135,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
};
}
protected override IEnumerator<PrinterSetupWizardPage> GetWizardSteps()
protected override IEnumerator<WizardPage> GetWizardSteps()
{
var probePositions = new List<ProbePosition>(levelingPlan.ProbeCount);
for (int j = 0; j < levelingPlan.ProbeCount; j++)
@ -152,7 +151,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
if (showWelcomeScreen)
{
yield return new PrinterSetupWizardPage(
yield return new WizardPage(
this,
"Initial Printer Setup".Localize(),
string.Format(
@ -200,7 +199,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
}
}
yield return new PrinterSetupWizardPage(
yield return new WizardPage(
this,
"Print Leveling Overview".Localize(),
buildWelcomeText());
@ -259,7 +258,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
this,
"Waiting For Printer To Heat".Localize(),
heatingInstructions,
targetBedTemp, new double[] { targetHotendTemp });
targetBedTemp,
new double[] { targetHotendTemp });
}
double bedRadius = Math.Min(printer.Settings.GetValue<Vector2>(SettingsKey.bed_size).X, printer.Settings.GetValue<Vector2>(SettingsKey.bed_size).Y) / 2;

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -27,21 +27,16 @@ of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Collections.Generic;
using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
using MatterHackers.MatterControl.PrinterCommunication.Io;
using MatterHackers.MatterControl.SlicerConfiguration;
namespace MatterHackers.MatterControl
{
public abstract class PrinterSetupWizard
{
private IEnumerator<PrinterSetupWizardPage> pages;
private IEnumerator<WizardPage> pages;
protected abstract IEnumerator<PrinterSetupWizardPage> GetWizardSteps();
protected abstract IEnumerator<WizardPage> GetWizardSteps();
public string WindowTitle { get; internal set; }
@ -60,14 +55,11 @@ namespace MatterHackers.MatterControl
UiThread.RunOnIdle(() =>
{
// Shutdown active page
pages.Current?.PageIsBecomingInactive();
pages.Current?.Close();
// Advance
if (pages.MoveNext())
{
pages.Current?.PageIsBecomingActive();
dialogWindow.ChangeToPage(pages.Current);
}
});

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -27,13 +27,12 @@ of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using MatterHackers.Agg;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.PrinterCommunication.Io;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.VectorMath;
using System;
using System.Collections.Generic;
using MatterHackers.Agg;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
@ -93,7 +92,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
&& printer.Settings.GetValue<bool>(SettingsKey.use_z_probe);
}
protected override IEnumerator<PrinterSetupWizardPage> GetWizardSteps()
protected override IEnumerator<WizardPage> GetWizardSteps()
{
var levelingStrings = new LevelingStrings();
var autoProbePositions = new List<ProbePosition>(3);
@ -107,7 +106,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
// make a welcome page if this is the first time calibrating the probe
if (!printer.Settings.GetValue<bool>(SettingsKey.probe_has_been_calibrated))
{
yield return new PrinterSetupWizardPage(
yield return new WizardPage(
this,
"Initial Printer Setup".Localize(),
string.Format(
@ -117,7 +116,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
}
// show what steps will be taken
yield return new PrinterSetupWizardPage(
yield return new WizardPage(
this,
"Probe Calibration Overview".Localize(),
string.Format(
@ -188,7 +187,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
0);
// show what steps will be taken
yield return new PrinterSetupWizardPage(
yield return new WizardPage(
this,
"Measure the nozzle offset".Localize(),
"{0}:\n\n\t• {1}\n\n{2}\n\n{3}".FormatWith(
@ -268,7 +267,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
printer.Connection.QueueLine($"T{extruderPriorToMeasure}");
}
yield return new CalibrateProbeLastPagelInstructions(
yield return new CalibrateProbeLastPageInstructions(
this,
"Done".Localize());
}

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -69,7 +69,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
this.extruderIndex = extruderIndex;
}
protected override IEnumerator<PrinterSetupWizardPage> GetWizardSteps()
protected override IEnumerator<WizardPage> GetWizardSteps()
{
var extruderCount = printer.Settings.GetValue<int>(SettingsKey.extruder_count);
@ -109,15 +109,11 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
int extruderPriorToUnload = printer.Connection.ActiveExtruderIndex;
RunningInterval runningGCodeCommands = null;
PrinterSetupWizardPage unloadingFilamentPage = null;
unloadingFilamentPage = new PrinterSetupWizardPage(
this,
"Unloading Filament".Localize(),
"")
var unloadingFilamentPage = new WizardPage(this, "Unloading Filament".Localize(), "")
{
BecomingActive = () =>
PageLoad = (page) =>
{
unloadingFilamentPage.NextButton.Enabled = false;
page.NextButton.Enabled = false;
// add the progress bar
var holder = new FlowLayoutWidget()
@ -139,7 +135,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
};
holder.AddChild(progressBar);
holder.AddChild(progressBarText);
unloadingFilamentPage.ContentRow.AddChild(holder);
page.ContentRow.AddChild(holder);
if (extruderCount > 1)
{
@ -199,12 +195,12 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
&& remainingLengthMm <= .001)
{
UiThread.ClearInterval(runningGCodeCommands);
unloadingFilamentPage.NextButton.InvokeClick();
page.NextButton.InvokeClick();
}
},
.1);
},
BecomingInactive = () =>
PageClose = () =>
{
UiThread.ClearInterval(runningGCodeCommands);
}
@ -228,7 +224,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
}
}
public class DoneUnloadingPage : PrinterSetupWizardPage
public class DoneUnloadingPage : WizardPage
{
public DoneUnloadingPage(PrinterSetupWizard setupWizard, int extruderIndex)
: base(setupWizard, "Success".Localize(), "Success!\n\nYour filament should now be unloaded".Localize())
@ -248,11 +244,10 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
this.AddPageAction(loadFilamentButton);
}
public override void PageIsBecomingActive()
public override void OnLoad(EventArgs args)
{
ShowWizardFinished();
base.PageIsBecomingActive();
this.ShowWizardFinished();
base.OnLoad(args);
}
}
}

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -35,20 +35,22 @@ using MatterHackers.MatterControl.CustomWidgets;
namespace MatterHackers.MatterControl
{
public class PrinterSetupWizardPage : DialogPage
public class WizardPage : DialogPage
{
public TextButton NextButton { get; }
protected PrinterConfig printer;
public Action BecomingActive;
public Action BecomingInactive;
protected PrinterSetupWizard wizardContext;
public Action<WizardPage> PageLoad { get; set; }
public PrinterSetupWizardPage(PrinterSetupWizard wizardContext, string headerText, string instructionsText)
public Action PageClose { get; set; }
protected PrinterSetupWizard setupWizard;
public WizardPage(PrinterSetupWizard setupWizard, string headerText, string instructionsText)
{
this.wizardContext = wizardContext;
this.printer = wizardContext.Printer;
this.WindowTitle = wizardContext.WindowTitle;
this.setupWizard = setupWizard;
this.printer = setupWizard.Printer;
this.WindowTitle = setupWizard.WindowTitle;
this.HeaderText = headerText;
if (!string.IsNullOrEmpty(instructionsText))
@ -64,26 +66,12 @@ namespace MatterHackers.MatterControl
};
NextButton.Click += (s, e) =>
{
wizardContext.ShowNextPage(this.DialogWindow);
setupWizard.ShowNextPage(this.DialogWindow);
};
this.AddPageAction(NextButton);
}
public GuiWidget ContentRow => contentRow;
public override void PageIsBecomingActive()
{
BecomingActive?.Invoke();
base.PageIsBecomingActive();
}
public override void PageIsBecomingInactive()
{
BecomingInactive?.Invoke();
base.PageIsBecomingInactive();
}
protected GuiWidget CreateTextField(string text)
{
return new WrappedTextWidget(text)
@ -94,6 +82,18 @@ namespace MatterHackers.MatterControl
};
}
public override void OnLoad(EventArgs args)
{
this.PageLoad?.Invoke(this);
base.OnLoad(args);
}
public override void OnClosed(EventArgs e)
{
this.PageClose?.Invoke();
base.OnClosed(e);
}
public void ShowWizardFinished()
{
var doneButton = new TextButton("Done".Localize(), theme)

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -31,16 +31,14 @@ using System;
using System.Collections.Generic;
using System.Linq;
using MatterControl.Printing;
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.MatterControl.PrinterCommunication.Io;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
public class AutoProbeFeedback : PrinterSetupWizardPage
public class AutoProbeFeedback : WizardPage
{
private Vector3 lastReportedPosition;
private List<ProbePosition> probePositions;
@ -119,13 +117,11 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
private Vector3 feedRates;
private Vector3 adjustedProbePosition;
public override void PageIsBecomingActive()
public override void OnLoad(EventArgs args)
{
// always make sure we don't have print leveling turned on
printer.Connection.AllowLeveling = false;
base.PageIsBecomingActive();
if (printer.Settings.GetValue<bool>(SettingsKey.has_z_probe)
&& printer.Settings.GetValue<bool>(SettingsKey.use_z_probe)
&& printer.Settings.GetValue<bool>(SettingsKey.has_z_servo))
@ -160,12 +156,14 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
printer.Connection.LineReceived += GetZProbeHeight;
}
base.OnLoad(args);
}
public override void PageIsBecomingInactive()
public override void OnClosed(EventArgs e)
{
printer.Connection.LineReceived -= GetZProbeHeight;
base.PageIsBecomingInactive();
base.OnClosed(e);
}
}
}

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -28,7 +28,6 @@ either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Collections.Generic;
using System.IO;
using MatterHackers.Agg.Platform;
using MatterHackers.Agg.UI;
@ -38,11 +37,11 @@ using MatterHackers.MatterControl.SlicerConfiguration;
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
public class CalibrateProbeLastPagelInstructions : PrinterSetupWizardPage
public class CalibrateProbeLastPageInstructions : WizardPage
{
private bool pageWasActive = false;
public CalibrateProbeLastPagelInstructions(PrinterSetupWizard context, string headerText)
public CalibrateProbeLastPageInstructions(PrinterSetupWizard context, string headerText)
: base(context, headerText, "")
{
var calibrated = "Your Probe is now calibrated.".Localize() + "\n"
@ -63,7 +62,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
this.ShowWizardFinished();
}
public override void PageIsBecomingActive()
public override void OnLoad(EventArgs args)
{
if (printer.Settings.GetValue<bool>(SettingsKey.z_homes_to_max))
{
@ -72,7 +71,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
pageWasActive = true;
base.PageIsBecomingActive();
base.OnLoad(args);
}
public override void OnClosed(EventArgs e)

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -34,12 +34,11 @@ using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.MatterControl.PrinterCommunication.Io;
using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
public class FindBedHeight : PrinterSetupWizardPage
public class FindBedHeight : WizardPage
{
private Vector3 lastReportedPosition;
private List<ProbePosition> probePositions;
@ -90,17 +89,15 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
this.CreateTextField(setZHeightCoarseInstruction2));
}
public override void PageIsBecomingActive()
public override void OnLoad(EventArgs args)
{
this.Parents<SystemWindow>().First().KeyDown -= TopWindowKeyDown;
probePositions[probePositionsBeingEditedIndex].position = printer.Connection.LastReportedPosition;
// always make sure we don't have print leveling turned on
printer.Connection.AllowLeveling = false;
NextButton.ToolTipText = string.Format("[{0}]", "Right Arrow".Localize());
base.PageIsBecomingActive();
}
public override void OnLoad(EventArgs args)
{
this.DialogWindow.KeyDown += TopWindowKeyDown;
base.OnLoad(args);
}
@ -114,15 +111,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
base.OnClosed(e);
}
public override void PageIsBecomingInactive()
{
this.Parents<SystemWindow>().First().KeyDown -= TopWindowKeyDown;
probePositions[probePositionsBeingEditedIndex].position = printer.Connection.LastReportedPosition;
base.PageIsBecomingInactive();
NextButton.ToolTipText = "";
}
private FlowLayoutWidget CreateZButtons()
{
FlowLayoutWidget zButtons = JogControls.CreateZButtons(printer, 4, out zPlusControl, out zMinusControl, new PrinterControls.XYZColors(theme), theme, true);

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -48,10 +48,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
this.probeStartPosition = probeStartPosition;
}
public override void PageIsBecomingActive()
public override void OnLoad(EventArgs args)
{
base.PageIsBecomingActive();
// make sure the probe is not deployed
if (printer.Settings.GetValue<bool>(SettingsKey.has_z_probe)
&& printer.Settings.GetValue<bool>(SettingsKey.use_z_probe)
@ -72,18 +70,13 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
zPlusControl.Click += zControl_Click;
zMinusControl.Click += zControl_Click;
base.OnLoad(args);
}
protected void zControl_Click(object sender, EventArgs mouseEvent)
{
NextButton.Enabled = true;
}
public override void PageIsBecomingInactive()
{
NextButton.Enabled = true;
base.PageIsBecomingInactive();
}
}
}

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -28,16 +28,12 @@ either expressed or implied, of the FreeBSD Project.
*/
using System.Collections.Generic;
using MatterHackers.Agg;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
public class GetUltraFineBedHeight : FindBedHeight
{
private bool haveDrawn = false;
public GetUltraFineBedHeight(PrinterSetupWizard context, string pageDescription, List<ProbePosition> probePositions,
int probePositionsBeingEditedIndex, LevelingStrings levelingStrings)
: base(
@ -50,21 +46,5 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
probePositionsBeingEditedIndex)
{
}
public override void OnDraw(Graphics2D graphics2D)
{
haveDrawn = true;
base.OnDraw(graphics2D);
}
public override void PageIsBecomingInactive()
{
// TODO: Why conditional on haveDrawn?
if (haveDrawn)
{
printer.Connection.MoveRelative(PrinterConnection.Axis.Z, 2, printer.Settings.Helpers.ManualMovementSpeeds().Z);
}
base.PageIsBecomingInactive();
}
}
}

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -35,7 +35,7 @@ using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
public class GettingThirdPointFor2PointCalibration : PrinterSetupWizardPage
public class GettingThirdPointFor2PointCalibration : WizardPage
{
protected Vector3 probeStartPosition;
private ProbePosition probePosition;
@ -55,7 +55,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
base.OnClosed(e);
}
public override void PageIsBecomingActive()
public override void OnLoad(EventArgs args)
{
// first make sure there is no leftover FinishedProbe event
printer.Connection.LineReceived += FinishedProbe;
@ -67,9 +67,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
printer.Connection.QueueLine("G30");
printer.Connection.LineReceived += FinishedProbe;
base.PageIsBecomingActive();
NextButton.Enabled = false;
base.OnLoad(args);
}
private void FinishedProbe(object sender, string line)

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -34,7 +34,7 @@ using MatterHackers.MatterControl.SlicerConfiguration;
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
public class HomePrinterPage : PrinterSetupWizardPage
public class HomePrinterPage : WizardPage
{
private bool autoAdvance;
@ -52,7 +52,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
base.OnClosed(e);
}
public override void PageIsBecomingActive()
public override void OnLoad(EventArgs args)
{
printer.Connection.CommunicationStateChanged += CheckHomeFinished;
@ -69,7 +69,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
NextButton.Enabled = false;
}
base.PageIsBecomingActive();
base.OnLoad(args);
}
private void CheckHomeFinished(object sender, EventArgs e)
@ -84,12 +84,5 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
}
}
}
public override void PageIsBecomingInactive()
{
NextButton.Enabled = true;
base.PageIsBecomingInactive();
}
}
}

View file

@ -34,12 +34,11 @@ using MatterHackers.Agg.Platform;
using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.MatterControl.PrinterCommunication.Io;
using MatterHackers.MatterControl.SlicerConfiguration;
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
public class LastPageInstructions : PrinterSetupWizardPage
public class LastPageInstructions : WizardPage
{
private List<ProbePosition> probePositions;
@ -66,7 +65,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
this.ShowWizardFinished();
}
public override void PageIsBecomingActive()
public override void OnLoad(EventArgs args)
{
PrintLevelingData levelingData = printer.Settings.Helpers.GetPrintLevelingData();
levelingData.SampledPositions.Clear();
@ -105,7 +104,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
ApplicationController.Instance.RunAnyRequiredPrinterSetup(printer, theme);
};
base.PageIsBecomingActive();
base.OnLoad(args);
}
}
}

View file

@ -34,7 +34,7 @@ using MatterHackers.MatterControl.SlicerConfiguration;
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
public class SelectMaterialPage : PrinterSetupWizardPage
public class SelectMaterialPage : WizardPage
{
public SelectMaterialPage(PrinterSetupWizard context, string headerText, string instructionsText, string nextButtonText, int extruderIndex, bool showLoadFilamentButton, bool showAlreadyLoadedButton)
: base(context, headerText, instructionsText)
@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
};
loadFilamentButton.Click += (s, e) =>
{
wizardContext.ShowNextPage(this.DialogWindow);
setupWizard.ShowNextPage(this.DialogWindow);
};
this.AddPageAction(loadFilamentButton);
@ -93,10 +93,5 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
this.AddPageAction(alreadyLoadedButton);
}
}
public override void PageIsBecomingInactive()
{
base.PageIsBecomingInactive();
}
}
}

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -38,7 +38,7 @@ using MatterHackers.MatterControl.SlicerConfiguration;
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
public class WaitForTempPage : PrinterSetupWizardPage
public class WaitForTempPage : WizardPage
{
private ProgressBar bedProgressBar;
private TextWidget bedProgressBarText;
@ -167,13 +167,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
}
}
public override void OnLoad(EventArgs args)
{
// hook our parent so we can turn off the bed when we are done with leveling
this.DialogWindow.Closed += WizardWindow_Closed;
base.OnLoad(args);
}
private void WizardWindow_Closed(object sender, EventArgs e)
{
// Make sure when the wizard closes we turn off the bed heating
@ -181,8 +174,11 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
this.DialogWindow.Closed -= WizardWindow_Closed;
}
public override void PageIsBecomingActive()
public override void OnLoad(EventArgs args)
{
// hook our parent so we can turn off the bed when we are done with leveling
this.DialogWindow.Closed += WizardWindow_Closed;
bedStartingTemp = printer.Connection.ActualBedTemperature;
runningInterval = UiThread.SetInterval(ShowTempChangeProgress, 1);
@ -205,21 +201,14 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
NextButton.Enabled = false;
// if we are trying to go to a temp of 0 than just move on to next window
if(bedTargetTemp == 0
if (bedTargetTemp == 0
&& targetHotendTemps.All(i => i == 0))
{
// advance to the next page
UiThread.RunOnIdle(() => NextButton.InvokeClick());
}
base.PageIsBecomingActive();
}
public override void PageIsBecomingInactive()
{
NextButton.Enabled = true;
base.PageIsBecomingInactive();
base.OnLoad(args);
}
public override void OnClosed(EventArgs e)

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -223,13 +223,5 @@ namespace MatterHackers.MatterControl
{
abortCancel = false;
}
public virtual void PageIsBecomingActive()
{
}
public virtual void PageIsBecomingInactive()
{
}
}
}