This is the first post of a series that will cover the basic ground of CAB QuickStarts from a simple point of view.
Other posts in this series
For more information about CAB see:
- http://msdn.microsoft.com/en-us/library/aa480450.aspx
- CAB introduction posts (Spanish) by Mariano
- Composite UI Application Block(Spanish) by Jonathan
Event Broker QS
This is a list of the procedures in this post:
- Add Customer Button
- Show List Button
- Add Local Button
- Add Local Button
- Add Global Button
- Process Local Button (Makes Local be Global)
Add Customer Button
- View uses button event to communicate with controller.
- Controller adds customer in controller logic, and raises State Changed Event.
- The view which is suscribed to this event updates the list data source.
Show List Button
- View uses button Event to call method.
- Calls Controller method: ShowCustomerList.
- Creates a new workitem and adds it as a child for the one being used.
- Passes the current workitem’s State to the child workitem (Using a List, Empty)
- Adds a form as a View (to the Item Collection) to the child workitem.
- The view’s constructor creates a new list [Create New] & gets the state using the State attribute.
- The OnLoad Event Handler suscribes to both the State change event in the workitem, as well as a event raised by a change of State in the parent workitem.
- Displays the new View.
Add Local Button
- Calls Event for the button.
- If there’s something in the text box it calls the controller’s add local customer method passing id.
- Adds customer to list
- Raises event StateChanged.
- The event handler referred to the State Changed in the view is executed.
- The data source for the list is re-assigned.
Add Global Button
- Calls event for the button.
- If there is text calls Controller’s addGlobal Method passing id.
- Raises the GlobalCustomerAdded Event, passing customer ID as event args.
- The [EventPublication("topic://EventBrokerQuickStart/CustomerAdded")] in the controller “publicates” the event
- This calls the method OnCustomerAdded in the LaunchPadController, because it is suscribed to the topic.
- The OnCustomerAdded calls the AddCustomer Method from the LaunchPadController.
- The method adds the customer to the customer List
- The State Changed Event is raised.
- Both Views (CustomerListView & LaunchPadForm) update their list’s datasources because they are suscribed to the event.
Proccess Local Button (Makes Local customers be Global)
- Calls the event for the button.
- Calls CustomerListController ProcessLocalCustomer Method.
- If nothing is being processed assign the local customer list to DictionaryEventArgs.
- Fire the "topic://EventBrokerQuickStart/StartProcess" topic.
- CustomerListController has an EventSubscription to that topic, calling the StartProcessHandler (Thread = Background, runs on a separate thread).
- Gets the list of customers to process from the dictionary.
- Calls the OnProgressChanged Method that raises the ProgressChanged event.
- The "topic://EventBrokerQuickStart/ProgressChanged" topic is suscribed to by the ProgressChangeHandler. The ProgressView updates its value by suscribing to this event.
- Calls the AddGlobalCustomer Method that fires the GlobalCustomerAdded event.
- The LaunchPadController suscribes to the GlobalCustomerAdded event, calling the add customer method, thus adding a customer to the customer list.
- Raising the StateChangedEvent so the list updates its data source (The CustomerListController Clears the customers list, then raises the State Changed and Creates a progress view ).
- The on process completed method is called in the StartProcessHandler, firing the ProcessCompleted event.
- The ProcessCompleted eventhandler updates the processing status to false.
The next post will be about the Module Loader Quickstart, stay tuned.