So today I was working on an upgrade utility for one of my clients, and I needed to give people a chance to “search” for a particular type of directory. Long running process since I had to search the whole drive (needle in an haystack issue, don’t ask…). Anyways I coded it up the old fashioned way using the system.io namespace, looking for directories and files.
And that worked, but when you hit the search button, the app would go off and become unresponsive as windows forms apps are wont to do (thanks COM for STA model… not). Unresponsive UI, not good, so I start to go off and do what I usually do in a case like this, setting up seperate thread, using the invokes, yada, yada, yada, been there done that, annoyingly tedious. When light bulb goes off… I’m working .Net 3.5, surely a system that has LINQ has a new way to accomplish this pain! A quick Google and A Bing later (boy does that sound like a Soprano phrase) and I find a reference to the BackgroundWorker class. Painful just became easy.
Must remember, when working outside of 2.0 framework, if I’m coding up something I have repetitively coded up before, do a search thru help and new library functions, someone else, probably at Microsoft has had to do the same thing and said, “ah heck, this should be easier”.