AddFeature(LicenseCode: String; [MakePermanent: Boolean=False]): UiLicenseStatusCode;
AddFeature(System.String, System.Boolean): Prognoz.Platform.Interop.ForeSystem.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\Prognoz 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.
To execute the example, place the Button and TextBox components named Button1 and TextBox1 on the form. Set the Multiline property to True for TextBox.
Add links to the Host, Ui, Fore, ForeSystem system assemblies.
The example is a handler of the OnClick event for the Button1 component.
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
WinApp: WinApplicationClassClass = New WinApplicationClassClass();
Svc: IForeServices;
RunContext: ForeRuntimeContext;
LicManager: ILicenseManager;
LicString: String;
StatusCode: UiLicenseStatusCode;
Begin
Svc := Self.Metabase As IForeServices;
RunContext := Svc.GetRuntime().Context;
LicManager := WinApp.Instance[RunContext].LicenseManager;
LicString := textBox1.Text;
StatusCode := LicManager.AddFeature(LicString, False);
If StatusCode = UiLicenseStatusCode.lscSuccess Then
WinApp.InformationBox("Code is successfully added", New IWin32WindowForeAdapter(Self));
Else
WinApp.InformationBox("Error: " + StatusCode.ToString(), New IWin32WindowForeAdapter(Self));
End If;
End Sub;
The example of Fore.NET example execution matches with that in the Fore example.
See also: