LicenseRequest(FeatureName: String; Var License: ILicense; [ShowActivationWizard: Boolean = False]): UiLicenseStatusCode;
LicenseRequest(FeatureName: string, var License: Prognoz.Platform.Interop.Ui.ILicense, ShowActivationWizard: boolean, pContext: Prognoz.Platform.Interop.Fore.ForeRuntimeContext): Prognoz.Platform.Interop.ForeSystem.UiLicenseStatusCode;
FeatureName. Feature name.
License. License.
ShowActivationWizard. The parameter that determines whether the Unit Activation dialog box opens, when the requested feature is not available. By default, the parameter is set to False, and activation dialog box does not open.
NOTE. Value of the True parameter 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.
Context. Context. It is relevant only for Fore.NET.
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. The stand-alone license file is stored here: %PROGRAMDATA%\Foresight\Prognoz 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 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;
Lic: ILicense;
StatusCode: UiLicenseStatusCode;
Settings: IUiLicenseRequestSettings;
Begin
LicManager := WinApplication.Instance.LicenseManager;
Feature := "ApplicationFeature";
Settings := New UiLicenseRequestSettings.Create;
Settings.FeatureType := UiLicenseFeatureType.WordAddin;
Settings.ShowActivationWizard := True;
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.
To execute the example, place the Button component named Button1 on the form.
Add links to the Host, Ui, Fore, ForeSystem system assemblies.
The example is the OnClick event handler for the Button1 component. Execute the example without debugging.
Imports Prognoz.Platform.Interop.Host;
Imports Prognoz.Platform.Interop.Ui;
Imports Prognoz.Platform.Interop.Fore;
Imports Prognoz.Platform.Interop.ForeSystem;
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
LicManager: ILicenseManager;
Lic: ILicense;
StatusCode: UiLicenseStatusCode;
Settings: UiLicenseRequestSettingsClass = New UiLicenseRequestSettingsClass();
WinApp: WinApplicationClassClass = New WinApplicationClassClass();
Svc: IForeServices;
RunContext: ForeRuntimeContext;
Begin
Svc := Self.Metabase As IForeServices;
RunContext := Svc.GetRuntime().Context;
LicManager := WinApp.Instance[RunContext].LicenseManager;
Settings.FeatureType := UiLicenseFeatureType.lftWordAddin;
Settings.ShowActivationWizard := True;
StatusCode := LicManager.RequestLicense("", Var Lic, Settings As LicenseRequestSettings, RunContext);
If StatusCode = UiLicenseStatusCode.lscSuccess 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;
The example of Fore.NET example execution matches with that in the Fore example.
See also: