This project is read-only.

Some Background

Forms Anywhere is a framework that I developed back in 2004 to allow the creation of data capture applications on the Windows Mobile.

Most handheld data entry applications require you to design a database and the form and then tie each field to a column in the database. Many times the forms are so complicated your users will have problems understanding how to enter the information.

Forms Anywhere uses pre-formatted entry wizards to make data entry easy and simple. With over 25 different form entry wizards you have everything you need to build easy to use data collection applications in minutes instead of weeks.

Forms Anywhere's data is free-form and no databases are required. Each completed form is stored in XML making it easy to import into databases and programs. You can sort of think of Forms Anywhere as InfoPath for the Windows Mobile.

Forms Anywhere Forms Builder

The Forms Anywhere Forms Builder allowed you to create form definitions to be used by the Forms Anywhere Pocket PC Client. A simple interface allowed you to add new entry wizards to a form with a single click. Property tabs allowed you to pre-fill entry wizard information that will be displayed to the user. Forms could also be marked read-only allowing you to create forms for reference purposes.

The user could upload a form definition directly to a Pocket PC device using Microsoft ActiveSync or to the Forms Anywhere Web Service allowing users to download forms over the Internet. The Forms Anywhere Forms Builder also allows the user to manage forms and end users stored on the Forms Anywhere Web Service.

Forms Anywhere Pocket PC Client

The Forms Anywhere Pocket PC Client is a User Interface Process controller that allows users to fill in forms using the Pocket PC. A simple graphical menu provides an easy to use menu. After selecting a form the user progresses through the form an entry wizard at a time. Each entry wizard handles a specific type of entry; such as name information, address information, single selections and signature capture. At any time the user can jump back to the main entry form to see what fields have been entered and what fields are left. The form can be saved and revised many times prior to uploading.

Options are provided to allow the user to download form definitions from the Forms Anywhere Web Service as well as uploading completed forms. Once a form has been uploaded it is removed from the Pocket PC to help in managing memory. If you do not have Internet capabilities you can use the Forms Anywhere Forms Builder to transfer forms to and from the Pocket PC.


Forms Anywhere Web Service

The Forms Anywhere Web Service provides a data collection server with user authentication and can store form definitions and completed forms to either a file, MS Access database or SQL Server database. Backend systems can make calls via the web service to extract collected data for processing or upload new form definitions for request/response processing.

The New Architecture

With an overview of the old Forms Anywhere under our belts, we can now look at what we have at our disposal to simplify the development of the framework and improve on its functionality and capabilities.

Visual Studio 2008, Domain Specific Language Models, Windows Communication Foundation and Windows Workflow have so much to offer for applications development, I had to take a long look at how I would redesign the Forms Anywhere Application to take advantage of everything.

This meant looking at implementing or replacing several things:
  • Leveraging the new XML capabilities in the .Net Compact Framework 2.0
  • Replacing the Forms Builder with a Graphical Designer or DSL that could be hosted in Visual Studio.
  • Modifying the Forms Anywhere Web Service to use the Windows Communication Framework to get WS-I compatibility.
  • Utilizing Windows Workflow Foundation to provide a plug and play capability for implementing business process workflow for solutions.

With these changes in mind the architecture for the framework has changed significantly.

Mobile Application Architecture

Below is a diagram of the Mobile Application Architecture, nothing has really changed except we can leverage the new capabilities of the .Net Compact Framework to implement the Form Resource Entity Classes and to revise the Forms Data Manager Classes to reduce the amount of code required to read and write XML data.


The Mobile Application Architecture contains the following functional components:
  • Forms Presentation Class Library – Responsible for the various Windows Forms used to capture data and interact with the end user. There is a separate Windows Form for each Form Resource Entity Type as well as Windows Forms for the main application interface, user settings and communication status.
  • Forms Utility Class Library – Contains utility classes used by the various Windows Forms to encode/decode graphics and signature data and read/write user settings.
  • Forms Anywhere User Interface Controller – User Interface Process Controller class, which reads a Forms Anywhere form definition and displays the required Form Resource Entity Dialogs in the proper sequence. The User Interface Controller class is also responsible for handling main menu interactions and invoking the classes to handle loading and saving of files as well as communicating with the Forms Anywhere Web Service.
  • Forms Resource Entity Class Library – This library contain the entity classes used to define a form and store the data captured as the user progresses through the various dialogs.
  • Forms Data Manager Class Library – This library contains utility classes to load and save the Forms Anywhere XML form definitions. The previous version of Forms anywhere included custom code to read and write each entity type, this has now been replaced with a simple class that leverages the XmlSerializer class to perform the same thing with about 1000 lines less code.
  • Communication Class Library – This library consists of classes to send and receive form data via web services.

Web Service Architecture

The Web Service Architecture is where the majority of the changes in the framework take place.

First of all I decided to use the Windows Communication Foundation to implement a stand alone service to host the web service. Using WCF’s Configuration File capability, you can setup multiple instances of the web service using different endpoint configurations. I’ve also added configuration code to allow you to specify what Windows Workflow Foundation code to load and instantiate behind each web service so you can execute different business workflows based on the data received.

In order to allow the framework to be as flexible as possible, I decided to use the Windows Workflow Foundation to implement plug and play business process logic.

What this means, is you can define you own business workflow logic using Windows Workflow Foundation and then use the new workflow by changing the Web Service’s Configuration File to use your workflow, instead of the standard workflows types provided.

This tied with the implementation of the Windows Communication Foundation allows you to stand up as many web services as you need, each with their own custom endpoint signature and custom business logic. This now makes the framework completely expandable and can be used to front end what ever type of business process you need.

The Web Service Architecture contains the following functional components:
  • Workflow Host – The Workflow Host consists of the Windows Service class and the support classes necessary to host the web service and dynamically load the Windows Workflow library defined in the configuration file.
  • Communication Class Library – The Communication Class Library consists of the Service and Data Definition Classes used provide the web service functionality under the new Windows Communication Framework.
  • Workflow Classes – The Workflow Classes consists of the standard workflow classes to allow the web service to store and retrieve form information into a database or to the file system based on the user id supplied by Pocket PC Client application. The classes also contain custom Workflow Activity Classes used by standard workflows.
  • Data Mapping Workflow – The Data Mapping Workflow is another library that allows the developer to specify how to map the fields contained within a form to tables in an external database. This library allows you to integrate the framework with existing applications without having to modify the existing code base.


The Data Model

To me, the application’s data model is the core of everything; it’s used to describe the data to be captured, it describes how the Windows Mobile client interacts with the end user to gather the data, and it can be used by other applications to implement business processes.

With that said, we need to ensure our data model is detailed enough to be used by all the various parts of the framework. This meant creating a new XML Schema Definition that can be leveraged to generate code for various parts of the framework as well as used by the resulting framework to define the User Interface Process.

The following diagram shows the object hierarchy used to define the data model:


As you can see, each of the entry types is derived from the complex type, FormResource. FormResource provides the core elements and then each derived complex type implements those elements that are specific for the particular entry.

What's Next

My intent is to use the Forms Anywhere Framework to build a Software Factory for Windows Mobile Applications, I'll be posting netcasts at that cover each step of developing a Software Factory from concept to completion.

As I publish netcasts I'll publish the code so you will have an artifact history of the factory as I progress.

Last edited Apr 8, 2009 at 7:54 PM by lavinjj, version 12