Calling a dialog box for editing the existing custom class.
None
If the existing custom class is edited successfully, the Execute method returns True, otherwise it returns False.
Executing the example requires that custom metadata contains the repository of custom class with the CUSTOMCLASS identifier.
Add links to the Metabase, Ui, Fore (for Fore.NET example) system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
Target: IUiCommandTarget;
Context: IUiCommandExecutionContext;
CustomExtender: IMetabaseCustomExtender;
Type: MetabaseSpecialObject;
Result: Boolean;
Data: Array Of Variant;
Begin
Mb := MetabaseClass.Active;
Type := MetabaseSpecialObject.CustomExtender;
Target := WinApplication.Instance.GetPluginTarget("Std");
Context := Target.CreateExecutionContext;
Data := New Variant[2];
CustomExtender := Mb.SpecialObject(Type).Bind As IMetabaseCustomExtender;
Data[0] := MetabaseClass.Active;
Data[1] := CustomExtender.Classes.FindById("CUSTOMCLASS").Key;
Context.Data := Data;
Result := Target.Execute("EditCustomClass", 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
Mb: IMetabase;
Target: IUiCommandTarget;
Context: IUiCommandExecutionContext;
CustomExtender: IMetabaseCustomExtender;
Type: MetabaseSpecialObject;
Result: Object;
Data: Array Of Object;
Svc: IForeServices;
RunContext: ForeRuntimeContext;
WinApp: WinApplicationClassClass = New WinApplicationClassClass();
Begin
Mb := Params.Metabase;
Type := MetabaseSpecialObject.msoCustomExtender;
Svc := Params.Metabase As IForeServices;
RunContext := Svc.GetRuntime().Context;
Target := WinApp.Instance[RunContext].GetPluginTarget("Std");
Context := Target.CreateExecutionContext();
Data := New Object[2];
CustomExtender := Mb.SpecialObject[Type].Bind() As IMetabaseCustomExtender;
Data[0] := Params.Metabase;
Data[1] := CustomExtender.Classes.FindById("CUSTOMCLASS").Key;
Context.Data := Data;
Result := Target.Execute("EditCustomClass", Context, RunContext);
System.Diagnostics.Debug.WriteLine(Result);
End Sub;
After executing the example a dialog box opens to edit the custom class with the CUSTOMCLASS identifier. Change class parameters and click the ОК button. The console displays the result of editing the class.
See also: