FeatureName: String;
FeatureName: String;
The FeatureName property returns feature name.
To execute the example, place the Button, Editbox and Memo components named Button1, Editbox1 and Memo1 on the form.
Add links to the Host, Ui, Forms, Collections 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;
Lic: ILicense;
StatusCode: UiLicenseStatusCode;
Info: IStringList;
Begin
LicManager := WinApplication.Instance.LicenseManager;
Feature := Editbox1.Text;
StatusCode := LicManager.RequestLicense(Feature, Lic);
If StatusCode = UiLicenseStatusCode.Success Then Lic.LicenseUpdate;
Memo1.Clear;
Info := Memo1.Lines;
Info.Add("Feature: " + Lic.FeatureName + ";");
Info.Add("It is used as temporary local license: " + Lic.IsCommuter.ToString + ";");
Info.Add("Server: " + Lic.ServerName + ";");
Else
// handle licensing errors
//...
Return;
End If;
//After the work is finished, release license
If Lic <> Null Then
Lic.LicenseRelease;
End If;
End Sub Button1OnClick;
After executing the example enter name of the preinstalled feature into Editbox, for example, PP_OLAP, and click the button. Memo displays the information about the specified feature.
To execute the example, place the Button component and two TextBox components named Button1, TextBox1 and TextBox2 on the form. Set the Multiline property to True for the second TextBox2 component.
Add links to the Host, Ui, Forms, 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.Forms;
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;
Lic: ILicense;
StatusCode: UiLicenseStatusCode;
Info: List<String> = New List<string>();
Begin
Svc := Self.Metabase As IForeServices;
RunContext := Svc.GetRuntime().Context;
LicManager := WinApp.Instance[RunContext].LicenseManager;
Feature := textBox1.Text;
StatusCode := LicManager.RequestLicense(Feature, Var Lic, Null, RunContext);
If StatusCode = UiLicenseStatusCode.lscSuccess Then
Lic.LicenseUpdate();
Info.Add("Feature: " + Lic.FeatureName);
Info.Add("It is used as temporary local license: " + Lic.IsCommuter.ToString());
Info.Add("Server: " + Lic.FeatureName);
textBox2.Clear();
textBox2.Lines := info.ToArray();
Else
// handle licensing errors
//...
Return;
End If;
//After the work is finished, release license
If Lic <> Null Then
Lic.LicenseRelease();
End If;
End Sub;
After executing the example enter name of the preinstalled feature into TextBox1, for example, PP_OLAP, and click the button. TextBox2 will display information about the set feature.
See also: