AddFeature(LicenseCode: String; [MakePermanent: Boolean=False]; ): UiLicenseStatusCode;
AddFeature(LicenseCode: String; MakePermanent: Boolean=False; ): Prognoz.Platform.Interop.ForeSystem.UiLicenseStatusCode;
LicenseCode. License activation code.
MakePermanent. Parameter is used to save activation code:
If the parameter is set to True, the code will be saved to 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 parameter is set to False by default.
The AddFeature method adds a license code.
The method is relevant for use only if a stand-alone license is used. Otherwise the appropriate message is displayed.
To execute the example, place the Button and Editbox components with the Button1 and Editbox1 identifiers on the form and add a link to the the Ui system assembly. The example is a handler of the OnClick event for the Button1 component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
LicManager: IUiLicenseManager;
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("Status: " + StatusCode.ToString);
End If;
End Sub Button1OnClick;
Clicking the button adds the entered activation code to Editbox to use for the current session.The appropriate message about code adding result is displayed.
To execute the example, add links to the Ui, Fore, ForeSystem system assemblies. Place the Button and TextBox components with the Button1 and TextBox1 identifiers on the form. Set the Multiline property to True for TextBox. The example is a handler of the OnClick event for the Button1 component.
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: IUiLicenseManager;
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("Status: " + StatusCode.ToString(), New IWin32WindowForeAdapter(Self));
End If;
End Sub;
On clicking the button the activation code entered in TextBox will be added for use to the current session. The message about code adding result will be displayed.
See also: