ILicenseManager.AddFeature

Fore Syntax

AddFeature(LicenseCode: String; [MakePermanent: Boolean=False]): UiLicenseStatusCode;

Fore.NET Syntax

AddFeature(System.String, System.Boolean): Prognoz.Platform.Interop.ForeSystem.UiLicenseStatusCode;

Parameters

LicenseCode. License activation code.

MakePermanent. The parameter is used to save activation code:

Description

The AddFeature method adds a license code.

Comments

The method is relevant if a stand-alone license is used. Otherwise the corresponding message is displayed.

Fore Example

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.

Fore.NET Example

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:

ILicenseManager