Improve DI, use constructor injection

This commit is contained in:
John Lewin 2018-07-12 09:22:28 -07:00
parent 7853d1b612
commit bbabf95c93
52 changed files with 244 additions and 245 deletions

View file

@ -53,10 +53,10 @@ namespace MatterHackers.MatterControl.CustomWidgets
private ThemeConfig theme;
public DockingTabControl(GuiWidget widgetTodockTo, DockSide dockSide, PrinterConfig printer)
public DockingTabControl(GuiWidget widgetTodockTo, DockSide dockSide, PrinterConfig printer, ThemeConfig theme)
: base (FlowDirection.TopToBottom)
{
this.theme = ApplicationController.Instance.Theme;
this.theme = theme;
this.printer = printer;
this.widgetTodockTo = widgetTodockTo;
this.DockSide = dockSide;
@ -334,7 +334,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
});
buttonView.AfterDraw += (s, e) =>
{
e.Graphics2D.Render(rotatedLabel, ActiveTheme.Instance.PrimaryTextColor);
e.Graphics2D.Render(rotatedLabel, theme.Colors.PrimaryTextColor);
};
}
@ -370,7 +370,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
BackgroundColor = theme.TabBarBackground,
};
titleBar.AddChild(new TextWidget(title, textColor: ActiveTheme.Instance.PrimaryTextColor)
titleBar.AddChild(new TextWidget(title, textColor: theme.Colors.PrimaryTextColor)
{
Margin = new BorderDouble(left: 8),
VAnchor = VAnchor.Center

View file

@ -73,7 +73,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
Name = automationName + " Save",
};
searchPanel = new SearchInputBox()
searchPanel = new SearchInputBox(theme)
{
Visible = false,
Margin = new BorderDouble(left: 4)

View file

@ -50,11 +50,9 @@ namespace MatterHackers.MatterControl.CustomWidgets
private ImageWidget imageWidget;
private bool isDirty;
public TreeNode(bool useIcon = true)
public TreeNode(ThemeConfig theme, bool useIcon = true)
: base(FlowDirection.TopToBottom)
{
var theme = ApplicationController.Instance.Theme;
this.HAnchor = HAnchor.Fit | HAnchor.Left;
this.VAnchor = VAnchor.Fit;