SDK integration
Start once and dispose once
Own one handle for the plugin lifetime. Do not restart licensing for each command, component solve, or document.
Start one license handle
using Drawspan.Client;
private DrawspanLicense? _license;
public void OnLoad()
{
_license = DrawspanLicense.Start(new DrawspanOptions
{
ProductId = "your-product-id",
VendorConfig = YourVendorConfig.Instance,
HostApp = "Your host",
HostVersion = "2026"
});
_license.StateChanged += OnLicenseStateChanged;
} Start returns immediately and does not throw for environmental failures. A valid cached lease may already make Status licensed before it returns.
Read current status at the action
Keep the handle and check Status again inside the host command or solve callback. The state may change after startup, so the protected action—not merely the surrounding window—must make the decision.
Handle state changes on the right thread
Do not call Revit API objects from the callback.
Dispose when the plugin unloads
public void OnUnload()
{
_license?.Dispose();
}Dispose the same handle during orderly plugin or application shutdown.