Rename BeforeShowPopup to OnBeforePopup & use standard event pattern

This commit is contained in:
John Lewin 2017-12-19 17:06:33 -08:00
parent bbde00c3e4
commit 2d560f45c0
2 changed files with 7 additions and 3 deletions

View file

@ -38,6 +38,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private static readonly Color slightShade = new Color(0, 0, 0, 40);
public event EventHandler PopupWindowClosed;
public event EventHandler BeforePopup;
private GuiWidget buttonView;
private bool menuVisibileAtMouseDown = false;
@ -113,7 +114,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
return;
}
this.BeforeShowPopup();
this.OnBeforePopup();
popupWidget = new PopupWidget(this.PopupContent, PopupLayoutEngine, MakeScrollable)
{
@ -133,8 +134,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
popupWidget.Focus();
}
protected virtual void BeforeShowPopup()
protected virtual void OnBeforePopup()
{
this.BeforePopup?.Invoke(this, null);
}
}
}

View file

@ -71,12 +71,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
}
protected override void BeforeShowPopup()
protected override void OnBeforePopup()
{
if (this.PopupContent.BackgroundColor == Color.Transparent)
{
this.PopupContent.BackgroundColor = Color.White;
}
base.OnBeforePopup();
}
}
}