Friday, July 25, 2008

NaroCad Plugins

NaroCAD Plugin System

A must have is a screenshot, taken from the current SVN code.

To understan it is somehow simple, and you should understand the following concepts:

  • Node

  • Link

    • Signals (Provider links)

    • Slots (Required links)

  • Node provider list

  • Solver


A node is a class that is derived from: NaroCommands.Node and is a component.

In the sample there are following nodes:

  • an OptionsDialog

  • OptionsPage

  • MenuBar

  • DocumentList

  • FileSave

  • FileLoad

  • DocumentView

They may run independently as much as they don't need data from other compoents.


For making the components to be connected they need a LinkBase implementation

The links are of two ways:

  • provider nodes named Signals

  • consumer nodes named Slots

The default relation of one link is to connect One to Many. So one signal may be connecting to as many slots, and one slot may receive signals from as many signals. For making one signal or slot to accept only one connection (cause of design causes), the connection has an attribute of being exclusive. So, every new reconnection between signals or slots will remove the old one.

To add to a node connections, you should override the method CreateConnection:

Creating a signal:

public override void CreateConnections()




Creating a slot:

public override void CreateConnections()




You may create as many signals and slots for one component, depending of your needs.


Sometimes some nodes are common components and are needed any time. They can be found in the provider lists or may be added easily:

Adding a provider node:

ProviderList.Get.AddProvider(new MainMenuProvider()); //add directly a node

ProviderList.Get.AddProvider("Options", new Options.OptionsPreferencesProvider()); //add a node with a specified name

To obtain a specific provider, you should eventually convert to it's type, if is not enough to you to work with a NaroCommands.Node class as following line:

Options.OptionsPreferencesProvider optionsProvider =

ProviderList.Get.Item("Options") as Options.OptionsPreferencesProvider;

In this code, optionsProvider may be null if at the „Options” label is stored another type than the needed one.


The solver creates based on the Node name, a node and automatically build dependencies to it to complete the node links.

(Work in progress)

The solver do only one thing: will assure that connections (signals and slots) of every node are connected. Based on that you may work with objects without care about connecting the nodes manually. The solver stores too a repository of all node names, so you can build a node by name, without care of which assembly (class library or executable) is the originator.

The implementation is right now in the polish stage and will get an improvement soon as matter of how to work with and how to work with the solver.

No comments: