Tuesday, November 30, 2010

I want Layar on my WP7

Just browsed back a bit and found this post from when I had just gotten my Samsung Omnia Qwerty phone. I guess as soon as the camera access API - that LG is already using in their Look n Type and ScanSearch WP7 apps - gets official for general public use, there is no reason for Layar to not bring out a port of their client for Windows Phone 7. I'll be waiting...

Quick update after MWC: like I wrote in Barcelona, I expect this to be unveiled at MIX in Las Vegas, april 12-14. So it can't be long now.

Some handy extension methods for argument checking

After a quick Twitter interaction with Marc Jacobi I thought I'd post a small set of extension methods I like to use for argument checking:
using System;
using System.Collections.Generic;
using System.Text;

namespace peSHIr.Utilities
{
    public static class Guards
    {
        public static void GuardNull
            (this object argument, string argumentName)
        {
            if (argument == null)
            {
                throw new ArgumentNullException(
                          argumentName,
                          "No object supplied");
            }
        }

        public static void GuardNull
            (this string argument, string argumentName)
        {
            if (String.IsNullOrEmpty(argument))
            {
                throw new ArgumentNullException(
                          argumentName,
                          "No text supplied (or text is empty)");
            }
        }

        public static void GuardZero
            (this int argument, string argumentName)
        {
            if (argument == 0)
            {
                throw new ArgumentNullException(
                          argumentName,
                          "The number zero is not allowed here");
            }
        }

        public static void GuardNull<T>
            (this Nullable<T> argument, string argumentName)
            where T:struct
        {
            if (argument.HasValue == false)
            {
                throw new ArgumentNullException(
                          argumentName,
                          "Empty nullable type not allowed here");
            }
        }

        public static void GuardMinimum<T>
            (this T argument, T lower, string argumentName)
            where T : IComparable<T>
        {
            if (argument.CompareTo(lower) < 0)
            {
                throw new ArgumentOutOfRangeException(
                          argumentName, argument,
                          string.Format("Minimum allowed: {0}", lower));
            }
        }

        public static void GuardMaximum<T>
            (this T argument, T upper, string argumentName)
            where T : IComparable<T>
        {
            if (argument.CompareTo(upper) > 0)
            {
                throw new ArgumentOutOfRangeException(
                          argumentName, argument,
                          string.Format("Maximum allowed: {0}", upper));
            }
        }

        public static void GuardRange<T>
            (this T argument, T lower, T upper, string argumentName)
            where T : IComparable<T>
        {
            if (argument.CompareTo(lower) < 0 || argument.CompareTo(upper) > 0)
            {
                throw new ArgumentOutOfRangeException(
                          argumentName, argument,
                          string.Format("Allowed: [{0},{1}]", lower, upper));
            }
        }
    }
}
When you can use code contracts this is probably preferable. Otherwise, these little extension methods can come in really handy for some general cases.

Saturday, November 6, 2010

First WP7 app should be published!

This morning I found out that my first Windows Phone 7 application had passed testing. It's status is now "Published to Marketplace", but I have not been able to see it appear on my phone yet. Hope it does so soon.

In the meantime, here are a couple of screenshots of the application in English; it supports English, German, Spanish and, even though not supported yet, Dutch. All the content that is shown (RSS feed items from my companies website and its tweets) is in Dutch only, however.

Wednesday, November 3, 2010

Is WP7 getting another theme in its next version?

When playing with the example code solution of the November 2010 version of the Silverlight for Windows Phone Toolkit, I noticed the following:

Since this screen seems to do its best to mimick the Theme page from WP7 phone settings to show off one of the places where WP7 itself uses the ListPicker control (with appointment status being another one), I would not be surprised if we would see a new "dazzle" theme in a next version of the Windows Phone OS.

This piece of example code could mean nothing of course, but I'm still curious what a "dazzle" theme might look like...

Annoyed by swamped App Hub

Yes, I really am.

I admit that a launch of the magnitude of Windows Phone 7 is no easy thing. And that I didn't really get active in WP7 application writing until the LG developer prototype device from Microsoft arrived two weeks ago. But still.

I have been wanting to publish at least one WP7 app to the marketplace for almost those two weeks now. Thanks to Microsoft NL (way to go, Matthijs!) I should have been white-listed for WP7 app publishing already, but so far this has not materialized. The App Hub forum seems awash with developers in a similar predicament. Without a real solution in sight.

The relevant forum threads all started mentioning the magical date of november the 3rd as a solution: by then everyone registered as a marketplace developer (no matter the platform) would be able to publish WP7 apps. Too bad no time (and timezone) was mentioned for this...

Because right now here in the Netherlands 10am on november the 3rd has come and gone, but I still cannot publish. Combining the 'timezone' and the 'no specific time mentioned' issues I'm waiting for tomorrow morning, roughly assuming after 11pm on the 3rd on LA time. However, I do not assume publishing will have commenced normally (=in force) by then...

I would definately not want to be on the WP7 App Hub team right now. Good luck the coming weeks, guys!