Listing 7 A component that displays a visible message when used in evaluation mode
using System; using System.ComponentModel; using System.Windows.Forms; [LicenseProvider(typeof(EvaluationLicenseProvider))] public class TryAndBuyComponent : UserControl { private Label evaluationLabel; private void InitializeComponent() { this.evaluationLabel = new System.Windows.Forms.Label(); this.evaluationLabel.Text = "Evaluation Mode"; this.Controls.Add( this.evaluationLabel ); } public TryAndBuyComponent() { CustomLicense license; InitializeComponent(); license = (CustomLicense) LicenseManager.Validate( typeof(TryAndBuyComponent), this ); if ( license.IsEvaluation ) evaluationLabel.Visible = true; else evaluationLabel.Visible = false; license.Dispose(); } }