Posted by Martin Konicek on 6:46 PM 5 comments

New blogposts about programming Outlook add-ins

I published two new blogposts on the website of our add-in for Outlook called TaskConnect:
Adding custom data to Outlook emails
Searching emails from an Outlook add-in

Knowing the information published there before developing TaskConnect would definitely help me a lot so I'm sharing it. I hope you will also find it useful.

Posted by Martin Konicek on 12:00 AM 0 comments

TFS addin for Outlook TaskConnect goes live!

You can download the first beta of TaskConnect now. I've been working on this for the last year with a team of cool guys in Prague.
TaskConnect is quite unique as it integrates TFS into Outlook in a new, clever way:

  • TaskConnect is a full-fledged TFS client with fulltext search field at your fingertips right in Outlook
  • Work items can be attached to emails: when you are discussing a work item with someone, the work item is visible right next to the email throughout your whole conversation. You can of course edit it right from Outlook.
  • Saving your time is absolutely the primary goal - speed of use is just incomparable to any existing TFS client
We think this is such a good idea that it would be silly just to support TFS. So in the future you can expect Outlook integration of many popular issue tracking systems. We also have a ton of ideas for the future and we are looking forward to your feedback and ideas.

Posted by Martin Konicek on 4:50 PM 0 comments

C# 4 delegates contravariance

A little quiz.

Given the following two delegates:

delegate void EventHandler(object sender, EventArgs e);


delegate void PropertyChangedEventHandler(object sender, PropertyChangedEventArgs e);

Does the following code compile?

void propertyHandler(object sender, PropertyChangedEventArgs e)

{ }


EventHandler handler = propertyHandler;

Did you answer "YES, because PropertyChangedEventHandler IS an EventHandler"?

Unfortunately, the answer is no. Imagine how would the following code work:

handler(this, new EventArgs());

How could just EventArgs be passed to propertyHandler, which expects PropertyChangedEventArgs?

Actually, the exact opposite is correct in C# 4:

void handler(object sender, EventArgs e)

{ }


PropertyChangedEventHandler propertyHandler = handler;

Then, calling

propertyHandler(this, new PropertyChangedEventArgs("Name"))

is perfectly ok, because the handler just sees passed PropertyChangedEventArgs as EventArgs.

So the conclusion is: you can handle specialized events using less specialized handlers (you can handle eg. PropertyChanged event using just an EventHandler).

For more info, see C# delegates on msdn.

Posted by Martin Konicek on 4:58 AM 0 comments