ILicenseManager.CheckoutCommuterLicense

Fore Syntax

CheckoutCommuterLicense(FeatureName: String): UiLicenseStatusCode;

Fore.NET Syntax

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

Parameters

FeatureName. Feature name.

Description

The CheckoutCommuterLicense method checks out a local license, enabling to use the application offline, from license server.

Comments

The method is relevant when a network license is used that enables the user to check out temporary local licenses.

After the expiry of the use period, license should be checked in to license server using the ILicenseManager.CheckinCommuterLicense method. If license server is limited by number of users, on checking out 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 of application offline up to 30 days, for example, to be used on laptops during business trips. To do it, the network license enables the user to check out temporary local license.

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;
    Feature: String;
    FeatureInfo: ILicenseFeatureInfo;
    StatusCode: UiLicenseStatusCode;
Begin
    LicManager := WinApplication.Instance.LicenseManager;
    Feature := EditBox1.Text;
    FeatureInfo := LicManager.FeatureInfo(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 name of the preinstalled feature into Editbox, for example, PP_OLAP, and click the button. A temporary local license is checked out for the specified feature, if it is possible, and a message with temporary license checkout result is also displayed or with the code of occurred error.

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;
    Feature: String;
    FeatureInfo: ILicenseFeatureInfo;
    StatusCode: UiLicenseStatusCode;
Begin
    Svc := Self.Metabase 
As IForeServices;
    RunContext := Svc.GetRuntime().Context;
    LicManager := WinApp.Instance[RunContext].LicenseManager;
    Feature := textBox1.Text;
    FeatureInfo := LicManager.FeatureInfo(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;

The example of Fore.NET example execution matches with that in the Fore example.

See also:

ILicenseManager