Made the loading and unloading actions on the actions bar

Made better styling
This commit is contained in:
Lars Brubaker 2019-01-18 12:13:31 -08:00
parent 8783edb6f8
commit 4224ff8755
5 changed files with 43 additions and 50 deletions

View file

@ -345,17 +345,10 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
if (printer.Connection.PrinterIsPaused)
{
contentRow.AddChild(new VerticalSpacer());
contentRow.AddChild(this.CreateTextField("You can optionally click below to resume your paused print.".Localize() + ":"));
var resumePrintingButton = new TextButton("Resume Printing".Localize(), theme)
{
Name = "Resume Printing Button",
BackgroundColor = theme.MinimalShade,
VAnchor = Agg.UI.VAnchor.Absolute,
HAnchor = Agg.UI.HAnchor.Fit | Agg.UI.HAnchor.Left,
Margin = new BorderDouble(10, 15, 0, 15)
};
resumePrintingButton.Click += (s, e) =>
{
@ -363,7 +356,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
printer.Connection.Resume();
};
contentRow.AddChild(resumePrintingButton);
theme.ApplyPrimaryActionStyle(resumePrintingButton);
this.AddPageAction(resumePrintingButton);
}
}

View file

@ -205,25 +205,19 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
public DoneUnloadingPage(PrinterSetupWizard setupWizard)
: base(setupWizard, "Success".Localize(), "Success!\n\nYour filament should now be unloaded".Localize())
{
contentRow.AddChild(new VerticalSpacer());
contentRow.AddChild(this.CreateTextField("You can optionally click below to get help loading new material".Localize() + ":"));
var loadFilamentButton = new TextButton("Load Filament".Localize(), theme)
{
Name = "Load Filament",
BackgroundColor = theme.MinimalShade,
VAnchor = Agg.UI.VAnchor.Absolute,
HAnchor = Agg.UI.HAnchor.Fit | Agg.UI.HAnchor.Left,
Margin = new BorderDouble(10, 10, 0, 15)
};
loadFilamentButton.Click += (s, e) =>
{
loadFilamentButton.Parents<SystemWindow>().First().Close();
LoadFilamentWizard.Start(printer, theme, true);
};
theme.ApplyPrimaryActionStyle(loadFilamentButton);
contentRow.AddChild(loadFilamentButton);
this.AddPageAction(loadFilamentButton);
}
public override void PageIsBecomingActive()

View file

@ -55,24 +55,19 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
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 = "Load Filament",
BackgroundColor = theme.MinimalShade,
VAnchor = Agg.UI.VAnchor.Absolute,
HAnchor = Agg.UI.HAnchor.Fit | Agg.UI.HAnchor.Left,
Margin = new BorderDouble(10, 10, 0, 15)
};
loadFilamentButton.Click += (s, e) =>
{
wizardContext.ShowNextPage(this.DialogWindow);
};
contentRow.AddChild(loadFilamentButton);
this.AddPageAction(loadFilamentButton);
var selectButton = new TextButton("Select".Localize(), theme)
var selectButton = new TextButton("Already Loaded".Localize(), theme)
{
Name = "Already Loaded Button",
BackgroundColor = theme.MinimalShade

View file

@ -57,7 +57,7 @@ namespace MatterHackers.MatterControl
new MessageBoxPage(callback, message, caption, messageType, extraWidgetsToAdd, 400, 300, yesOk, noCancel, ApplicationController.Instance.Theme, useMarkdown));
}
private class MessageBoxPage : DialogPage
public class MessageBoxPage : DialogPage
{
private string unwrappedMessage;
private GuiWidget messageContainer;

View file

@ -256,35 +256,45 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
if (printePauseEventArgs.filamentRunout)
{
string filamentPauseMessage = "Your 3D print has been paused.\n\nOut of filament, or jam, detected. Please load more filament or clear the jam.".Localize();
var optionText = this.CreateTextField("Optionally, click below to get help unloading this material".Localize() + ":");
var unloadFilamentButton = new TextButton("Unload Filament".Localize(), theme)
UiThread.RunOnIdle(() =>
{
Name = "unload Filament",
BackgroundColor = theme.MinimalShade,
VAnchor = Agg.UI.VAnchor.Absolute,
HAnchor = Agg.UI.HAnchor.Fit | Agg.UI.HAnchor.Left,
Margin = new BorderDouble(10, 10, 0, 15)
};
unloadFilamentButton.Click += (s, e2) =>
{
UiThread.RunOnIdle(() =>
var unloadFilamentButton = new TextButton("Unload Filament".Localize(), theme)
{
unloadFilamentButton.Parents<SystemWindow>().First().Close();
UnloadFilamentWizard.Start(printer, theme, true);
});
};
Name = "unload Filament",
BackgroundColor = theme.MinimalShade,
VAnchor = Agg.UI.VAnchor.Absolute,
HAnchor = Agg.UI.HAnchor.Fit | Agg.UI.HAnchor.Left,
Margin = new BorderDouble(10, 10, 0, 15)
};
UiThread.RunOnIdle(() => StyledMessageBox.ShowMessageBox(ResumePrint,
filamentPauseMessage.FormatWith(printePauseEventArgs.layerNumber),
pauseCaption,
new GuiWidget[] { optionText, unloadFilamentButton },
StyledMessageBox.MessageType.YES_NO,
"Resume".Localize(),
"OK".Localize()));
unloadFilamentButton.Click += (s, e2) =>
{
UiThread.RunOnIdle(() =>
{
unloadFilamentButton.Parents<SystemWindow>().First().Close();
UnloadFilamentWizard.Start(printer, theme, true);
});
};
theme.ApplyPrimaryActionStyle(unloadFilamentButton);
string filamentPauseMessage = "Your 3D print has been paused.\n\nOut of filament, or jam, detected. Please load more filament or clear the jam.".Localize();
var messageBox = new MessageBoxPage(ResumePrint,
filamentPauseMessage.FormatWith(printePauseEventArgs.layerNumber),
pauseCaption,
StyledMessageBox.MessageType.YES_NO_WITHOUT_HIGHLIGHT,
null,
500,
400,
"Resume".Localize(),
"OK".Localize(),
ApplicationController.Instance.Theme, false);
messageBox.AddPageAction(unloadFilamentButton);
DialogWindow.Show(messageBox);
});
}
}
}