Knowledge Base > Using Foresight Analytics Platform Resources in Third-Party Applications > 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:
Prognoz.Fore.
Prognoz.Platform.Forms.Net.
Prognoz.Platform.Interop.ForeSystem.
Prognoz.Platform.Interop.Metabase.
Prognoz.Platform.Interop.Ui.
Prognoz.Platform.WinForms.Utils.
To start Fore.NET assemblies:
Prognoz.Platform.Interop.ForeNet.
The following assemblies are also required to start Fore.NET forms separately from Fore.NET assemblies:
Prognoz.Platform.Interop.Fore.
Prognoz.Platform.Interop.Forms.
Execute the following method before starting assemblies in the code:
Prognoz.P5.Interop.Ui.IUiWinApplication.CheckAfxState: this method initializes system variables of the analytics platform required to ensure correct performance of objects.
Prognoz.P5.Forms.Net.ForeNetFormVS.SetActiveMetabase: this method defines the repository, within which the objects are to be started.
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);
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());
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();
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