A simple UI component in Razor that shows transient notice messages. It creates a Panel with class "notice" and a Label for the message, adds it to the component, and schedules deletion after 1 second.
@using Sandbox
@using Sandbox.UI
@using Sandbox.Utility
@inherits PanelComponent
@namespace Sandbox
<root>
</root>
@code
{
public void Display( string message )
{
var panel = new Panel();
panel.SetClass("notice", true);
panel.AddChild( new Label( message ) );
Panel.AddChild( panel );
Invoke( 1, () => panel.Delete() );
}
}