Blog
My thoughts about and frustrations with .net development and anything else that takes my mind.

Missing WP7 SDK features IMHO

Windows Phone 7 is very close to release which I'm really looking forward to, what I'm really hoping is that version iterations for the phone are quick and we can see a lot more features showing up. Here's a few things I'd like to see in the pipeline based on my experience so far in developing on the device.

  • Version parity with Silverlight 4: Having the differences in Silverlight between the web and the phone make things a little more complicated, especially when Silverlight 4 solved a lot of my problems around Binding (especially to behaviors). Having a Content Loader available for PhoneApplicationFrame would also enable better MVVM patterns as well.
  • Launchers and Choosers: There needs to be some more of these available, launching the maps application at a certain point would be great. A chooser capable of selecting a profile and not just a number or email address would be very useful for prepopulating forms in CRM style apps.
  • Emulator: A more persistent emulator with regards to things like Isolated Storage, settings and contacts would make any application working with these easier.

For me the more important things are clearly extensiblity in the platform and the phone itself. I hope this is where we're heading.

Shout It Kick It submit to reddit

Two more WP7 tutorials

I've just upated the Windows Phone 7 Example Applications list with the next two applications. Both are a little longer, and little more complex as I try to introduce some more features. Given that both also use Expression Blend to do some of the work I've included videos on how to use Blend.

Count Me In is an app to help you keep your place while counting, it introduces the MVVM pattern, commands, binding and behaviors.

Reaction Time tests your reaction speed and brings into play the Silverlight Visual State Manager, transforms and transitions.

Hope you enjoy.

Shout It Kick It submit to reddit

Social Media Html Helpers

I'm currently in the process of writing the next to tutorials in my Windows Phone 7 tutorial series and thought I'd share these snippets of code.

public static class SocialMediaExtensions

{

    public static HtmlString DotNetShoutOut(this HtmlHelper htmlHelper, string url)

    {

        url = HttpUtility.UrlEncode(ToAbsolute(htmlHelper.ViewContext.HttpContext.Request, url));

 

        var img = new TagBuilder("img");

 

        img.Attributes["src"] = "http://dotnetshoutout.com/image.axd?url=" + url;

        img.Attributes["alt"] = "Shout It";

        img.Attributes["style"] = "border: 0px;";

        img.Attributes["width"] = "82";

        img.Attributes["height"] = "18";

 

        var a = new TagBuilder("a");

 

        a.Attributes["rev"] = "vote-for";

        a.Attributes["href"] = "http://dotnetshoutout.com/submit?url=" + url;

 

        a.InnerHtml = img.ToString(TagRenderMode.SelfClosing);

 

        return new HtmlString(a.ToString(TagRenderMode.Normal));

    }

 

    public static HtmlString DotNetKicks(this HtmlHelper htmlHelper, string url)

    {

        url = HttpUtility.UrlEncode(ToAbsolute(htmlHelper.ViewContext.HttpContext.Request, url));

 

        var img = new TagBuilder("img");

 

        img.Attributes["src"] = "http://dotnetkicks.com/services/images/kickitimagegenerator.ashx?url=" + url;

        img.Attributes["alt"] = "Kick It";

        img.Attributes["style"] = "border: 0px;";

        img.Attributes["width"] = "82";

        img.Attributes["height"] = "18";

 

        var a = new TagBuilder("a");

 

        a.Attributes["rev"] = "vote-for";

        a.Attributes["href"] = "http://dotnetkicks.com/kick/?url=" + url;

 

        a.InnerHtml = img.ToString(TagRenderMode.SelfClosing);

 

        return new HtmlString(a.ToString(TagRenderMode.Normal));

    }

 

    public static HtmlString Reddit(this HtmlHelper htmlHelper, string url)

    {

        url = HttpUtility.UrlEncode(ToAbsolute(htmlHelper.ViewContext.HttpContext.Request, url));

 

        var img = new TagBuilder("img");

 

        img.Attributes["src"] = "http://reddit.com/static/spreddit7.gif";

        img.Attributes["alt"] = "submit to reddit";

        img.Attributes["style"] = "border: 0px;";

 

        var a = new TagBuilder("a");

 

        a.Attributes["rev"] = "vote-for";

        a.Attributes["href"] = "http://reddit.com/r/programming/submit?url=" + url;

 

        a.InnerHtml = img.ToString(TagRenderMode.SelfClosing);

 

        return new HtmlString(a.ToString(TagRenderMode.Normal));

    }

 

    private static string ToAbsolute(HttpRequestBase request, string url)

    {

        if(request == null)

            throw new ArgumentNullException("request");

 

        if(url == null)

            throw new ArgumentNullException("url");

 

        var format = request.IsSecureConnection ? "https://{0}{1}" : "http://{0}{1}";

 

        return String.Format(format, request.Url.Host, url);

    }

They're pretty simple little helpers and can be used for any urls. The only thing that may need to change is the ToAbsolute method which is only for the root application. To the use the helpers in my blog I have the following.

<p>

    <%: Html.DotNetShoutOut(Url.Action("Posts", new { slug = Model.Slug.ToLower() })) %>

    <%: Html.DotNetKicks(Url.Action("Posts", new { slug = Model.Slug.ToLower() })) %>

    <%: Html.Reddit(Url.Action("Posts", new { slug = Model.Slug.ToLower() })) %>

</p>

Shout It Kick It submit to reddit

More Windows Phone 7 Tutorials

I've just posted the third and fourth tutorials in my series in recreating the AppsAmuck sample applications for Windows Phone 7. These two cover Tasks and connecting to a JSON service. Both of these show some limitations in the current WP7 SDK.

Tasks

My IP Address

You can view the full list at Windows Phone 7 Tutorials.

Shout It Kick It submit to reddit

Windows Phone 7 Tutorials : Apps Amuck

I always do a lot better with learning new technologies when there's a clear goal in mind, some small application that uses the functionality I want to learn. The AppsAmuck website currently provides 31 of these example applications for people wanting to learn iPhone development, what better way to learn some Windows Phone 7 (and Silverlight) than by working my way through bringing these applications across to WP7.

I' have the first two applications, Minutes to Midnight and Candle already up at Windows Phone 7 Tutorials.

Shout It Kick It submit to reddit