Buck Hodges

Visual Studio ALM (VSALM, formerly VSTS) - Team Foundation Service/Server (TFS) - MSDN

January, 2010

Posts
  • Buck Hodges

    Deep dive on Windows Workflow 4.0 activities

    • 2 Comments

    Patrick Carnahan is a developer on TFS Build, and he’s written a series of detailed posts on how to write custom activities in Windows Workflow 4.0 (WF), which is now used to orchestrate the build process for TFS Build in 2010.  It’s a deep dive on WF activities.  Jim Lamb’s post on how to integrate custom workflow activities into TFS Build is a great companion to this series.

    Introduction to Windows Workflow 4.0

    In order to help everyone get up to speed with build customization, I wanted to take a few posts to share our collective knowledge on the Workflow framework in .NET 4.0. In this first post I plan to tackle the different base classes that may be used when designing your own custom activities, along with typical usage scenarios. Other topics, such as extensions, tracking, and more advanced customization will be covered later. I will also be keeping an eye on comments to help point me in the right direction. So without further adieu, on with the code!

    Windows Workflow 4.0 - CopyFile

    It has recently come to my attention that there is unrest regarding our inclusion of a CopyDirectory activity without a CopyFile activity. Therefore, I decided to take this opportunity to introduce everyone to the sub-class AsyncCodeActivity and how you can utilize it with a real world example – a cancelable file copy operation. As you may recall from my previous workflow posts, CodeActivity does provide a mechanism for cancelation while the AsyncCodeActivity does facilitate this need. If you are not familiar with asynchronous programming in .NET then you should probably read the following article to brush up before continuing.

    Windows Workflow 4.0 – CopyDirectory (Part 1 of 3)

    In my last couple of posts I have lead you through some basic introduction to workflow as well as a real world example of how to implement a cancelable CopyFile activity. The next thing I would like to do is dive into a much more involved example utilizing the previous activity. The purpose of this post is to introduce the class NativeActivity, since we will need to implement a custom activity for driving the consumers. We will also be working toward using our producer-consumer activity to eventually develop a parallelizable CopyDirectory activity, which I plan to cover in a subsequent posts.

    Windows Workflow 4.0 – CopyDirectory (Part 2 of 3)

    In my previous post I introduced you to NativeActivity and walked through the design and implementation of a class named ParallelItemScheduler<T>. In part 2 of this series we will be utilizing the aforementioned activity to build a new composed activity named ProducerConsumer<T>. Once we have completed this task we will have a framework for building our final activity, CopyDirectory.

    Windows Workflow 4.0 – CopyDirectory (Part 3 of 3)

    So far we have written ParallelItemScheduler<T>, which is a generic activity that goes dormant and schedules actions based on input via bookmark resumption. We then used this activity to design ProducerConsumer<T>, which takes this idea a little further and provides a generic mechanism for running a producer thread that can pump data into a consumer thread. In the last part of this series we finally have all required building blocks to design our highly efficient and parallel copy directory activity!

    Windows Workflow 4.0 – Workflow Instance Extensions

    In the previous posts we covered one way you could implement a producer-consumer pattern in workflow. This approach used composition and attempted to hide the complexities of the underlying operations inside of the respective activities through composition. However, one scenario in particular this model does not allow you to implement involves modeling of existing .NET events in a workflow. For instance, if we want to implement a FileSystemWatcher activity we need to provide some way for consumers to hook into the events exposed by the .NET object. The only way to accomplish our goal is to hook up to the .NET events and schedule workflow actions from our event handler – but how would this be implemented? Let’s take a look at some more pieces of the workflow framework that will allow us to accomplish this goal.

    Be sure to post comments on Patrick’s blog on what else you’d like him to cover.

    Enjoy!

  • Buck Hodges

    Does your display not turn off automatically? You may need an update for your wireless mouse.

    • 1 Comments

    On my shiny new Windows Server 2008 R2 installation, my monitors won’t go into low power mode even though they should turn off after 10 minutes of inactivity based on my display settings in Windows.  Chris Rathjen suggested to me that it could be the wireless mouse (Microsoft Natural Wireless Laser Mouse 6000 in my case – what a mouthful) keeping it awake.  I unplugged it from the USB port, and sure enough, my monitors went into low power mode.

    So, I thought I’d try installing the current IntelliPoint drivers for Windows 7 64-bit to see if that fixed the problem.  It did indeed do the trick.  You can download it from http://www.microsoft.com/hardware/downloads/default.mspx if you are having a similar issue with a Microsoft wireless mouse.

  • Buck Hodges

    Free of XP and Vista! All Win7, all the time.

    • 4 Comments

    I took a couple of weeks off over the holidays (a ton of people did – there weren’t many folks around last week), and I finally took the time to migrate our two desktops at home from XP to Win7.  I’ve been running Win7 for many months on my work laptop, my personal laptop, and most recently a Dell Mini 9 (okay, I consider four months ago recently – heck, my blogging frequency is terrible now).

    My regular laptop at home is an old Thinkpad T40 that’s about five years old at this point.  It has 1.5 GB of RAM (not that you need that much for 7 – 1 GB works fine for surfing, email, and that sort of thing), but it’s clearly a weak machine by current standards.  Win7 runs just fine on it.

    Similarly, my old desktop was over five years old.  Since it has 1 GB of RAM, it runs Win7 very nicely, and that one’s now my wife’s machine.  Meanwhile, I finally bought myself a new desktop (Core i7 HP Pavillion Elite) back in November, and vacation afforded me the time to get all my stuff migrated over to it (after wiping the machine, of course – too much crud comes on new machines).

    To finish moving to Win7, I needed to upgrade my development desktop at work from Windows Server 2008 to Windows Server 2008 R2 (aka Win7 server).  I hadn't found the time to do it, but the video driver crashed again on Tuesday.  I was tired of that happening periodically.  So I made use of the Windows Deployment Service we have here in the local office, and kicked off a Win2k8 R2 installation as I left.

    I spend so much of my day in Outlook these days that the first app I installed was Office (2010 Beta, of course, which works very well!).  I’ve been so busy that I haven’t even installed Visual Studio yet.  I had been running VS 2010 Beta 2, and that’s what I’m also running on my laptop.  I’m hoping to pick up a new signed build tomorrow, and put the latest and greatest on my dev box.

    After redoing my dev box, XP and Vista (in the form of Windows Server 2008) are out of my life.  It’s hard to believe XP has dominated for basically a decade.  All of my installations of Win7 have been great, and I’ve only hit the one snag with a Bluetooth mouse I described in my post on the Dell Mini 9 (a reader commented not having the issue with the same combination, so maybe I did something dumb).  I really love how it finds all of the drivers for video cards, network adapters, smart card readers, and printers.  Win7 is awesome!

    Happy New Year!

Page 1 of 1 (3 items)