Merge pull request #3960 from larsbrubaker/master
Refactor the load filament page to handle initial setup and loading s…
This commit is contained in:
commit
a56aab99eb
3 changed files with 48 additions and 13 deletions
|
|
@ -47,11 +47,17 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
public static void Start(PrinterConfig printer, ThemeConfig theme, bool onlyLoad)
|
||||
{
|
||||
temperatureAtStart = printer.Connection.GetTargetHotendTemperature(0);
|
||||
// turn off print leveling
|
||||
var levelingContext = new LoadFilamentWizard(printer, onlyLoad)
|
||||
|
||||
var levelingContext = new LoadFilamentWizard(printer, onlyLoad);
|
||||
|
||||
if (onlyLoad)
|
||||
{
|
||||
WindowTitle = $"{ApplicationController.Instance.ProductName} - " + "Load Filament Wizard".Localize()
|
||||
};
|
||||
levelingContext.WindowTitle = $"{ApplicationController.Instance.ProductName} - " + "Load Filament Wizard".Localize();
|
||||
}
|
||||
else
|
||||
{
|
||||
levelingContext.WindowTitle = $"{ApplicationController.Instance.ProductName} - " + "Select Filament Wizard".Localize();
|
||||
}
|
||||
|
||||
var loadFilamentWizardWindow = DialogWindow.Show(new LevelingWizardRootPage(levelingContext)
|
||||
{
|
||||
|
|
@ -79,11 +85,17 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
var levelingStrings = new LevelingStrings(printer.Settings);
|
||||
|
||||
var title = "Load Material".Localize();
|
||||
var instructions = "Please select the material you want to load.".Localize();
|
||||
var title = "Select Material".Localize();
|
||||
var instructions = "Please select the material you will be printing with.".Localize();
|
||||
|
||||
if (onlyLoad)
|
||||
{
|
||||
title = "Load Material".Localize();
|
||||
instructions = "Please select the material you want to load.".Localize();
|
||||
}
|
||||
|
||||
// select the material
|
||||
yield return new SelectMaterialPage(this, title, instructions, "Load".Localize(), onlyLoad);
|
||||
yield return new SelectMaterialPage(this, title, instructions, onlyLoad ? "Load".Localize() : "Select".Localize(), onlyLoad);
|
||||
|
||||
var theme = ApplicationController.Instance.Theme;
|
||||
|
||||
|
|
|
|||
|
|
@ -48,20 +48,43 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
|
||||
NextButton.Text = nextButtonText;
|
||||
|
||||
if (!onlyLoad)
|
||||
if (onlyLoad)
|
||||
{
|
||||
var alreadyLoadedButton = new TextButton("Already Loaded".Localize(), theme)
|
||||
}
|
||||
else
|
||||
{
|
||||
NextButton.Visible = false;
|
||||
|
||||
contentRow.AddChild(this.CreateTextField("Optionally, click below to get help loading this material".Localize() + ":"));
|
||||
|
||||
var loadFilamentButton = new TextButton("Load Filament".Localize(), theme)
|
||||
{
|
||||
Name = "Already Loaded Button",
|
||||
Name = "Load Filament",
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
VAnchor = Agg.UI.VAnchor.Absolute,
|
||||
HAnchor = Agg.UI.HAnchor.Fit | Agg.UI.HAnchor.Left,
|
||||
Margin = new BorderDouble(10, 0, 0, 15)
|
||||
};
|
||||
loadFilamentButton.Click += (s, e) =>
|
||||
{
|
||||
wizardContext.ShowNextPage(this.DialogWindow);
|
||||
};
|
||||
|
||||
contentRow.AddChild(loadFilamentButton);
|
||||
|
||||
var selectButton = new TextButton("Select".Localize(), theme)
|
||||
{
|
||||
Name = "Select Button",
|
||||
BackgroundColor = theme.MinimalShade
|
||||
};
|
||||
alreadyLoadedButton.Click += (s, e) =>
|
||||
|
||||
selectButton.Click += (s, e) =>
|
||||
{
|
||||
this.DialogWindow.CloseOnIdle();
|
||||
printer.Settings.SetValue(SettingsKey.filament_has_been_loaded, "1");
|
||||
};
|
||||
|
||||
this.AddPageAction(alreadyLoadedButton);
|
||||
this.AddPageAction(selectButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 6f28241ae051dd800030f07352e69d24a85bb20e
|
||||
Subproject commit 709ece4b9d46523db5a99bae80c2b35741303882
|
||||
Loading…
Add table
Add a link
Reference in a new issue