LicenseRequest(FeatureName: String; Var License: ILicense; [Settings: ILicenseRequestSettings = Null]): UiLicenseStatusCode;
FeatureName. Feature name.
NOTE. Parameter's value is empty, if the Settings parameter sends feature type using the FeatureType property.
License. License.
Settings. Object to work with unit activation wizard. If required feature is unavailable, use the ShowActivationWizard property to display the Unit Activation dialog box. The property is set to False by default, the activation dialog box is not displayed.
NOTE. Value of the True property is used only to check stand-alone license, on checking the network license and if the asked feature is absent, the error message is displayed.
The LicenseRequest method checks if the set feature exists, and returns check result.
A feature can be checked both for network and stand-alone license.
After checking out a license, update it using ILicense.LicenseUpdate.
After the work with the licensing block is finished, release the license using ILicense.LicenseRelease, that is, remove the object with the license.
If application features are used, create a specific lsinit.exe containing information about it. For details see the Application System Licensing article.
If a valid activation code is specified in the unit activation dialog box, the feature code is saved to file. A stand-alone license file is stored at: %PROGRAMDATA%\Foresight\Foresight Analytics Platform\lservrc.
If the method is used, the license type is checked:
If the network license is used and the requested feature is absent, the error message is displayed instead of the activation dialog box. License activation in the network mode is not supported.
If the server contains the requested license, license search settings will be changed to stand-alone license for the current user.
If a stand-alone license is used and the requested feature is absent, the activation dialog box opens.
To execute the example, place the Button component named Button1 on the form.
Add links to the Host, Forms, Ui, and Fore system assemblies.
The example is a handler of the OnClick event for the Button1 component. Execute the example without debugging.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
LicManager: ILicenseManager;
Feature: String;
Lic: ILicense;
StatusCode: UiLicenseStatusCode;
Settings: IUiLicenseRequestSettings;
Begin
LicManager := WinApplication.Instance.LicenseManager;
//Feature := "PP_WordAddIn";
Settings := New UiLicenseRequestSettings.Create;
Settings.FeatureType := UiLicenseFeatureType.WordAddin;
Settings.ShowActivationWizard := True;
//StatusCode := LicManager.RequestLicense(Feature, Lic, Settings);
StatusCode := LicManager.RequestLicense("", Lic, Settings);
If StatusCode = UiLicenseStatusCode.Success Then
Lic.LicenseUpdate;
Else
// handle licensing errors
//...
End If;
//Work with licensed block
//...
//After the work is finished, release license
If Lic <> Null Then
Lic.LicenseRelease;
End If;
End Sub Button1OnClick;
Clicking the button requests the PP_WordAddin feature. If it is not available, the Unit Activation dialog box opens.
See also: