I’ve been using Internet Explorer 9 since it was in early beta, after I realized that FireFox 3.6 and 4 took an eternity to launch. IE9 is awesome–it’s fast, very stable, and it just stays out of the way when I’m browsing. Here are two of my favorite tips. (Disclaimer: These may have been available in previous versions of IE, but I never found them.)
Widen the URL bar
The default URL bar is distressingly small. When you get a website with a long domain name that uses SSL, all you can see is a few characters. There’s an easy fix. If you hover over the left edge of the leftmost tab, the cursor turns into a double “resize me” arrow. I widen the URL bar to occupy a little more than half of the screen width, which lets me use five or six tabs comfortably.
Change the default download location
I hate digging around the Documents folder after I download something, so I used to click Save As and browse to my desktop to make the file easier to find later. No need for that anymore. Click the gear icon next to the tab well, or press Ctrl + J. This brings up the View Downloads dialog. Click the Options link in the lower left corner, then browse to your desired default location.
The Silverlight Unit Testing Framework for Windows Phone 7 is an integral part of my workflow. One thing that has bugged me every time I use it, though, is how I always saw some clipped-off graphics on the bottom of the test harness screen. It looked like some useful information–what was it?
What are those clipped elements at the bottom of the screen?
Turns out there is a simple fix. Although it isn’t noticeable, the WP7 system tray (where the clock and signal icons go) is enabled. The tray pushes the rest of the page elements down.
To disable it, open the MainPage.xaml file in your test project and set the
shell:SystemTray.IsVisible="True" flag to
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
Now when you run the tests, you’ll see a bar across the bottom of the screen that summarizes the results of your test run.
The graphic turns out to be a summary of the test run. Cool!
This week I have been diving back into my Windows Phone 7 projects, and I installed the January (February, really) 2011 WP7 update as well as the Caliburn.Micro MVVM project template. (Caliburn.Micro is amazing, incidentally.)
After I created a new Windows Phone project, I noticed that Visual Studio’s default debugging target had changed. Instead of firing up the Windows Phone emulator by default like it used to, Visual Studio tried to connect to my phone, which naturally wasn’t connected, resulting in the following error message:
Zune software is not launched. Retry after making sure that Zune software is launched.
This was really annoying. Every time I restarted Visual Studio, I had to remember to change the target back to the emulator. Or more accurately: I had to wait for Visual Studio to fail to deploy to my phone and prompt me with the error, then change the target.
A search through the options came up empty, so I turned to Stack Overflow, where user Martin pointed me to the answer:
When you install the January 2011 Update, the default deployment target for Windows Phone Projects in Visual Studio changes to Windows Phone 7 Device. You can change the default target to Windows Phone 7 Emulator by using the following steps:
- Close all Visual Studio and Windows Phone Emulator instances.
- Delete the contents of %LocalAppData%\Microsoft\Phone Tools\CoreCon.
- Restart Visual Studio.
I’d also noticed this issue crop up in Bob Tabor’s Windows Phone 7 Development for Absolute Beginners Series. At one point he growls about needing to fix that setting when he gets the Zune error message for the n-th time in a row. That series was recorded on an earlier version of the tools, so maybe this is a bug that has resurfaced. Glad it’s so easily addressed.
Simple is a good thing when you're learning a new technique.
I’m in the process of learning how to apply the MVVM design pattern in my Windows Phone 7 development, but for some reason it’s hard to find simple, working examples that illustrate specific tasks. Most of the blog posts I’ve come across are either highly theoretical, outdated (relying on the CTP version of the WP7 development tools, for example) or too complicated for an MVVM beginner to grasp. Maybe I’m feeble minded, but an MVVM “beginner tutorial” that packages UIs for Windows Phone 7, WPF and Silverlight into a single Visual Studio solution along with separate data access and business logic projects doesn’t help me learn MVVM. It just makes my brain hurt. I just want to know how to make this button click do something useful in my viewmodel.
To that end, this example does just one thing: When you click the Start button, a white circle animates from left to right. Here’s what’s happening behind the scenes:
- The Start button is bound to a command in the viewmodel.
- When the command is triggered in the viewmodel, it broadcasts a message, which is really just an object that you define.
- The codebehind page, which has been listening for the message, starts the animation.
If this seems like extra work, it is. So why not just start the animation from a click event in the codebehind and be done with it? The benefit becomes more obvious later when you add complexity to your app. The message that starts your animation could be used to trigger events in other areas of your application when you want several things to happen simultaneously. You can also write unit tests that validate that your “start animation” message is sent in response to the correct event.
The code download requires Laurent Bugnion’s MVVM Light Toolkit, and I have included the toolkit DLLs in the project. It uses the fall 2010 RTM version of the Windows Phone 7 Developer Tools. I have removed a lot of the stock code that is included in the default MVVM Light template to clarify which code is essential to the example.
Download Example Code
Comments and constructive criticism are welcomed.