Previous Page Trail Contents Next Page

12. Importing of external libraries

12.1 Introduction

12.2 Interoperability interfaces

12.3 Using of external libraries

12.1 Introduction

This software may use external libraries. To do this it is necessary to create class that implements the ICategoryObject interface. Then you can associate to it any square on desktop and use it as well as another objects.

12.2 Interoperability interfaces 

First interoperability interface provides list of objects of external library and access to to them by name. It is presented below:

namespace CategoryTheory

{

    /// <summary>

    /// The factory of category object

    /// </summary>

    public interface IObjectFactory

    {

        /// <summary>

        /// Names of objects

        /// </summary>

        string[] Names

        {

            get;

        }

             

        /// <summary>

        /// Object by name

        /// </summary>

        /// <param name="name">The name</param>

        /// <returns>The object</returns>

        ICategoryObject this[string name]

        {

            get;

        }

    }

}

Contents of this interface is clear. Second interface provides editor of properties of object.

namespace DiagramUI

{

    /// <summary>

    /// Object with editing of propeties

    /// </summary>

    public interface IPropertiesEditor

    {

             

        /// <summary>

        /// Gets property editor

        /// </summary>

        object Editor

        {

            get;

        }

             

        /// <summary>

        /// The properties

        /// </summary>

        object Properties

        {

            get;

            set;

        }

    }

}

 

 

 

 

Whether we wish to edit properties of imported object the object should implement this interface. The "Editor" property usually returns Form that performs edition of properties of object. However whether you  would like use another type of user interface (GTK for example) then the editor should return object of another type. The editor may return an array of objects. First object is a property editor, second one is an object icon. It looks like:

      

 

       object IPropertiesEditor.Editor

        {

            get

            {

                return new object[] { new FormEditor(this), icon };

            }

        }

 

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

12.3 Using of external libraries

External interface corresponds to the External  button. Whether you put this object on desktop and right click it then the following editor of properties should be appear

Properties 

You can select a dll file and then type of object using combobox below. After performing of this operations the desktop looks like:

New picture 

You have noticed that new icon of this object has been appeared. This icon is defined by the IPropertiesEditor.Editor property. Right click on the object square opens new editor of properties:

New editor 

Then we can work with this object as well as with another ones.

 


Previous Page Trail Contents Next Page