Xbox 360 Retail Store Inventory Tracker #2

The Windows Workflow Foundation Synthesizes the Components of a Solution

 

If you want to know how the Xbox 360 retail store inventory tracker described in my previous post works, then you just have to look at the code. I don't mean that you have to read the code; you can just look at it, right here:

You can literally look at the code because the logic of the application is programmed using the Windows Workflow Foundation. What you are seeing in the picture above is not a flowchart that gets transformed into code somehow. No: it is the code, just in the same way that the view of a Windows Form in the Windows Forms designer is a view of the code. This particular code is in the InventoryCheckWorkflow.cs module of the InventoryCheckWorkflow project that is included in the solution

 

The first activity in the workflow is to open up a channel of communication from the workflow to the user interface so that as the Xbox 360 inventories of the various Best Buy and Circuit City stores is determined, the user interface can be updated to show whether the stores have Xbox 360s in stock or not. The next activity is to retrieve a list of all of the regions of a given country, which, in our case, will be a list of the states in the United States of America. That list will be retrieved from a Web service that is advertised on www.xmethods.net. Then, for each region in the list retrieved from the Web service, a list of all of the postal codes is the region are retrieved. The list of all of the postal codes in a region is obtained from another Web service that is advertised on www.xmethods.com. The workflow then iterates through all of the postal codes of all of the regions, and for each of those postal codes, it examines the Best Buy and Circuit City Web sites to determine whether or not the stores in the area identified by the postal code have Xbox 360s available for sale. The user interface is updated with the stock or absence of stock in each store. 

 

Evidently, the workflow is synthesizing the various elements of the solution--the Web service for retrieving regions, the Web service for retrieving postal codes, and the components for checking the Best Buy and Circuit City inventories--into a complete solution. 

      

workflow.bmp