AddFeature(LicenseCode: String; [MakePermanent: Boolean=False]): UiLicenseStatusCode;
LicenseCode. License activation code.
MakePermanent. The parameter is used to save activation code:
If the parameter is set to True, the code is saved into the license file: %PROGRAMDATA%\Foresight\Foresight Analytics Platform\lservrc.
If the parameter is set to False, the code will be added only to the current session. The default parameter value is False.
The AddFeature method adds a license code.
The method is relevant if a stand-alone license is used. Otherwise the corresponding message is displayed.
To execute the example, place the Button and Editbox buttons named Button1 and Editbox1 on the form.
Add links to the Host, Ui, Forms system assemblies.
The example is a handler of the OnClick event for the Button1 component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
LicManager: ILicenseManager;
LicString: String;
StatusCode: UiLicenseStatusCode;
Begin
LicManager := WinApplication.Instance.LicenseManager;
LicString := Editbox1.Text;
StatusCode := LicManager.AddFeature(LicString, False);
If StatusCode = UiLicenseStatusCode.Success Then
WinApplication.InformationBox("Code is successfully added");
Else
WinApplication.InformationBox("Error: " + StatusCode.ToString);
End If;
End Sub Button1OnClick;
After clicking the button the activation code specified in Editbox is added to be used in the current session. The appropriate message with code adding result is displayed. If errors occur on adding, the message with a code of the occurred error is displayed.
See also: