Introduction:

The Preactor Object Model is made up of two libraries:

  • Preactor.ObjectModel
  • Preactor.ObjectModelExtensions

We intend the Preactor.ObjectModel library to remain fairly small and stable once it reaches release status.

The Preactor.ObjectModelExtensions will be updated frequently to add extra functionality as required.

You can download a sample workshop project from the download page to see how to integrate POM with your own project. (Make sure to update the POM libraries using NuGet to get the latest version.)

Visual Studio Snippet:

You can download a snippet to assist when creating POM properties from the "Downloads" page or directly from here.

Save the snippet file to your snippet folder.

Visual Studio Template:

You can download a project template that will have the CustomActions class setup as well as some other extension files to get going quickly with POM from here.

Save the PreactorObjectModelTemplate.zip file in your templates fodler which is normally: 

\Documents\Visual Studio 2012\Templates\ProjectTemplates\Visual C#

Then create a new project based on this template.

You will notice that there are some missing references. This is normal. You will have to download the latest Preactor.ObjectModel and Preactor.ObjectModelExtensions library from Nuget first. (as I haven't worked out how to include the packages in the template folder yet.)

You will also have to sign your project with a strong name key.

Shouldn't take more than 2 minutes to get up and running.

Setup Guide:

NOTE: This section is no longer needed if you use the template described above to setup your project. However this section is left for reference purposes.

(A more detailed Getting started guide can be found here.)

In order to use POM, download and install Preactor.ObjectModel and Preactor.ObjectModelExtensions from the NuGet gallery. Once those libraries are added to your references, you will have to add the following lines to your CustomActions class (i.e. a private static PreactorObjectModel property as well as a static constructor):

[Guid( "8B2EAB92-0C36-4D03-8034..." )]
[ComVisible( true )]
[ClassInterface( ClassInterfaceType.None )]
public class CustomActions : ICustomActions
{
    private static PreactorObjectModel Pom { get; set; }

    static CustomActions()
    {
        Pom = new PreactorObjectModel();
    }

...

If you want to extend the base types defined in POM with your own classes you can register them with POM in the static constructor:

static CustomActions()
{
        Pom = new PreactorObjectModel();
        Pom.Register<IOperation, Operation>();
        Pom.Register<IProduct, Product>("Products");
        Pom.Register<IResource, Resource>();
        ...
}

NOTE: When registering the Product object you also need to specify the format name, which in this case is "Products". (The Product format does not have any unique identifiers, that is the reason why we need to specify the format name for it.)

You can register your own class implementation for IOperation, IProduct, IResource, IResourceGroup, ISecondaryConstraint. Somemore interfaces will be added in the future.

In order to use the GetOperation() and the GetAllOperations() methods you need to create a file in your own project and copy and paste the corresponding extension methods found in the Workshop2Demo.

This guide will show you how to interact with any Preactor table defined in the TDF.

Interfaces:

The interfaces that are currently deffined are:

IOperation (linked to the Orders table)
IResource (linked to the Resource table)
IResourceGroup (linked to Resource Group)
IProduct (linked to Product table)
ISecondaryConstraint (linked to Secondary Constraints)

The actual properties associated with the Interfaces are documented in this excel file. The TDF file can be found here.

Events

There are a few events you can subscribe to with POM:

- Scheduled: when using the Schedule() or QuickSchedule() methods in POM and POM Extensions respectively the Scheduled event will be raised whenever an operation was successfully placed on the planning board.

- Unscheduled: raised when the Unscheduled() method is successful.

- Deleted: when any object that inherits from PreactorRecord gets deleted using the Deleted() method.

Troubleshooting:

If you need help please use the "Discussions" tab.

Last edited Aug 27, 2013 at 1:59 PM by bvsms, version 38

Comments

No comments yet.