IUiLicenseManager.CheckoutCommuterLicense

Fore Syntax

CheckoutCommuterLicense(FeatureName: String): UiLicenseStatusCode;

Fore.NET Syntax

CheckoutCommuterLicense(FeatureName: String): Prognoz.Platform.Interop.ForeSystem.UiLicenseStatusCode;

Parameters

FeatureName.Feature name.

Description

The CheckoutCommuterLicense method checks out a local license enabling to use the application out of network environment from license server.

Comments

The method can be applied if a network license enabling to check out local temporary licenses is used (Network with the commuter attribute).

After the expiry of the use period, license must be checked in to license server using the CheckinCommuterLicense method. If license server is limited by number of users, on checking out a temporary license the number of simultaneously working users is reduced to one and on checking in the license the number of simultaneously working users is restored.

NOTE. Some network licenses enable the use if application out of network environment for a limited period (up to 30 days), for example, to use it on laptops on business trips. To do it, the network license can be used to check out a temporary stand-alone license (commuter).

Fore Example

To execute the example place the Button and Editbox components with the Button1 and Editbox1 identifiers correspondingly on the form, connect the Ui system assembly.

The example is a handler of the OnClick event for the Button1 component. A network license should be used.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var 
    LicManager: IUiLicenseManager;
    Feature: String;
    FeatureInfo: IUiLicenseFeatureInfo;
    StatusCode: UiLicenseStatusCode;
Begin
    LicManager := WinApplication.Instance.LicenseManager;
    Feature := EditBox1.Text;
    FeatureInfo:= LicManager.GetFeatureInfo(Feature);
    If FeatureInfo.CommuterAllowed Then
        StatusCode := LicManager.CheckoutCommuterLicense(Feature);
        If StatusCode = UiLicenseStatusCode.Success Then
            WinApplication.InformationBox("License is successfully checked out");
        Else 
            WinApplication.InformationBox(
"Error: " + StatusCode.ToString);     
        End If;
    End If;
End Sub Button1OnClick;

Enter to Editbox name of pre-installed feature, for example, PP_OLAP, and click the button. For the specified feature the temporary local license will be checked out, if it is possible, and the message indicating the result of temporary license checking out or the code of occurred error is displayed.

Fore.NET Example

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. The example is a handler of the OnClick event for the Button1 component. The example of the Fore.NET example execution matches with that in the Fore example.

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;
    Feature: String;
    FeatureInfo: IUiLicenseFeatureInfo;
    StatusCode: UiLicenseStatusCode;
Begin
    Svc := Self.Metabase As IForeServices;
    RunContext := Svc.GetRuntime().Context;
    LicManager := WinApp.Instance[RunContext].LicenseManager;
    Feature := textBox1.Text;
    FeatureInfo:= LicManager.GetFeatureInfo(Feature);
    If FeatureInfo.CommuterAllowed Then
        StatusCode := LicManager.CheckoutCommuterLicense(Feature);
        If StatusCode = UiLicenseStatusCode.lscSuccess Then
            WinApp.InformationBox("License is successfully checked out"New IWin32WindowForeAdapter(Self));
        Else 
            WinApp.InformationBox("Error: " + StatusCode.ToString(), New IWin32WindowForeAdapter(Self));       
        End If;
    End If;
End Sub;

See also:

IUiLicenseManager | Licensing Options