InitForm: Boolean;
InitForm: Boolean;
The InitForm method performs base setup of .NET form and returns whether setup successfully completed.
Executing the method makes the following changes:
A form design unit is created and its code is formed.
Resource file is created.
Links to the assemblies that are required for work of .NET form are added:
Forms.Net;
System.Data;
System.Drawing;
System.Windows.Forms.
Executing the method returns True if all changes are successfully made.
Executing this example requires that the repository contains a .NET assembly with the Assembly_1 identifier.
Sub CreateNETForm;
Var
MB: IMetabase;
NetForm: IForeNETForm;
CrInfo: IMetabaseObjectCreateInfo;
Begin
MB := MetabaseClass.Active;
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_NETFORM;
CrInfo.Name := "New form";
CrInfo.Id := MB.GenerateId("NewForm");
CrInfo.Permanent := True;
CrInfo.Parent := MB.ItemById("Assembly_1");
NetForm := MB.CreateObject(CrInfo).Bind As IForeNETForm;
NetForm.InitForm;
End Sub CreateNETForm;
On executing the example a new .NET form is created in the specified .NET assembly.
Executing this example requires that the repository contains a .NET assembly with the Assembly_1 identifier. This procedure is an entry point for the .NET assembly.
Imports Prognoz.Platform.Interop.ForeNet;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
NetForm: IForeNETForm;
CrInfo: IMetabaseObjectCreateInfo;
Begin
MB := Params.Metabase;
CrInfo := MB.CreateCreateInfo();
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_NETFORM As Integer;
CrInfo.Name := "New form";
CrInfo.Id := MB.GenerateId("NewForm", 0);
CrInfo.Permanent := True;
CrInfo.Parent := MB.ItemById["Assembly_1"];
NetForm := MB.CreateObject(CrInfo).Bind() As IForeNETForm;
NetForm.InitForm();
End Sub;
On executing the example a new .NET form is created in the specified .NET assembly.
See also: