Remove LinkButtonFactory
This commit is contained in:
parent
ae615e3ae5
commit
ad73662b65
16 changed files with 137 additions and 234 deletions
|
|
@ -44,10 +44,7 @@ namespace MatterHackers.MatterControl
|
|||
this.WindowTitle = "Macro Editor".Localize();
|
||||
this.HeaderText = "Macro Presets".Localize() + ":";
|
||||
|
||||
var theme = ApplicationController.Instance.Theme;
|
||||
var linkButtonFactory = theme.LinkButtonFactory;
|
||||
|
||||
this.RebuildList(printerSettings, linkButtonFactory);
|
||||
this.RebuildList(printerSettings);
|
||||
|
||||
var addMacroButton = theme.CreateDialogButton("Add".Localize());
|
||||
addMacroButton.ToolTipText = "Add a new Macro".Localize();
|
||||
|
|
@ -66,7 +63,7 @@ namespace MatterHackers.MatterControl
|
|||
this.AddPageAction(addMacroButton);
|
||||
}
|
||||
|
||||
private void RebuildList(PrinterSettings printerSettings, LinkButtonFactory linkButtonFactory)
|
||||
private void RebuildList(PrinterSettings printerSettings)
|
||||
{
|
||||
this.contentRow.CloseAllChildren();
|
||||
|
||||
|
|
@ -90,10 +87,10 @@ namespace MatterHackers.MatterControl
|
|||
// We make a local variable to create a closure around it to ensure we get the correct instance
|
||||
var localMacroReference = macro;
|
||||
|
||||
var oldColor = linkButtonFactory.textColor;
|
||||
linkButtonFactory.textColor = Color.Black;
|
||||
Button editLink = linkButtonFactory.Generate("edit".Localize());
|
||||
editLink.Margin = new BorderDouble(right: 5);
|
||||
var editLink = new LinkLabel("edit".Localize(), theme)
|
||||
{
|
||||
Margin = new BorderDouble(right: 5),
|
||||
};
|
||||
editLink.Click += (s, e) =>
|
||||
{
|
||||
this.DialogWindow.ChangeToPage(
|
||||
|
|
@ -101,15 +98,14 @@ namespace MatterHackers.MatterControl
|
|||
};
|
||||
macroRow.AddChild(editLink);
|
||||
|
||||
Button removeLink = linkButtonFactory.Generate("remove".Localize());
|
||||
var removeLink = new LinkLabel("remove".Localize(), theme);
|
||||
removeLink.Click += (sender, e) =>
|
||||
{
|
||||
printerSettings.Macros.Remove(localMacroReference);
|
||||
printerSettings.Save();
|
||||
this.RebuildList(printerSettings, linkButtonFactory);
|
||||
this.RebuildList(printerSettings);
|
||||
};
|
||||
macroRow.AddChild(removeLink);
|
||||
linkButtonFactory.textColor = oldColor;
|
||||
|
||||
contentRow.AddChild(macroRow);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,9 +101,11 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
printerBaudRateError.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
printerBaudRateError.AutoExpandBoundsToText = true;
|
||||
|
||||
printerBaudRateHelpLink = linkButtonFactory.Generate("What's this?".Localize());
|
||||
printerBaudRateHelpLink.Margin = new BorderDouble(left: 5);
|
||||
printerBaudRateHelpLink.VAnchor = VAnchor.Bottom;
|
||||
printerBaudRateHelpLink = new LinkLabel("What's this?".Localize(), theme)
|
||||
{
|
||||
Margin = new BorderDouble(left: 5),
|
||||
VAnchor = VAnchor.Bottom
|
||||
};
|
||||
printerBaudRateHelpLink.Click += printerBaudRateHelp_Click;
|
||||
|
||||
printerBaudRateHelpMessage = new TextWidget("The term 'Baud Rate' roughly means the speed at which\ndata is transmitted. Baud rates may differ from printer to\nprinter. Refer to your printer manual for more info.\n\nTip: If you are uncertain - try 250000.".Localize(), 0, 0, 10);
|
||||
|
|
|
|||
|
|
@ -159,9 +159,11 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
AutoExpandBoundsToText = true
|
||||
};
|
||||
|
||||
printerComPortHelpLink = linkButtonFactory.Generate("What's this?".Localize());
|
||||
printerComPortHelpLink.Margin = new BorderDouble(left: 5);
|
||||
printerComPortHelpLink.VAnchor = VAnchor.Bottom;
|
||||
printerComPortHelpLink = new LinkLabel("What's this?".Localize(), theme)
|
||||
{
|
||||
Margin = new BorderDouble(left: 5),
|
||||
VAnchor = VAnchor.Bottom
|
||||
};
|
||||
printerComPortHelpLink.Click += (s, e) => printerComPortHelpMessage.Visible = !printerComPortHelpMessage.Visible;
|
||||
|
||||
printerComPortHelpMessage = new TextWidget("The 'Serial Port' section lists all available serial\nports on your device. Changing which USB port the printer\nis connected to may change the associated serial port.\n\nTip: If you are uncertain, unplug/plug in your printer\nand hit refresh. The new port that appears should be\nyour printer.".Localize(), 0, 0, 10)
|
||||
|
|
|
|||
|
|
@ -84,8 +84,10 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
};
|
||||
container.AddChild(setupManualConfigurationOrSkipConnectionWidget);
|
||||
|
||||
Button manualLink = linkButtonFactory.Generate("Manually Configure Connection".Localize());
|
||||
manualLink.Margin = new BorderDouble(0, 5);
|
||||
var manualLink = new LinkLabel("Manually Configure Connection".Localize(), theme)
|
||||
{
|
||||
Margin = new BorderDouble(0, 5),
|
||||
};
|
||||
manualLink.Click += (s, e) => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
DialogWindow.ChangeToPage(new SetupStepComPortManual(printer));
|
||||
|
|
@ -100,8 +102,10 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
};
|
||||
container.AddChild(printerMessageFour);
|
||||
|
||||
Button skipConnectionLink = linkButtonFactory.Generate("Skip Connection Setup".Localize());
|
||||
skipConnectionLink.Margin = new BorderDouble(0, 8);
|
||||
var skipConnectionLink = new LinkLabel("Skip Connection Setup".Localize(), theme)
|
||||
{
|
||||
Margin = new BorderDouble(0, 8),
|
||||
};
|
||||
skipConnectionLink.Click += (s, e) => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
printer.Connection.HaltConnectionThread();
|
||||
|
|
|
|||
|
|
@ -132,8 +132,10 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
GuiWidget vSpacer = new GuiWidget();
|
||||
vSpacer.VAnchor = VAnchor.Stretch;
|
||||
|
||||
Button manualLink = linkButtonFactory.Generate("Manual Configuration".Localize());
|
||||
manualLink.Margin = new BorderDouble(0, 5);
|
||||
var manualLink = new LinkLabel("Manual Configuration".Localize(), theme)
|
||||
{
|
||||
Margin = new BorderDouble(0, 5)
|
||||
};
|
||||
manualLink.Click += (s, e) => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
DialogWindow.ChangeToPage(new SetupStepComPortManual(printer));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue