Remove WhiteButtonFactory

This commit is contained in:
John Lewin 2018-07-11 15:08:07 -07:00
parent 1e732ca77d
commit bf70bb0809
4 changed files with 28 additions and 37 deletions

View file

@ -120,7 +120,6 @@ namespace MatterHackers.MatterControl
public BorderDouble TabbarPadding { get; set; } = new BorderDouble(3, 1);
public TextImageButtonFactory WhiteButtonFactory { get; private set; }
public TextImageButtonFactory ButtonFactory { get; private set; }
/// <summary>
@ -251,25 +250,6 @@ namespace MatterHackers.MatterControl
PressedTextColor = Color.Black,
PressedFillColor = Color.LightGray,
};
#region PartPreviewWidget
WhiteButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
{
FixedWidth = sideBarButtonWidth,
FixedHeight = TabButtonHeight,
NormalTextColor = Color.Black,
NormalFillColor = Color.White,
NormalBorderColor = new Color(colors.PrimaryTextColor, 200),
HoverTextColor = Color.Black,
HoverFillColor = new Color(255, 255, 255, 200),
HoverBorderColor = new Color(colors.PrimaryTextColor, 200),
BorderWidth = 1,
});
#endregion
}
public JogControls.MoveButton CreateMoveButton(PrinterConfig printer, string label, PrinterConnection.Axis axis, double movementFeedRate, bool levelingButtons = false)
@ -325,17 +305,29 @@ namespace MatterHackers.MatterControl
return radioButton;
}
public TextButton CreateLightDialogButton(string text)
{
return CreateDialogButton(text, new Color(Color.White, 15), new Color(Color.White, 25));
}
public TextButton CreateDialogButton(string text)
{
return CreateDialogButton(text, this.MinimalShade, this.SlightShade);
}
public TextButton CreateDialogButton(string text, Color backgroundColor, Color hoverColor)
{
#if !__ANDROID__
return new TextButton(text, this)
{
BackgroundColor = this.MinimalShade
BackgroundColor = backgroundColor,
HoverColor = hoverColor
};
#else
var button = new TextButton(text, this, this.FontSize14)
{
BackgroundColor = this.MinimalShade,
BackgroundColor = backgroundColor,
HoverColor = hoverColor,
// Enlarge button height and margin on Android
Height = 34 * GuiWidget.DeviceScale,
};

View file

@ -43,11 +43,11 @@ namespace MatterHackers.MatterControl
private TextWidget generalError;
private Button connectButton;
private Button skipButton;
private Button nextButton;
private Button retryButton;
private Button troubleshootButton;
private GuiWidget connectButton;
private GuiWidget skipButton;
private GuiWidget nextButton;
private GuiWidget retryButton;
private GuiWidget troubleshootButton;
private TextWidget skipMessage;
@ -77,12 +77,11 @@ namespace MatterHackers.MatterControl
Margin = new BorderDouble(0, 6)
};
//Construct buttons
connectButton = theme.WhiteButtonFactory.Generate("Connect".Localize());
connectButton = theme.CreateLightDialogButton("Connect".Localize());
connectButton.Margin = new BorderDouble(0,0,10,0);
connectButton.Click += ConnectButton_Click;
skipButton = theme.WhiteButtonFactory.Generate("Skip".Localize());
skipButton = theme.CreateLightDialogButton("Skip".Localize());
skipButton.Click += NextButton_Click;
connectButtonContainer.AddChild(connectButton);
@ -103,12 +102,12 @@ namespace MatterHackers.MatterControl
contentRow.AddChild(generalError);
//Construct buttons
retryButton = theme.WhiteButtonFactory.Generate("Retry".Localize());
retryButton = theme.CreateLightDialogButton("Retry".Localize());
retryButton.Click += ConnectButton_Click;
retryButton.Margin = new BorderDouble(0,0,10,0);
//Construct buttons
troubleshootButton = theme.WhiteButtonFactory.Generate("Troubleshoot".Localize());
troubleshootButton = theme.CreateLightDialogButton("Troubleshoot".Localize());
troubleshootButton.Click += (s, e) => UiThread.RunOnIdle(() =>
{
DialogWindow.ChangeToPage<SetupWizardTroubleshooting>();
@ -128,7 +127,7 @@ namespace MatterHackers.MatterControl
contentRow.AddChild(retryButtonContainer);
//Construct buttons
nextButton = theme.ButtonFactory.Generate("Continue".Localize());
nextButton = theme.CreateDialogButton("Continue".Localize());
nextButton.Click += NextButton_Click;
nextButton.Visible = false;

View file

@ -42,7 +42,7 @@ namespace MatterHackers.MatterControl
"MatterControl was unable to connect to the Internet. Please check your Wifi connection and try again".Localize() + "...",
textColor: ActiveTheme.Instance.PrimaryTextColor));
Button configureButton = theme.WhiteButtonFactory.Generate("Configure Wifi".Localize());
var configureButton = theme.CreateDialogButton("Configure Wifi".Localize());
configureButton.Margin = new BorderDouble(0, 0, 10, 0);
configureButton.Click += (s, e) =>
{

View file

@ -58,14 +58,14 @@ namespace MatterHackers.MatterControl
};
//Construct buttons
Button skipButton = theme.WhiteButtonFactory.Generate("Skip".Localize());
var skipButton = theme.CreateLightDialogButton("Skip".Localize());
skipButton.Click += Continue_Click;
Button nextButton = theme.ButtonFactory.Generate("Continue".Localize());
var nextButton = theme.CreateLightDialogButton("Continue".Localize());
nextButton.Click += Continue_Click;
nextButton.Visible = false;
Button configureButton = theme.WhiteButtonFactory.Generate("Configure".Localize());
var configureButton = theme.CreateLightDialogButton("Configure".Localize());
configureButton.Margin = new BorderDouble(0, 0, 10, 0);
configureButton.Click += (s, e) =>
{