Opening a dialog box for creating a new custom class.
None
If a new custom class is successfully created, the Execute method returns the key of the new class, otherwise it returns -1.
To execute the example, add links to the Metabase, Ui, Fore (for Fore.NET example) system assemblies.
Sub UserProc;
Var
Target: IUiCommandTarget;
Context: IUiCommandExecutionContext;
Result: Integer;
Begin
Target := WinApplication.Instance.GetPluginTarget("Std");
Context := Target.CreateExecutionContext;
Context.Data := MetabaseClass.Active;
Result := Target.Execute("CreateCustomClass", Context);
Debug.WriteLine(Result);
End Sub UserProc;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Ui;
Imports Prognoz.Platform.Interop.Fore;
…
Public Shared Sub Main(Params: StartParams);
Var
Target: IUiCommandTarget;
Context: IUiCommandExecutionContext;
Result: Object;
Svc: IForeServices;
RunContext: ForeRuntimeContext;
WinApp: WinApplicationClassClass = New WinApplicationClassClass();
Begin
Svc := Params.Metabase As IForeServices;
RunContext := Svc.GetRuntime().Context;
Target := WinApp.Instance[RunContext].GetPluginTarget("Std");
Context := Target.CreateExecutionContext();
Context.Data := Params.Metabase;
Result := Target.Execute("CreateCustomClass", Context, RunContext);
System.Diagnostics.Debug.WriteLine(Result);
End Sub;
After executing the example a dialog box opens for creating a custom class. Set class parameters and click the ОК button. The console displays the key of the created class or -1 if the class is not created.
See also: