Roy Osherove

View Original

Regulator 2005 & GUI threads goo- news on both?

I've kept mostly quiet for the past N weeks because of holidays+illness. It gave me time to geek out and start working on a fresh new version of The Regulator (aptly dubbed "Regulator 2005"). Boy am I a happy camper. I'm coding nights, I'm coding at lunch breaks, I'm thrilled to be solving new problems.
I plan to "Launch" it at TechEd Europe with maybe a small contest to get a special prize - a customized version of The Regulator for the winner with special splash page and all. What do you think?
 
For example,  one of the cool things I had to solve was the whole GUI threading glue that you have to do when doing a truly rich GUI app with actually *responds* to user actions while doing something. I developed a whole "application block" (or maybe just a helper class or two..) that allow you do solve the threading thing more easily.
A sneak preview might look like this:
 
public void DoSomeGUIStuff()
{
   if(invoker.InvokeSafely(this))
      return;
   TextBox1.Text = "Something";
}
 
public void DoSomeGUIStuff(object sender,EventArgs e)
{
   if(invoker.InvokeSafely(this,sender,e))
      return;
   TextBox1.Text = "Something";
}
 
At the simplest case this is all you need to make the method UI thread safe. For more complex methods, it gets, well, a little more complex, but not very much. There's more, but I'll save that for when I've tested it thoroughly enough. Oh, did I mention that it was written with unit tests?