Archive for the ‘.NET’ Category.

Using the new WPF themes

So I am looking around for some ideas on making this WPF based application for Windows that I am working on look slightly less sucky. And I see some nifty themes on this web page:

WPF Themes

And I am thinking that would be pretty cool to just swap in one line in the App.xaml file, and my whole app would look different.

Cool in theory, but some implementation details are a bit fuzzy.

Here is what I did to get it working with VS 2010 Ultimate:

  • Install the WPF Toolkit by clicking on the big purple “download” button on the above web site
  • Download the themes xaml files by going to this web site: WP Futures (scroll down to WP Themes and click the link to download the zip file)
  • Unzip the downloaded file and add the needed xaml files to your WPF project
  • Add a reference to WPF Toolkit in your application’s References folder
  • Add a ResourceDictionary line to the Application.Resources section of your App.xaml file to make it look like the one shown on the WPF Themes page above

Keep in mind that if you put your xaml theme files in a folder off the root of your project, you will need to adjust the Source property of the ResourceDictionary. For example, I put the xaml theme files in a Themes folder off the root of the project, so the Source for me looks like this:

<ResourceDictionary Source="/Themes/ExpressionDark.xaml" />

BTW, Happy Birthday to John Petrucci, who is quite clearly not a native of this planet.

Stir Trek: Avengers Edition (May 4, 2012)

It was a fun time today attending the Stir Trek Avengers Edition developer event in Columbus, Ohio. I especially enjoyed the Scott Hanselman sessions on becoming more productive and on ASP.NET. And the movie was real loud.

Also, I would like to thank all the people who downloaded my Stir Trek 2012 app (link redacted, app has been removed from the App Store) for the iPhone. Yesterday’s download count was almost larger than the entire download count for the Stir Trek app I did in 2011.

BTW, to continue the movie theme, Happy Star Wars day to everyone.

The Windows 8 platform for Metro style apps (CONDG meeting, April 26, 2012)

Jennifer Marsman gave a rousing and lengthy presentation on Metro and Windows 8 last night to a packed house meeting of the Central Ohio .NET Developers Group. She almost makes me want to do a Metro app.

Prizes returned, and believe it or not, my name was drawn first for the door prizes. I think that it is a conspiracy that the prizes really suck when I win something. I walked away with a version 2 Code Complete book. And a cheer went up from the audience.

BTW, happy birthday to Ace Frehley, a true rock and roll icon. It was kind of a shame that Ace wasn’t playing with Kiss when they did the Dancing With The Stars Rock Week show a couple of weeks ago.

WCF, it is not as scary as you think (CONDG meeting, March 22, 2012)

Last night, I was in attendance at a packed house meeting of the Central Ohio .NET Developers Group. The main topic was WCF by Paul Bahler, and the content was very informative. Almost a bit too informative, as he spent most of his time in Visual Studio showing how to do various tasks in the wonderful world of web services.

Unfortunately, there were no prizes to be had at the meeting (unless you count the Donato’s pizza), as the CONDG president forgot the prize box. There were calls for an impeachment.

BTW, happy birthday to David Tom, who I actually liked playing Billy Abbott on Y&R.

Azure + SSL

Sorry about the delay in between posts kiddies, I have been very busy at work with Routzy and playing baseball at Pirates Fantasy Camp. Hopefully soon the Routzy app will be approved and I will be able to return to a more normal pattern of posting.

In the mean time, if you have a Windows Azure web site or services, and you want to secure them with an SSL certificate, I found this blog post to be indispensable:

Windows Azure: Secure Site with SSL certificate

BTW, a big shout out to Ohio’s own John Glenn, who, 50 years ago today, orbited the earth for almost 5 hours, a tremendous feat for the time.

Real world Conference data & a Windows Phone App! (CONDG meeting, December 8, 2011)

Samidip Basu gave a very informative presentation on OData as it applied to the Columbus M3 Conference that took place in November of 2011, and how he put together a Windows Phone app that consumed the Azure hosted data.

As it was at the December CONDG meeting two years ago, I won a totally crappy T-shirt, and gave it to a former co-worker. Which made the evening that much more successful.

BTW, Happy Birthday to the Petrified Forest National Park, established this day in 1962. The petrified logs and the Painted Desert are fantastic, I highly recommend a trip there.

How to Move Your App to the Cloud (CONDG meeting, June 23, 2011)

Brian Prince gave a presentation on Windows Azure at the Central Ohio .NET Developer Group meeting on June 23, 2011. The presentation was mostly talking the process of moving existing applications to Azure, and the pitfalls that can arise when doing so. It was a very interesting presentation, and very appropriate since the company I am now working at is looking at creating some cloud based services.

BTW, Happy 99th Birthday to Alan Turing. OK, he is not currently among the living, but Happy Birthday to him nonetheless.

Continuous Integration: More than just a toolset (CONDG meeting, March 24, 2011)

Jay Harris gave an excellent talk and demo on continuous integration at the Central Ohio .NET Developer Group meeting on March 24, 2011. The presentation was mostly talking about the concepts and pitfalls of continuous integration, but he did run through a quick installation and demo of a free continuous integration tool, and the demo gods smiled on Jay as it went pretty well.

Also, Shawn Wallace gave a quick presentation on the mysterious world of branching and merging, a subject that does not get nearly the attention that it deserves at most software companies.

On a personal note, my name was drawn as the first name on the door prizes, which meant that I could choose one of three unknown prizes. Of course, having the first choice, I drew the lemon of the lot (Windows Vista Ultimate, joyous day) and was embarrassed in front of the group. The second name drawn, a former co-worker of mine, also chose one of the unknown prizes, and got the best of the lot, a Microsoft Arc mouse. Oh well.

BTW, happy birthday to Steve Ballmer.

Don’t try, don’t catch

Have you ever had a situation where all of those nested try/catch blocks just get in your way when trying to chase down a problem? I just hate that.

Luckily, in Visual Studio 2008 (and other versions, I am sure), there is a handy dandy way to disable all of the try/catch blocks when you run the application in debug mode from the IDE.  Just go to the Debug menu, select Exceptions, click the box under the Thrown column for Common Language Runtime Exceptions (or others if that is what you are looking for), and click OK.  Now when the code has a problem, you see it right away instead of trying to work backwards through nested try/catch blocks in different classes and modules.

Just don’t forget to put it back to the way it was when you are done. I am not a huge fan of try/catch blocks, but their normal use definitely has its place.

Is this string numeric?

This VB code was brought to my attention.  It is meant to look at a string variable (prefixText) and decide if the string is numeric or not, and return a data set (ds) by using a different method based on the result of the numeric test. (As always, this code is in a heavily used production environment.)

If Left(prefixText, 1) = "0" Or Left(prefixText, 1) = "1" Or Left(prefixText, 1) = "2" Or Left(prefixText, 1) = "3" Or Left(prefixText, 1) = "4" Or Left(prefixText, 1) = "5" Or Left(prefixText, 1) = "6" Or Left(prefixText, 1) = "8" Or Left(prefixText, 1) = "9" Then
    ds = New Users(_ConnStr).getUsersListByNumber(prefixText)
Else
    ds = New Users(_ConnStr).getUsersListByLastName(prefixText)
End If

I have some great ideas on how to improve this code. The first thing I would have done was to use OrElse instead of Or, it would speed things up tremendously. And I would also have added in the test for the “7” character.