Installing StaMa on a Developer Machine
Click or drag to resize
StaMaInstalling StaMa on a Developer Machine

Describes how to install the StaMa State Machine Controller Library on a developer machine.

StaMa is essentially a single assembly without specific installation and deployment needs.

The assembly is provided through the NuGet StaMa.StateMachine package or through the StaMa_State_Machine_Contoller_Library_Vx.y.zip file on the GitHub project home.

Samples are available through the StaMa_State_Machine_Contoller_Library_Vx.y.zip file.

The following points are provided as a checklist and might be worth to consider:

  • The contained StaMa.dll assembly might not match Your .NET Framework version.

    In this case please obtain the StaMa_State_Machine_Contoller_Library_Vx.y.zip from the GitHub project home, extract the contents to a local folder and re-compile StaMa.dll after adapting the StaMa.csproj or StaMaNETMF.csproj file to Your projects needs.

    See Compiling the StaMa Assembly For a Specific Target Framework Version for details how to re-compile.

  • It is not suggested to add StaMa.dll to the Global-Assembly-Cache (GAC). Nevertheless the StaMa.dll provided in the package is signed and might be added to the GAC. In case StaMa.dll has to be re-compiled with signing, a file named StaMa.snk would have to be created in the directory where StaMa.csproj is located. To re-compile without signing, please un-check "Sign the assembly" in the StaMa.csproj properties.

    See Compiling the StaMa Assembly For a Specific Target Framework Version for details how to re-compile.

  • The StaMaShapes.vst Microsoft Visio document template file provides Microsoft Visio shapes to draw state diagrams and a corresponding code generator to generate code for StaMa based state machines.

    Please use the Microsoft Visio 32-bit version (more info).

    The simplest way to create a diagram is to double-click the extracted StaMaShapes.vst template file in Microsoft Windows Explorer and save the generated .vsd document file to the desired location.

    The StaMaShapes.vst template can also be configured to appear on the Microsoft Visio Backstage view. Microsoft Visio shows all .vst templates on the Backstage view that are contained in the templates folder path that can be configured in the File Locations dialog of Visio Options. See below procedure "How to Configure StaMa Visio Shapes".

    See Using Visio Shapes for details about how to use Microsoft Visio to draw state machine diagrams and generate code from them.

 

Adding StaMa to a Visual Studio Project through NuGet

  1. In Microsoft Visual Studio Solution Explorer, right-click the References node and click Manage NuGet Packages....

    The <ProjectName> - Manage NuGet Packages dialog appears.

  2. Click the Online tab to display the list of available packages.

  3. In the Search Online text box enter StaMa.

    NuGet Manage Packages
    Figure 1: Manage NuGet Packages
  4. Click Install on the StaMa.StateMachine package.

    A folder packages\StaMa.StateMachine.<version> will be created in the project folder with a sub-folder lib containing the StaMa.dll library. The sub-folders src and tools contain the source code for debugging purposes and the StaMaShapes.vst and the StaMaDevelopersGuide.chm files respectively.

StaMa.dll is now added as a reference library and can be used.

See also Managing NuGet Packages Using the Dialog for details regarding NuGet.

 

How to Configure the StaMa Visio Template to Appear on the Visio Backstage View

  1. Open Microsoft Visio.

  2. Click the File ribbon, then Options. The Visio Options dialog appears.

  3. In the Visio Options dialog click Advanced, navigate to the General group, click on File Locations.... The File Locations dialog appears.

  4. In the File Locations dialog go to the Templates row, press the Choose Folder button. In the Choose Folder dialog navigate to the folder where StaMaShapes.vst was extracted from the StaMa_State_Machine_Contoller_Library_Vx.y.zip. Press Select.

    -or-

    Copy the path from the My Shapes row to the Templates row. Copy the StaMaShapes.vst (extracted from the StaMa_State_Machine_Contoller_Library_Vx.y.zip) to the corresponding folder.

  5. Accept all dialogs with OK.

Microsoft Visio will now list an icon named StaMaShapes in the Template Categories of the Backstage view. Double click this icon to create a new state diagram.