Working with Fore.NET Components

To use Fore.NET components on forms created in third-party development environments, the following conditions must be satisfied:

Example of base code of the form used to work with Fore.NET components in a C# project:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using Prognoz.Platform.Interop.Metabase;

namespace RunForm

{

    public partial class Form1 : Prognoz.Platform.Forms.Net.ForeNetFormVS

    {

        //Form constructor

        public Form1()

        {

            InitializeComponent();

        }

        //Redefined form constructor that calls base constructor of the ForeNetFormVS class

        public Form1(IMetabase Mb): base(Mb)

        {

            InitializeComponent();

        }

    }

}

An example of for initialization and launching:

[STAThread]

static void Main()

{

    Application.EnableVisualStyles();

    Application.SetCompatibleTextRenderingDefault(false);

    IMetabase Mb;

    ...

    Mb = //Connection to repository;

    //Use redefined constructor to initialize form

    Application.Run(new Form1(Mb));

}

The MetabaseDefinition property is available for the form in design mode. This property enables the user to connect to the repository with which he will further work. This is necessary to adjust properties of the components that work with repository objects.

NOTE. Connection to the repository, settings of which are defined in the MetabaseDefinition property, is not established at the form start. The connection should be established in application code.

The list of Fore.NET components can be loaded from the Prognoz.Platform.Forms.Net assembly. Setting up and working with components is executed the same way as in the Foresight Analytics Platform development environment. The components are described in the Fore.NET Components section.

Using Visual Fore.NET Components

When Fore.NET components are used, sometimes the component contents can be displayed incorrectly (object form distortion, mismatched colors, and so on). This behavior is caused by the fact that the operating system uses older versions of comctl32.dll library by default. This is the basic library that includes controls and user interface elements. This problem can be solved by adding to assembly manifest a code that indicates that it is necessary to link and use the library of one of the latest versions:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

  //Manifest code

  //...

  <dependency>

    <dependentAssembly>

      <assemblyIdentity

        type="win32"

        name="Microsoft.Windows.Common-Controls"

        version="6.0.0.0"

        processorArchitecture="*"

        publicKeyToken="6595b64144ccf1df"

        language="*"/>

    </dependentAssembly>

  </dependency>

</assembly>

See also:

Using Foresight Analytics Platform Resources in Third-Party Applications