Lock down wizard left-nav unless on homepage
- Issue MatterHackers/MCCentral#5377
This commit is contained in:
parent
c0be9df31e
commit
778d83d2bc
2 changed files with 66 additions and 2 deletions
|
|
@ -59,6 +59,12 @@ namespace MatterHackers.MatterControl
|
|||
activeButton.Active = false;
|
||||
}
|
||||
|
||||
// Ensure all or only the active stage is enabled
|
||||
foreach (var kvp in rowsByStage)
|
||||
{
|
||||
kvp.Value.Enabled = value == null || kvp.Key == value;
|
||||
}
|
||||
|
||||
// Shutdown the active Wizard
|
||||
_activeStage?.Dispose();
|
||||
|
||||
|
|
@ -115,7 +121,11 @@ namespace MatterHackers.MatterControl
|
|||
stageWidget.Enabled = stage.Enabled;
|
||||
stageWidget.Click += (s, e) =>
|
||||
{
|
||||
this.ActiveStage = stage;
|
||||
// Only allow leftnav when not running SetupWizard
|
||||
if (this.ActiveStage == null)
|
||||
{
|
||||
this.ActiveStage = stage;
|
||||
}
|
||||
};
|
||||
|
||||
rowsByStage.Add(stage, stageWidget);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ using MatterHackers.Agg;
|
|||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.ImageProcessing;
|
||||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
|
|
@ -40,7 +41,9 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
private ISetupWizard stage;
|
||||
private ImageBuffer completedIcon;
|
||||
private ImageBuffer disabledCompletedIcon = null;
|
||||
private ImageBuffer setupIcon;
|
||||
private ImageBuffer disabledSetupIcon = null;
|
||||
private ImageBuffer hoverIcon;
|
||||
private double iconXOffset;
|
||||
private double iconYOffset;
|
||||
|
|
@ -56,8 +59,15 @@ namespace MatterHackers.MatterControl
|
|||
hoverIcon = AggContext.StaticData.LoadIcon("expand.png", 16, 16, theme.InvertIcons);
|
||||
}
|
||||
|
||||
|
||||
public bool Active { get; set; }
|
||||
|
||||
public override Cursors Cursor
|
||||
{
|
||||
get => this.Active ? Cursors.Default : base.Cursor;
|
||||
set => base.Cursor = value;
|
||||
}
|
||||
|
||||
public override Color BackgroundColor
|
||||
{
|
||||
get => (Active) ? theme.AccentMimimalOverlay : base.BackgroundColor;
|
||||
|
|
@ -83,10 +93,54 @@ namespace MatterHackers.MatterControl
|
|||
if (!this.Active)
|
||||
{
|
||||
graphics2D.Render(
|
||||
(mouseInBounds) ? hoverIcon : (stage.SetupRequired) ? setupIcon : completedIcon,
|
||||
this.StageIcon,
|
||||
iconXOffset,
|
||||
iconYOffset);
|
||||
}
|
||||
}
|
||||
|
||||
private ImageBuffer StageIcon
|
||||
{
|
||||
get
|
||||
{
|
||||
ImageBuffer icon;
|
||||
|
||||
if (mouseInBounds
|
||||
&& this.Enabled)
|
||||
{
|
||||
icon = hoverIcon;
|
||||
}
|
||||
else if (stage.SetupRequired)
|
||||
{
|
||||
icon = setupIcon;
|
||||
|
||||
if (!this.Enabled)
|
||||
{
|
||||
if (disabledSetupIcon == null)
|
||||
{
|
||||
disabledSetupIcon = icon.AjustAlpha(0.2);
|
||||
}
|
||||
|
||||
icon = disabledSetupIcon;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = completedIcon;
|
||||
|
||||
if (!this.Enabled)
|
||||
{
|
||||
if (disabledCompletedIcon == null)
|
||||
{
|
||||
disabledCompletedIcon = icon.AjustAlpha(0.2);
|
||||
}
|
||||
|
||||
icon = disabledCompletedIcon;
|
||||
}
|
||||
}
|
||||
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue