Skip to content

HYMMA/LicenseManagement.EndUser.Wpf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LicenseManagement.EndUser.Wpf

Build and Test NuGet NuGet Downloads License: MIT

WPF UI components for license-management.com end-user SDK.

This library provides ready-to-use WPF views and view models for license registration, validation display, and unregistration workflows.

Important

Account Required: This library requires a publisher account at license-management.com.

Free with Dev Subscription: A developer subscription is available at no cost, which provides full access to all features for development and testing purposes.

Features

  • Pre-built Views - Ready-to-use WPF windows for common license operations
  • MVVM Architecture - Clean separation with ViewModels and Commands
  • Value Converters - License status to UI element converters
  • Validation Rules - Input validation for receipt codes
  • Customizable - Use as-is or extend with your own styles

Installation

dotnet add package LicenseManagement.EndUser.Wpf

Or via NuGet Package Manager:

Install-Package LicenseManagement.EndUser.Wpf

Warning

Breaking Change in v2.0.0: The package has been renamed from Hymma.Lm.EndUser.Wpf to LicenseManagement.EndUser.Wpf. See the Migration Guide below.

Components

Views

View Description
MainWindow Main license management window (standalone)
LicenseControl Embeddable UserControl for license management
RegisterLicenseView Product key/receipt code entry
UnregisterView Computer unregistration confirmation
ErrorView Error display with details

Window vs UserControl

This package provides two ways to display license management UI:

  • MainWindow - A standalone Window that can be shown as a dialog. Use this when you want to show license management in a separate popup window.

  • LicenseControl - A UserControl that can be embedded directly into your application's UI. Use this when you want to integrate license management into an existing window, tab, or settings panel.

ViewModels

ViewModel Description
LicenseViewModel License status and details
ProductViewModel Product information display
RegisterLicenseViewModel Registration workflow logic
UnregisterViewModel Unregistration workflow logic
ErrorViewModel Error handling and display
BaseViewModel Base class with INotifyPropertyChanged

Converters

Converter Description
LicenseStatusConverter Converts LicenseStatusTitles to display strings
BooleanToVisibilityConverter Standard bool to Visibility converter
UtcToLocalTimeConverter Converts UTC DateTime to local time

Commands

Command Description
RelayCommand ICommand implementation for MVVM

Validation Rules

Rule Description
ReceiptCodeRule Validates receipt code format

Quick Start

Show License Window (Dialog)

using LicenseManagement.EndUser.Wpf.Views;
using LicenseManagement.EndUser.Wpf.ViewModels;

var mainWindow = new MainWindow();
mainWindow.License = new LicenseViewModel
{
    Status = LicenseStatusTitles.Valid,
    ExpirationDate = DateTime.UtcNow.AddMonths(6),
    ProductName = "My Product"
};
mainWindow.ShowDialog();

Embed LicenseControl in Your UI

<Window xmlns:views="clr-namespace:LicenseManagement.EndUser.Wpf.Views;assembly=LicenseManagement.EndUser.Wpf">
    <Grid>
        <!-- Other UI elements -->
        <views:LicenseControl x:Name="licenseControl" />
    </Grid>
</Window>
// In code-behind or ViewModel
licenseControl.License = new LicenseViewModel
{
    Status = LicenseStatusTitles.Valid,
    ExpirationDate = DateTime.UtcNow.AddMonths(6),
    ProductName = "My Product"
};

Show Registration Dialog

using LicenseManagement.EndUser.Wpf.Views;
using LicenseManagement.EndUser.Wpf.ViewModels;

var viewModel = new RegisterLicenseViewModel();
var view = new RegisterLicenseView
{
    DataContext = viewModel
};

if (view.ShowDialog() == true)
{
    string receiptCode = viewModel.ReceiptCode;
    // Process the receipt code
}

Display License Status

using LicenseManagement.EndUser.Wpf.ViewModels;

var licenseVm = new LicenseViewModel
{
    Status = LicenseStatusTitles.Valid,
    ExpirationDate = DateTime.UtcNow.AddMonths(6),
    ProductName = "My Product"
};

Use Converters in XAML

<Window xmlns:converters="clr-namespace:LicenseManagement.EndUser.Wpf.Converters.ValueConverters;assembly=LicenseManagement.EndUser.Wpf">
    <Window.Resources>
        <converters:LicenseStatusConverter x:Key="StatusConverter"/>
        <converters:UtcToLocalTimeConverter x:Key="TimeConverter"/>
    </Window.Resources>

    <TextBlock Text="{Binding Status, Converter={StaticResource StatusConverter}}"/>
    <TextBlock Text="{Binding ExpirationDate, Converter={StaticResource TimeConverter}}"/>
</Window>

Include Resource Dictionary

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/LicenseManagement.EndUser.Wpf;component/AppResources.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

Sample Application

We provide a complete sample WPF application demonstrating real-world usage patterns:

WPF Sample App

The WPF Sample Application demonstrates:

  • License validation at application startup
  • Handling different license states (Valid, Trial, Expired)
  • Feature gating based on license status
  • Integration with built-in license management UI
  • Centralized license service pattern
// Example: Validate license at startup
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
    var context = _licenseService.ValidateLicense(
        onLicFileNotFound: DownloadLicenseFile,
        onTrialEnded: HandleTrialEnded
    );
    UpdateFeatureAccess(context.LicenseModel.Status);
}

See the sample README for complete setup instructions.

Requirements

Migrating from v1.x

Version 2.0.0 introduces breaking changes: the namespace has been renamed from Hymma.Lm.EndUser.Wpf to LicenseManagement.EndUser.Wpf.

Steps to Migrate

  1. Update NuGet Package Reference

    # Remove old package
    dotnet remove package Hymma.Lm.EndUser.Wpf
    
    # Add new package
    dotnet add package LicenseManagement.EndUser.Wpf
  2. Update Namespace Imports in C# Replace all occurrences:

    // Old
    using Hymma.Lm.EndUser.Wpf.Views;
    using Hymma.Lm.EndUser.Wpf.ViewModels;
    using Hymma.Lm.EndUser.Wpf.Converters;
    
    // New
    using LicenseManagement.EndUser.Wpf.Views;
    using LicenseManagement.EndUser.Wpf.ViewModels;
    using LicenseManagement.EndUser.Wpf.Converters;
  3. Update XAML Namespaces

    <!-- Old -->
    xmlns:views="clr-namespace:Hymma.Lm.EndUser.Wpf.Views;assembly=Hymma.Lm.EndUser.Wpf"
    
    <!-- New -->
    xmlns:views="clr-namespace:LicenseManagement.EndUser.Wpf.Views;assembly=LicenseManagement.EndUser.Wpf"
  4. Update Resource Dictionary References

    <!-- Old -->
    <ResourceDictionary Source="pack://application:,,,/Hymma.Lm.EndUser.Wpf;component/AppResources.xaml"/>
    
    <!-- New -->
    <ResourceDictionary Source="pack://application:,,,/LicenseManagement.EndUser.Wpf;component/AppResources.xaml"/>

What Changed

v1.x v2.0.0
Hymma.Lm.EndUser.Wpf namespace LicenseManagement.EndUser.Wpf namespace
Hymma.Lm.EndUser.Wpf.dll LicenseManagement.EndUser.Wpf.dll
NuGet: Hymma.Lm.EndUser.Wpf NuGet: LicenseManagement.EndUser.Wpf

New in v2.0.0

  • LicenseControl - A new embeddable UserControl for integrating license management directly into your application's UI, as an alternative to the standalone MainWindow dialog.

Changelog

See CHANGELOG.md for version history and release notes.

License

MIT - See LICENSE for details.

Related Packages

Documentation

About

WPF UI components for license-management.com end-user SDK

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages