Working with Forms and Assemblies in Repository of Foresight Analytics Platform

Fore forms and Fore.NET forms or assemblies created in repository can be started from the developed code. To enable this feature, add links to the following assemblies in 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:

Execute the following method before starting assemblies in the code:

Execute these methods once before some form is started for the first time:

IUiWinApplication WinAppCls = new UiWinApplicationClass();

WinAppCls.CheckAfxState();

ForeNetFormVS.SetActiveMetabase(Mb);

When all work s finished, it is also recommended to reset a link to the repository to force release resources used to store repository connection:

ForeNetFormVS.SetActiveMetabase(Null);

Starting Fore Forms

To start a Fore form, 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, 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, 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