<< Click to Display Table of Contents >> NShape Reference
|
Creates ShapeTypes and/or ModelObjectTypes and registers them.
public static class NShapeLibraryInitializer |
All shape- and model object libraries have to implement this class as a static class.
Name |
Description |
---|---|
Initialize |
Creates and registers ShapeTypes and/or ModelObjectTypes. |
/// <summary>
/// Initializes the shape library by registering the library itself and all of its available shape types.
/// </summary>
public static class NShapeLibraryInitializer {
public static void Initialize(IRegistrar registrar) {
// Register library
registrar.RegisterLibrary(libraryName, preferredRepositoryVersion);
// Create shape type instance for "MyShape" ...
ShapeType myShapeType = new ShapeType(
"MyShape", // The name of the shape type, used
libraryName, // The name of the library the shape type belongs to
categoryName, // Name of the default toolbox category
delegate(ShapeType shapeType, Template t) { // A 'CreateShapeDelegate' method that constructs the shape
return new MyShape(shapeType, t);
},
MyShape.GetPropertyDefinitions, // Static method that provides property definitions
true); // Specifies whether templates can be created from this shape
// ... and register it
registrar.RegisterShapeType(myShapeType);
}
private const string libraryName = "MyShapeLibrary";
private const string categoryName = "My Shapes";
private const int preferredRepositoryVersion = 1;
}
}
Namespace: Dataweb.NShape.Advanced
Assembly: Dataweb.NShape