Consolidate ButtonFactory - UpdateControlView

This commit is contained in:
John Lewin 2017-06-20 06:09:01 -07:00
parent 7d3bf69e95
commit e4b5575a36
4 changed files with 17 additions and 14 deletions

View file

@ -56,7 +56,7 @@ namespace MatterHackers.MatterControl
if (UserSettings.Instance.IsTouchScreen)
{
customInfoTopToBottom.AddChild(new UpdateControlView());
customInfoTopToBottom.AddChild(new UpdateControlView(ApplicationController.Instance.Theme));
}
//AddMatterHackersInfo(customInfoTopToBottom);

View file

@ -45,7 +45,7 @@ namespace MatterHackers.MatterControl.AboutPage
checkUpdateLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
checkUpdateLabel.Margin = new BorderDouble(2, 10, 10, 5);
UpdateControlView updateStatusWidget = new UpdateControlView();
UpdateControlView updateStatusWidget = new UpdateControlView(ApplicationController.Instance.Theme);
TextWidget feedLabel = new TextWidget("Update Channel".Localize(), pointSize: 12);
feedLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;

View file

@ -44,23 +44,18 @@ namespace MatterHackers.MatterControl
private EventHandler unregisterEvents;
private RGBA_Bytes offWhite = new RGBA_Bytes(245, 245, 245);
private TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
public UpdateControlView()
public UpdateControlView(ThemeConfig theme)
{
textImageButtonFactory.normalFillColor = RGBA_Bytes.Gray;
textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;
this.HAnchor = HAnchor.ParentLeftRight;
this.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
this.Padding = new BorderDouble(6, 5);
HAnchor = HAnchor.ParentLeftRight;
BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
Padding = new BorderDouble(6, 5);
{
updateStatusText = new TextWidget(string.Format(""), textColor: ActiveTheme.Instance.PrimaryTextColor);
updateStatusText.AutoExpandBoundsToText = true;
updateStatusText.VAnchor = VAnchor.ParentCenter;
checkUpdateLink = textImageButtonFactory.Generate("Check for Update".Localize());
checkUpdateLink = theme.GrayButtonFactory.Generate("Check for Update".Localize());
checkUpdateLink.VAnchor = VAnchor.ParentCenter;
checkUpdateLink.Click += (s, e) =>
{
@ -68,7 +63,7 @@ namespace MatterHackers.MatterControl
};
checkUpdateLink.Visible = false;
downloadUpdateLink = textImageButtonFactory.Generate("Download Update".Localize());
downloadUpdateLink = theme.GrayButtonFactory.Generate("Download Update".Localize());
downloadUpdateLink.Visible = false;
downloadUpdateLink.VAnchor = VAnchor.ParentCenter;
downloadUpdateLink.Click += (s, e) =>
@ -79,7 +74,7 @@ namespace MatterHackers.MatterControl
UpdateControlData.Instance.InitiateUpdateDownload();
};
installUpdateLink = textImageButtonFactory.Generate("Install Update".Localize());
installUpdateLink = theme.GrayButtonFactory.Generate("Install Update".Localize());
installUpdateLink.Visible = false;
installUpdateLink.VAnchor = VAnchor.ParentCenter;
installUpdateLink.Click += (s, e) =>

View file

@ -70,6 +70,7 @@ namespace MatterHackers.MatterControl
public TextImageButtonFactory BreadCrumbButtonFactory { get; internal set; }
public TextImageButtonFactory BreadCrumbButtonFactorySmallMargins { get; internal set; }
public TextImageButtonFactory MenuButtonFactory { get; internal set; }
public TextImageButtonFactory GrayButtonFactory { get; internal set; }
public TextImageButtonFactory imageConverterExpandMenuOptionFactory;
public TextImageButtonFactory imageConverterButtonFactory;
@ -110,6 +111,7 @@ namespace MatterHackers.MatterControl
public void RebuildTheme()
{
var theme = ActiveTheme.Instance;
this.ImageButtonFactory = new TextImageButtonFactory()
{
normalFillColor = RGBA_Bytes.Transparent,
@ -189,6 +191,12 @@ namespace MatterHackers.MatterControl
FixedHeight = 32,
};
this.GrayButtonFactory = new TextImageButtonFactory()
{
normalFillColor = RGBA_Bytes.Gray,
normalTextColor = ActiveTheme.Instance.PrimaryTextColor
};
int buttonHeight;
if (UserSettings.Instance.IsTouchScreen)
{