A shared library, which enables licensing of your .NET MAUI applications.
This extension needs a WooCommerce powered store and the WP Software License Plugin (https://wpsoftwarelicense.com/)
Learn more here: https://andreas-reitberger.de/en/docs/programmieren/net-maui-basis-applikation-app-template/lizenz-manager/
Get the latest version from nuget.org
Please find a list of available content below.
xmlns:behaviors="clr-namespace:AndreasReitberger.Shared.Core.Licensing;assembly=SharedMauiCoreLibrary.Licensing"using AndreasReitberger.Shared.Core.LicensingIn order to use LicenseManager, create a new Instance like shown below. .
string licenseUri = "andreas-reitberger.de";
LicenseManager manager;
//....
manager = new LicenseManager.LicenseManagerConnectionBuilder()
.WithLicenseServer(serverAddress: licenseUri, port: null, https: true)
.Build();For the licenseUri use the base WordPress store address without https:\\ (like shown above).
The next step is to create a ILicenseInfo with the details of your product created in your WooCommerece store.
info = new LicenseInfo.LicenseInfoBuilder()
.WithLicense("The license key you want to check")
.WithOptions(new LicenseOptions()
{
ProductName = "Name of your product",
ProductIdentifier = "Your unique ProductId",
LicenseCheckPattern = "^AR-((\\w{8})-){2}(\\w{8})$",
})
.Build();If all is setup, you can perform following methods depending on your needs. All will return an ILicenseQueryResult object.
ILicenseQueryResult result = await manager.CheckLicenseAsync(license: info, LicenseServerTarget.WooCommerce);
Assert.IsTrue(result?.Success == true);
result = await manager.DeactivateLicenseAsync(license: info, LicenseServerTarget.WooCommerce);
Assert.IsTrue(result?.Success == true);
result = await manager.CheckLicenseAsync(license: info, LicenseServerTarget.WooCommerce);
Assert.IsTrue(result?.Success == false);
result = await manager.ActivateLicenseAsync(license: info, LicenseServerTarget.WooCommerce);
Assert.IsTrue(result?.Success == true);