Update: I have added this code to the MSDN Code Gallery (click adjacent link) you can grab it there.
Attached to this blog post is a reasonably extensive sample of using a Silverlight application as control for time entry logging against work items. This is a custom winform work item control for embedding into TFS work items but that underlying it is a Silverlight App. Being lazy as a programmer I like to build as little as possible to get the most out of it. With that in mind I decided I would port my existing time entry control from a winforms control to something that underneath I could more easily expose on web pages and have the same interface wherever needed. There are a number of ways to skin this cat but this is the one I chose as a proof of concept and here is the prototype.
First a few caveats:
Since time entry is really a disconnected sort of activity that really, in my case, only cares who the user is and what work item with which to associate the time I can get away with this very disconnected model. My time entry control is not going to change based on other actions or states in the work item.
This prototype is not the least bit concerned with security or any sort of edit level logging e.g. you can claim to be any user and go to the url directly and update a time entry to any work item regardless of work item level security.
It uses the FREE Silverlight AgDataGrid from DevExpress so you'll need to grab that also.
Error checking and all that jazz -- knock yourself out adding it in.
Here is how it looks in some of my work items. I have the control hosted under a tab:
Here is the basic concept I used hack it all together:
I created a windows custom control that implemented IWorkItemControl as needed to provide a custom control for TFS Work Items. This is the ZydecoTimeControl project in the sln. This does nothing more than house a WebBrowser control that gets passed a URL that contains a username and work item id in the query string to let the target page know what user and work item to associate to. It will not show the browser control if the work item is not yet saved. I started putting in the text to display in lieu of the browser control but it's not a functioning piece of code, yet. Also I do not know how well behaved the WebBrowser control is as I implemented. I never call dispose myself because I don't really know when I would as I don't know when the user closes the work item or how well it performs if I open up 20 work items etc. There is some potential for issues when using the WebBrowser control.
The browser control calls up a URL of the following format
http://TIMESERVICEMACHINE:8091/TimeControl_TFS.Web/TimeControl_TFSTestPage.aspx?name={0}&wi={1}
where {0} and {1} are replaced with the username and work item id respectively. The project that hosts that page is the TimeControl_TFS.Web project in the sln. All this does is house a page that loads up the Silverlight control I created in the project TimeControl_TFS. I have the WCF service that the Silverlight control calls into in it's own project, TFSServices, but there is no reason it couldn't be in the TimeControl_TFS.Web as well.
The Silverlight control itself calls into a WCF service over HTTP with basicHttpBinding . That service does some very basic CRUD operations against the simple data store. I have included a DBPro project TimeDB that contains all the simple tables and stored procedures etc.
The next step I plan to do is wrap/inherit the same Silverlight control in a simple web control that implements the needed interface for Team System Web Access and voila I can just update the Silverlight control and easily push the same user experience to both winform and web interfaces for work item level time entry.
Most likely you'd like to add better security and all the good stuff of proper exception handling etc. But this should get you going. Replace the appropriate values in the config files, string constants etc to represent your paths, ports etc and dump in the couple of data tables and you are off and running.
Below is the source zipped up from my skydrive. If you don't see the below image and link then follow this.
I have added this code to the MSDN Code Gallery (click adjacent link) you can grab it there.