LicenPro
Documentation.NET SDKWPF

WPF integration

WPF uses the identical LicenPro package and APIs as WinForms. There is no separate WPF-specific SDK or ILicenseService shipped by LicenPro — you wrap LicenseClient in your own service registered in DI, keep it alive for the process lifetime, and marshal events to the UI thread as needed.

1. Application startup

Call bootstrap before showing the main window so staged updates and JSON settings load exactly like WinForms.

using System.Windows;
using LicenPro.SDK.AppHosting;

public partial class App : Application
{
    protected override void OnStartup(StartupEventArgs e)
    {
        SdkBootstrap.OnApplicationStartup();
        base.OnStartup(e);
    }
}

2. Async validation without blocking the UI thread

Construct LicenseClient on a background thread or the UI thread, but always await validation. LicenseClient captures SynchronizationContext.Current when created; expiry warnings (LicenseExpiringSoon) are posted back to that context, so constructing the client on the UI thread keeps dialogs safe.

3. MVVM-oriented layering

Recommended shape:

  • ILicenseService (your interface) wraps LicenseClient, exposes Task-based validate / try-auto-validate, and forwards SessionDisconnected.
  • App-level host owns service lifetime and calls DisposeAsync on shutdown.
  • View models bind commands to the service; never block the UI thread with synchronous validation APIs.

4. Hardware identity

The SDK computes a composite hardware fingerprint internally for activation and update checks. You normally do not need a separate “WPF hardware provider”; only supply IHardwareIdentifier in advanced test scenarios.

5. Further reading