"Encourage" Visual Studio Extension
- Posted: Aug 06, 2014 at 6:00 AM
- 11,528 Views
- 4 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Since I've not been doing the Visual Studio Monday posts these past few weeks posts have been piling up.
There's just too many cool things in that pile that I can't help myself. So instead of "Windows Wednesday" it's going to be a Haack Wednesday!
Phil Haack posted a pretty unusual Visual Studio extension, with source of course, that I hope will encourage (or not, you'll see... lol) you too...
Adds a bit of whimsy to your work day.
There are times when writing code is drudgery. In those dark times, bathed in the soft glow of your monitor, engrossed in the rhythmic ticky tacka sound of of your keyboard, a few kind words can make a big difference. And who better to give you those kind words than your partner in crime - your editor.
Encourage for Visual Studio is a whimsical extension to Visual Studio that adds just a little bit of encouragement throughout your day.
Every time you save your document, this extension gives you an unobtrusive bit of good cheer and encouragement.
There are times when writing code is drudgery. That love for code becomes obsession and leads to an unhealthy relationship. Or worse, there are times when the thrill is gone and the love is lost. You're just going through the motions.
In those dark times, bathed in the soft glow of your monitor, engrossed in the rhythmic ticky tacka sound of of your keyboard, a few kind words can make a big difference. And who better to give you those kind words than your partner in crime - your editor.
With that, I give you ENCOURAGE. It's a Visual Studio extension that provides a bit of encouragement every time you save your document. Couldn't we all use a bit more whimsy in our work?
Yes, it's silly. But try it out and tell me it doesn't put an extra smile on your face during your day.
This wasn't my idea. My co-worker Pat Nakajima came up with this idea and built a TextMate extension to do this. He showed it to me and I instantly fell in love. With the idea. And Pat, a little.
As of today, this only supports Visual Studio 2013 because of my ineptitude and laziness. I welcome contributions to make it support more platforms.
On the positive side, when you need a specific service, it's nice to be able to slap an
[Import]attribute and magically have the type available. The extensibility of Visual Studio appears to be nearly limitless.
On the downside, it's ridiculously difficult to write extensions to do some basic tasks. Yes, a big part of it is the learning curve. But when you compare the Textmate example to what I had to do here, clearly there's some middle ground here between simplicity and power.
Recently I wrote what many consider to be the most important Visual Studio Extension ever shipped - Encourage for Visual Studio. It was my humble attempt to make a small corner of the world brighter with little encouragements as folks work in Visual Studio. You can get it via the Visual Studio Extension Manager.
But not everyone has a sunny disposition like I do. Some folks want to watch the world burn. What they want is Discouragements.
Well an idiot might write a whole other Visual Studio Extension with a set of discouragements. I may be many things, but I am no idiot. This problem is better solved by allowing users to configure the set of encouragements to be anything they want.
And that's what I did. I added an Options pane to allow users to configure the set of encouragements. It turned out to be a more confusing ordeal than I expected. But with some help from Jared Parsons, I may now present to you, discouragements!
So if you're of the masochistic inclination, you can treat yourself to custom discouragements all day long if you so choose.
Discouragement in use
Challenges and Travails
So why was this challenging? Well like many things with development platforms, to do the basic thing is really easy, but when you want to deviate, things become hard.
Thankfully, Jared pointed me to the
If you want to provide a WPF User Control for your Visual Studio Extension, derive from
DialogPagelike all the samples demonstrate!
It does all the necessary
WndProcmagic under the hood for you. Note that it was introduced in Visual Studio 2012 so if you take a dependency on it, your extension won't work in Visual Studio 2010. Live in the present I always say.
The other thing I learned is that
AppSettingsis not the place to save your extension's settings. As Jared explained,