Working with Forms and Assemblies in Repository of Foresight Analytics Platform

Fore forms and Fore.NET forms or assemblies created in a repository, can be started from the developed code. To enable this feature, links to the following assemblies should be added to the project:

Assemblies required to start all the forms and assemblies:

To start Fore.NET assemblies:

The following assemblies are also required to start Fore.NET forms separately from Fore.NET assemblies:

The following method need to be executed before starting assemblies in the code:

These methods need to be executed once before some form is started for the first time:

IUiWinApplication WinAppCls = new UiWinApplicationClass();

WinAppCls.CheckAfxState();

ForeNetFormVS.SetActiveMetabase(Mb);

By finishing all work it is recommended to reset a reference to the repository for enforced releasing of resources used to store connection with the repository:

ForeNetFormVS.SetActiveMetabase(Null);

Starting Fore Forms

To start a Fore form, the user needs to execute the following method for the respective repository object: Open or OpenWithParam:

IMetabaseObjectDescriptor ForeForm = Mb.ItemById["TestForm"];

ForeForm.Open(ForeForm.Params.CreateEmptyValues());

Starting Fore.NET Assemblies

To start a Fore.NET assembly, the user needs to execute the following method for the respective repository object: Run:

IMetabaseObjectDescriptor MObj = Mb.ItemById["TestAssm"];

((IForeNETAssembly)MObj.Bind()).Run();

Starting Fore.NET Forms

To start a Fore.NET form, the user needs to execute the following method for the respective repository object: Show or ShowDialog:

IForeServices Svc = (IForeServices)Mb;

IForeRuntime ForeRun = Svc.GetRuntime();

IForeNETAssemblyClass RuntimeClass = new ForeNETAssemblyClassClass();

IForeNETRuntime Run = RuntimeClass.Runtime;

IForeNETRuntimeAssembly Asm = Run.Assembly[(Mb.ItemById["TestAssm"].Bind() as IForeNETAssembly), ForeRun.Context];

IForeNETRuntimeForm RuntimeForm = Asm.Form["TestAssm.MAINForm"];

RuntimeForm.Show();

See also:

Using Foresight Analytics Platform Resources in Third-Party Applications