Saturday, August 18, 2007

Vista gadgets and visual studio programming

I've been playing with creating vista sidebar gadgets. The basic structure of them is pretty simple, just an html page and some javascript.

There is a way, though, to embedded user controls on the html pages, thereby letting you program in C# or VB. http://helpcentral.componentone.com/article.aspx?id=1781

I've created a gadget that allows for pushing published code (by ftp) up to a selected server. It'll only copy selected files, so it avoids having to select (and possibly mess up) in an ftp program. I'll publish it when I've gotten all of the bugs worked out.

The only downside is having to register the user controls as com objects. I'd also recommend the tools at http://www.microsoft.com/technet/technetmag/issues/2007/06/UtilitySpotlight/default.aspx for allowing opening up a command prompt with admin privs easily.

My one big issue is recompiling the dlls. I can't figure out a way to completely free them when I want to update them (weirdly I can rename them but not delete them). Usually I have to restart to get the new versions recognized.

Some pretty powerful utilities can be built in the sidebar with this.

Labels: , , , , ,

Wednesday, June 20, 2007

Both VB and C# code in the same project

Being stuck in a situation where there was both C# and VB code that needed to be in the same project I was able to find a way to support both (without having to run one through an translator).

Create a vb and cs folder in the App_Code directory (putting the appropriate files in each) and just put the following in your web.config:

<compilation debug="true">
<codesubdirectories>
<add directoryname="vb"></add>
<add directoryname="cs"></add>
</codesubdirectories>
</compilation>

Labels: , , , ,