Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

18. WPF Interactions > Routed events Address a Problem

Routed events Address a Problem

image

Most applications are event-driven, and the POCO event system works pretty well. But compare it to this real-world situation:

image

In a traditional kitchen, the sous chef (pronounced “sue chef”) checks orders before they are assigned to line chefs to be prepared, and then checks the orders before they are served to customers.

If we were modelling this process, both the OrderPlaced, and ItemPrepared events would be sent first to the SousChef class, which would have to raise additional events for the next step in the process.

Every LineChef would have to register a handler for the ItemAssigned event, and the SousChef class would have to register a handler for the ItemPrepared event of every LineChef (which means the SousChef would have to know about every instance of LineChef, which raises issues of its own).


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial