Form Workflows
Use Workflow Foundation to control UI flow and state in your CMS Console applications
In this code sample you will get an introduction to CMS Console application where the UI (wizards and editors) are managed by abstract Form XML files (views), data objects stored in bindings (models) and Workflow Foundation based code (controllers). You can use WF based UI when you need more complexity or control in your UI or data handling.
Setting up VisualStudio 2010 and C1 CMS
- Download C1WorkflowDemo.zip (C1 CMS 1.3 version) and unpack it at an appropriate location (referred to as "<WF path>" below).
- Get a C1 CMS Website up and running in Visual Studio 2010 – for details, check the VS2010 and IIS guide.
- In the VS2010 solution, execute "Add | Existing project" and select "<WF path>\C1WorkflowDemo\C1WorkflowDemo.csproj" so you have the C1 CMSWorkflowDemo and the C1 CMS Website projects in the same solution.
- Right click the web project and select "Add reference…" and add a reference to the C1 CMSWorkflowDemo project.
- Build the solution.
- Verify that the website /bin folder now contains C1 CMSWorkflowDemo.dll (be sure to refresh the /bin folder view). If you do not find it revisit the steps above.
- Launch the C1 CMS Website and log in to the administrative console as admin.
- Download C1WorkflowDemoSetupPackage.zip (C1 CMS 1.3 version)
- Browse to "System | Packages | Installed Packages | Local Packages" and upload the C1 CMSWorkflowDemoSetupPackage.zip file and complete the wizard.
- After the CMS Console reload the content perspective will show a new folder labeled "C1 CMS Workflow Demo - Products".
What’s did we just add?
The C1 CMSWorkflowDemo project you compiled contains the following artifacts:
- Two (heavily attributed) data interface definitions (IProduct and IProductCategory) which C1 CMS can ‘absorb and support’ and thereby provide a data layer.
- An Initializer class which is called when C1 CMS start up – it will ensure that data stores are created for the two data types above.
- Three Workflows which orchestrate UI flow for adding, editing and deleting product data.
These artifacts are compiled to C1 CMSWorkflowDemo.dll which is copied to the website ~/bin directory. The next time C1 CMS start up, the initializer class will run. The data interfaces and workflows will not "do anything active" by them selves, but they come into play with the package we also installed.
The package you uploaded contains the following artifacts:
- A change to Composite.config ensuring that Console UI XML definitions can reside in "~/App_Data/Composite/Forms"
- A set of Console UI XML files copied to "~/App_Data/Composite/Forms". These define the forms used for adding, editing and deleting data and are referenced by the Workflows.
- A ‘Tree Definition’ XML file responsible for defining the Console Tree "C1 CMS Workflow Demo - Products" – this file is copied to "~/App_Data/Composite/TreeDefinitions/C1WorkflowDemoTree.xml"
- Some test data which is added to the data layer.
Getting access to custom C1 CMS activities
You can get the custom activities for C1 CMS in your toolbox by executing the following steps:
- Make sure your Toolbox is open – otherwise open it using View | Toolbox.
- Right click the tab in the Toolbox where you want the activities to be available, like the General tab or a new tab you create – and execute the "Choose items …" command.
- Click the Browse button, browse to your website and select the file ~/bin/Composite.dll
- Say OK to all open dialogs
At this point you have the custom activities in your toolbar and you can drag them into your workflow designer.
XML schemas for Tree Definitions and UI Forms
Browse to the ~/Composite/schemas folder in your web project to find XML schemas for Tree Definitions and UI Forms - you can register the schemas with VisualStudio to get intellisense and validation when working with XML.
Diving into the demo
Once you have the Form Workflows demo up and running you can dive into more details by following the walkthrough and extending the demo.