Oakrey.Applications.License 4.0.5

dotnet add package Oakrey.Applications.License --version 4.0.5
                    
NuGet\Install-Package Oakrey.Applications.License -Version 4.0.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Oakrey.Applications.License" Version="4.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Oakrey.Applications.License" Version="4.0.5" />
                    
Directory.Packages.props
<PackageReference Include="Oakrey.Applications.License" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Oakrey.Applications.License --version 4.0.5
                    
#r "nuget: Oakrey.Applications.License, 4.0.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Oakrey.Applications.License@4.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Oakrey.Applications.License&version=4.0.5
                    
Install as a Cake Addin
#tool nuget:?package=Oakrey.Applications.License&version=4.0.5
                    
Install as a Cake Tool

Oakrey.Applications.License

A .NET 10 WPF library for managing application licenses. It provides signature and threshold-based validation, trial and expiration support, reactive license status via IObservable<bool>, a ready-made LicenseWindow WPF dialog, and a typed exception hierarchy.


Main features

  • Multiple validatorsSignatureLicenseValidator, ThresholdLicenseValidator, and EnumerableLicenseValidator cover the most common validation strategies out of the box.
  • ILicenseService � abstraction for requesting full licenses, requesting trial licenses, and checking local license validity. Exposes IsLicensed, IsTrial, IsExpired, ExpirationDate, LicenseInfo, and LicenseWarning. Implements IObservable<bool> for reactive status updates.
  • LicenseWindow � a WPF dialog (extends DarkWindow) with sign-in, trial request, and "continue without license" flows. Exposed as ShowAsync() returning a ValidationResult.
  • Exception hierarchy � typed exceptions for all failure modes (see below).
  • ExtensibleILicenseValidator and ILicenseService can be implemented independently.

Architecture

Oakrey.Applications.License
|
+-- Validation
|   +-- ILicenseValidator               interface
|   +-- SignatureLicenseValidator        validates cryptographic signature only
|   +-- ThresholdLicenseValidator        requires N or more matching license keys
|   +-- EnumerableLicenseValidator       requires all specified keys to match
|
+-- Service
|   +-- ILicenseService                 interface (IObservable<bool>)
|
+-- UI
|   +-- LicenseWindow                   WPF dialog for end-user license activation
|
+-- Exceptions
    +-- LicenseException                base exception
    +-- LicenseManagerException         manager-level failure (inherits LicenseException)
    +-- LicenseTimeoutException         license server connection timeout

Exception hierarchy:

classDiagram
    Exception <|-- LicenseException
    LicenseException <|-- LicenseManagerException
    LicenseException <|-- LicenseTimeoutException

Requirements

  • .NET 10 (net10.0-windows10.0.17763)
  • Windows (WPF)
  • Dependencies: Oakrey.License, Oakrey.License.Windows, Oakrey.Wpf.Converters

Installation

.NET CLI

dotnet add package Oakrey.Applications.License

Package Manager Console

Install-Package Oakrey.Applications.License

NuGet Package Manager in Visual Studio

Navigate to Tools > NuGet Package Manager > Manage NuGet Packages for Solution, search for Oakrey.Applications.License, and install.


Usage

Validating a license

// Signature only
ILicenseValidator validator = new SignatureLicenseValidator();
bool valid = validator.Validate(validationResult);

// All listed feature keys must be present and non-expired
ILicenseValidator validator = new EnumerableLicenseValidator("feature-a", "feature-b");
bool valid = validator.Validate(validationResult);

// At least 2 of the matching keys must be valid and non-expired
ILicenseValidator validator = new ThresholdLicenseValidator(threshold: 2);
bool valid = validator.Validate(validationResult);

Using ILicenseService

// Validate a locally cached license
ValidationResult result = await licenseService.IsLocalLicenseValid(cancellationToken);

// Request a full license for a user
ValidationResult result = await licenseService.RequestLicense(userId, cancellationToken);

// Request a trial license
ValidationResult result = await licenseService.RequestTrialLicense(cancellationToken);

// React to license status changes
licenseService.Subscribe(isLicensed =>
{
    // called whenever license status changes
});

Showing the LicenseWindow

LicenseWindow window = new LicenseWindow(licenseService, appId: "my-app");
window.IsTrialEnabled = true;
window.IsNoLicenseEnabled = false;

ValidationResult result = await window.ShowAsync();

ShowAsync() returns only after the user completes or cancels the flow. If the user closes the window without activating, the application is shut down (default behavior of the close button).

Exception handling

try
{
    ValidationResult result = await licenseService.RequestLicense(userId, cancellationToken);
}
catch (LicenseTimeoutException)
{
    // License server could not be reached within the timeout period.
}
catch (LicenseManagerException ex)
{
    // A manager-level license failure occurred.
}
catch (LicenseException ex)
{
    // General license failure.
}

Development notes

  • LicenseWindow extends DarkWindow from Oakrey.Applications.UI and must run on the WPF dispatcher thread. ShowAsync() handles dispatcher marshalling internally.
  • All ILicenseService methods accept a CancellationToken.
  • The window prevents closing before a result is produced; the only exit without a result triggers Application.Current.Shutdown().

Project information

Field Value
Package ID Oakrey.Applications.License
Author Oakrey
License MIT
Repository ApplicationServices
Project URL oakrey.cz
NuGet Oakrey.Applications.License
Product Compatible and additional computed target framework versions.
.NET net10.0-windows10.0.17763 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.5 0 5/15/2026
4.0.4 120 3/13/2026
4.0.3 108 3/11/2026
4.0.2 125 2/11/2026
4.0.1 116 1/16/2026
4.0.0 436 11/18/2025
3.0.0 213 10/22/2025
2.2.2 195 10/10/2025
2.2.1 241 9/29/2025
2.2.0 231 9/8/2025
2.1.0 228 7/1/2025
2.0.0 335 6/9/2025
1.0.0 305 4/17/2025