Aaronontheweb

Hacking .NET and Startups

New Windows Phone 7 App: Lolcats Professional Pro Plus

December 22, 2011 08:30 by Aaronontheweb in Windows Phone 7 // Tags: , , // Comments (0)

localcatsproplus-icon-largeIn addition to my regular work for Microsoft and the open source projects I create and contribute to on Github, I also like to ship the occasional app or website under my StannardLabs masthead.

My absolute favorite app that I shipped early in the summer is Lolcats Professional Pro Plus, a simple app that makes it a breeze to flip through pictures of Lolcats from ICanHasCheezburger.

I’ve since modified the app pretty drastically so that it now includes touch support, a clean minimalist UI, and a selection of 60,000 plus images to page through, with hundreds more being added every day.

Lolcats Professional Pro Plus is currently designed for Windows Phone 7.0, although a Mango version is on the way soon. Here’s what the app currently looks like:

screenshot1screenshot2screenshot3screenshot4

Do me a favor and go download the app from the Windows Phone 7 app store – it’s free and is a great way to kill time when you need it.

If you enjoyed this post, make sure you subscribe to my RSS feed!



Announcing XAPFest – A Massive Windows Phone 7 Hackathon in Santa Monica, CA on June 4th 2011

xapfest_black_logoI am pleased to announce something very exciting that Microsoft is doing in my neighborhood of Santa Monica, California: we’re putting together XAPFest, a massive Windows Phone 7 hackathon aimed to bring together startups and mobile developers of all skill levels for a day of creativity and competition.

XAPFest is going down on Saturday, June 4th at the Loews Santa Monica Beach Hotel (directions) – doors open at 9:00am and will close at approximately 10:00pm. There will be opportunities for individuals and teams of developers to win prizes, eat great food, and have fun hacking down by the beach.

XAPFest is free to attend, and anyone can register for XAPFest if they wish to participate.

So here’s the full scoop behind XAPFest.

XAPFest Rules & Conditions

Your goal as a XAPFest participant is to produce a Windows Phone 7 application in a 80-90% complete state by 6:00pm on Saturday, June 4th at the Loews Santa Monica Beach Hotel (see the full schedule and driving directions.)

Here are the rules:

  1. You can get started early, and we ENCOURAGE you to get started before June 4th; install the tools and create a project on XAPFest.com and begin working on your app ASAP.
  2. You can work either as an individual or on a team of up the three people.
  3. Any apps you submit for consideration must not be in the marketplace prior to June 4th (new apps only!)
  4. In order to claim a prize, your app has to be accepted into the Windows Phone 7 marketplace shortly after XAPFest.
  5. You can submit multiple apps in XAPFest, but a team can only claim one prize in total.

 

Install the free Windows Phone 7 development tools early, create an app project, invite your friends, and write updates / post screenshots for your apps often!

If you have any questions about the event or want to know how to get involved (beyond registering and attending XAPFest,) please contact me and I’ll be in touch!

Otherwise, see you on June 4th!

P.S. Take a look at the apps I've created for XAPFest:

If you enjoyed this post, make sure you subscribe to my RSS feed!



Geolocation Services and Bing Maps in Windows Phone 7

Tonight I gave a brief talk to WinMo LA about using Geolocation Services and Bing Maps on Windows Phone 7. I mostly covered the APIs and controls that developers can use in the current Windows Phone SDK, the steps developers need to take in order to protect a user's data, and some of the future things that are changing in Mango for Windows Phone 7 developers.

Source Code for Demos:

  1. Bing Maps WP7 Demo [Github]
  2. Geolocation WP7 Demo [Github]

Other Important Links

  1. Bing Maps Portal - Get API Keys for Bing Maps
  2. MIX11 Sessions - Get all of the updates on Mango and WP7.
  3. WinMo LA - Subscribe for the next event!
  4. Windows Phone Dev Podcast - Unofficial Podcast for Windows Phone 7

If you enjoyed this post, make sure you subscribe to my RSS feed!



Having Network Connectivity Issues with the Windows Phone 7 Emulator?

April 7, 2011 18:07 by Aaronontheweb in Windows Phone 7 // Tags: , // Comments (0)

I spent about three hours banging my head against the wall trying to figure out why my browser could connect to the Internet but the Windows Phone 7 emulator couldn’t, and if you find yourself in the same boat as me I thought I would spare you the trouble.

Are you seeing something like this when you try to pull up a web page in IE on the emulator?

image

If that’s the case, then you’re having network connectivity issues specific to the Windows Phone 7 emulator. There’s a guide to troubleshooting Windows Phone 7 emulator issues on MSDN, and it speaks to the root of the issue: your HTTP proxy settings.

If you’re like me, you like using Fiddler for testing network I/O when you’re trying to connect to RESTful services – Fiddler acts as a proxy and disrupts all network I/O from the emulator; leave it turned off while you’re working with the Windows Phone 7 emulator.

Thought I’d spare any other Fiddler / Windows Phone 7 using developers the trouble Smile with tongue out

If you enjoyed this post, make sure you subscribe to my RSS feed!



6 Really Useful Windows Phone 7 Articles

I’m in the midst of working on a line of related Windows Phone 7 MVVM Light applications which are all built on the upcoming release of Quick and Dirty Feed Parser, which includes Silverlight and Windows Phone 7 support.

I found the following articles to be really useful in the course of trying to smooth out some performance problems, implement local caching, and are just generally good links to have around if you’re trying to do any serious WP7 development:

  1. Performance of Windows Phone 7 Applications – if you’re wondering why your UI seems sluggish, then you need to read this article. It explains how to use built-in tools to enable basic performance monitoring and has a great list of fixes for common performance problems.
  2. Using Isolated Storage on Windows Phone 7 – provides a great learn-by-example overview of how you can use IsolatedStorage in Windows Phone 7 to perform simple reads, writes, and serialization operations.
  3. How to Access Packaged XML Files in Silverlight – if you ever find yourself struggling to figure out how to access XML files that you package with your Silverlight or Windows Phone 7 application, the techniques illustrated in this article should provide some illumination. It’s not as easy or intuitive as it is in ASP.NET or WPF development, but it works nonetheless.
  4. Rapid Repository 2.0 – If you’re looking for a great local db to use in Windows Phone 7, Rapid Repository might be right for you. It’s simple and easy to use, but it’s mandatory Guid-only-key policy was a deal-breaker for me. Still, compared to some of the other engines I tried, it’s one of the more well-designed local database implementations I’ve used.
  5. Passing Parameters With Behaviors In MVVM Light for Windows Phone – Great article which explains how to use commanding in MVVM Light. I use EventToCommand everywhere in my MVVM Light applications, so this was a helpful resource for me – the code sample in particular.
  6. Add/RemoveRange Methods for ObservableCollection in Silverlight - This article solved a major UI performance problem for me; the technique of supressing property notification changes for bulk modifications to lists resulted in a pretty drastic performance improvement. I'll be doing a follow-up post on this myself.

Let me know in the comments if there are any great Windows Phone 7 links that you’ve used recently that are worth sharing!

If you enjoyed this post, make sure you subscribe to my RSS feed!



Where Are My Windows Phone 7 Icons?

December 6, 2010 21:00 by Aaronontheweb in Windows Phone 7 // Tags: // Comments (0)

appbar.favs.addto.rest This is a quick post, but for anybody who isn’t using Expression Blend (which automatically puts all of the Windows Phone 7 icons for you in a drop-down list as default resource values for images) and wants to get access to icons in Windows Phone 7, here is where you can find them:

C:/Program Files (x86)/Microsoft SDKs/Windows Phone/v7.0/Icons/

image

If you enjoyed this post, make sure you subscribe to my RSS feed!



Consuming REST in .NET

I gave a talk at Code Camp Los Angeles a couple of weekends ago on how to consume REST APIs in .NET – the emphasis was really on understanding RESTful principles and on the OAuth workflows + implementing them in Windows Phone 7.

It was meant to be a 100-200 level introduction to the REST in .NET – if you’ve implemented OAuth before in .NET then this is old news for you :p

Enjoy!

If you enjoyed this post, make sure you subscribe to my RSS feed!



MVVM Light Toolkit Pitfalls on Windows Phone 7 and How to Avoid Them

mvvm-light I’ve been leaning heavily on Laurent Bugnion’s MVVM Light Toolkit framework in the course of learning Windows Phone 71 development for my work as a developer evangelist at Microsoft. It’s a fantastic framework and it does an excellent job of enabling SOC in Windows Phone 7 application development.

However, during some of my experimentation with the framework I’ve run into some initially puzzling development pitfalls that I wanted to share and demystify.

These pitfalls might also apply to vanilla Silverlight and WPF in general, but my experience has been with Windows Phone 7 development so I’ll qualify these pitfalls accordingly:

Pitfall #1 – DispatcherHelper is NOT initialized by default

The DispatcherHelper is useful for scenarios like this one from my Twitter search MVVM demo on WP7 where you have to marshal UI updates across threads:

//ListBox on MainPage.xaml is bound to this collection of Tweet objects
public ObservableCollection Results { get; private set; }

//Callback method when RestSharp returns an RSS feed worth of tweets relevant to our keyword
public void GetResults(RestResponse results)
{
    var returnResults = SearchResultConverterHelper.ConvertRssFeed(results.Data);
    DispatcherHelper.CheckBeginInvokeOnUI(() =>
    {
        Results.Clear();
        foreach (var item in returnResults)
        {
            Results.Add(item);
        } 
    });            
}

If you try to use this code as-is in your application you’ll receive a NullReferenceException stemming from the DispatcherHelper itself. This is because the default MVVM Light Toolkit project templates don’t call DispactherHelper.Initialize() anywhere; so the fix to this is pretty easy – just add this line of code inside your App.xaml.cs constructor:

public App()
{
    // Global handler for uncaught exceptions. 
    // Note that exceptions thrown by ApplicationBarItem.Click will not get caught here.
    UnhandledException += Application_UnhandledException;

    // Standard Silverlight initialization
    InitializeComponent();

    //Readies the DispatcherHelper for usage throughout application
    DispatcherHelper.Initialize();

    // Phone-specific initialization
    InitializePhoneApplication();
}

This will ensure that any calls you make to the DispatcherHelper

Pitfall #2 – EventToCommand namespaces are not included by default

EventToCommand is awesome. Take a moment to look at the documentation on it and bask in its elegant simplicity. Here’s an example below from my Twitter demo again:

<TextBox Height="71" Name="txtBoxSearch" Text="" Width="370" />
<Button Content="Go!" Height="71" Name="btnSearch" Width="Auto">
<Interactivity:Interaction.Triggers>
    <Interactivity:EventTrigger EventName="Click" x:Name="btnSearchClickedEventTrigger">
        <Command:EventToCommand Command="{Binding ExecuteSearch}" 
                                CommandParameter="{Binding Text, ElementName=txtBoxSearch}"/>                                
    </Interactivity:EventTrigger>
</Interactivity:Interaction.Triggers>
</Button>

However, there is one minor pitfall which is that in order for this code to compile you need to make sure that both of these namespaces are included in your XAML file:

xmlns:Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP7"
xmlns:Interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"

This isn’t really a pitfall so much as it is a snag that can slow you down when you’re trying to hammer out code.

Pitfall #3 – Messenger.Register/Send may not occur in the order you expect

Here are two pieces of code I have in a new Windows Phone 7 application I’m building – the first is in my MainViewModel class and the other is in the MainPage.xaml.cs code-behind:

MainViewModel.cs

//From the constructor of my MainViewModel class
DetermineAccountStatus = new RelayCommand(() => 
    {
        if (Accounts.Count == 0)
            Messenger.Default.Send(MessagingConstants.NoTwitterAccountsAuthorized, MessagingConstants.AccountsStatus);
        else
            Messenger.Default.Send(MessagingConstants.AtLeastOneTwitterAccountAuthorized, MessagingConstants.AccountsStatus);
    });
DetermineAccountStatus.Execute(new object());

MainPage.xaml.cs

public MainPage()
{
    InitializeComponent();

    //Receive messages from the view model notifying us if we need to show our "no accounts added" message or not
    Messenger.Default.Register(this, MessagingConstants.AccountsStatus, s =>
    {
        if (s == MessagingConstants.NoTwitterAccountsAuthorized)
            this.txtBlockMissingAccounts.Visibility = System.Windows.Visibility.Visible;
        else
            this.txtBlockMissingAccounts.Visibility = System.Windows.Visibility.Collapsed;
    });                  
}

So what’s the problem here? The problem is that because the XAML parser instantiates the MainViewModel first because the ViewModelLocator is included in the App.xaml resource dictionary, which is hit first by the XAML parser before the MainPage.xaml file is!

<!--Application Resources-->
<Application.Resources>
    <vm:ViewModelLocator x:Key="Locator"
                            d:IsDataSource="True" />       
</Application.Resources>

Therefore the message is sent before the MainPage class ever has a chance to register to receive it.

This is a design mistake and it’s easy to make: don’t send any messages during object instantiation. Instead, let the View invoke the ViewModel after it’s loaded, like so:

public MainPage()
{
    InitializeComponent();

    //Receive messages from the view model notifying us if we need to show our "no accounts added" message or not
    Messenger.Default.Register(this, MessagingConstants.AccountsStatus, s =>
    {
        if (s == MessagingConstants.NoTwitterAccountsAuthorized)
            this.txtBlockMissingAccounts.Visibility = System.Windows.Visibility.Visible;
        else
            this.txtBlockMissingAccounts.Visibility = System.Windows.Visibility.Collapsed;
    });

    Loaded += new System.Windows.RoutedEventHandler(MainPage_Loaded); 
}

        
void MainPage_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
    //Tell the ViewModel to call us back regarding whether or not we have any accounts to list in our listbox
    ViewModel.ViewModelLocator.MainStatic.DetermineAccountStatus.Execute(new object());
}

The MVVM Light Toolkit is a great framework and it’s a pleasure to work with once you start to understand some the nuances of Silverlight / Windows Phone 7 development. If you have any questions please feel free to leave a comment on this post!


1If you're interested in developing for Windows Phone 7, you can download all of the development tools for free from http://developer.windowsphone.com/

If you enjoyed this post, make sure you subscribe to my RSS feed!



MVVM Light Toolkit Example on Windows Phone 7: Twitter Search

I wrote this example in conjunction with the lightning talk I gave at SHDH #40 on MVVM for Noobs, and I thought that developers who are new to developing in Silverlight or for Windows Phone 7 might benefit from it.

One of the major issues I had in moving from ASP.NET MVC to MVVM in Windows Phone 7 was learning how to let go and let Silverlight do a lot of the heavy lifting for me, particularly in the area of data binding and managing the life cycles of your business objects.

Please take a look at the attached source – I’ll be writing up a follow-up post with some specific learnings in the near future.

mvvm wp7 twitter search.zip (471.88 kb)

If you enjoyed this post, make sure you subscribe to my RSS feed!



SuperHappyDevHouse Lightning Talk: MVVM for Noobs

I'm at Microsoft's Silicon Valley Campus this weekend where we're hosting SuperHappyDevHouse #40 - I'm going to be giving a lightning talk on MVVM for Noobs in the next hour or so and I wanted to post my presentation online as I think some of you might find it to be of some use. My presentation is largely focused on the MVVM Light Toolkit for Windows Phone 7, and I really struggled to grasp MVVM when I first started developing for WP7 largely because of some long-held views I brought over from ASP.NET MVC and tried to force upon Silverlight and MVVM.

This presentation should help shed some light on how to get some of the necessary plumbing up and running.

If you enjoyed this post, make sure you subscribe to my RSS feed!



Search

About

My name is Aaron, I'm an entrepreneur and a .NET developer who develops web, cloud, and mobile applications.

I recently joined Microsoft as a Startup Developer Evangelist in Southern California (Santa Monica) and help evangelize the BizSpark program and the .NET platform to startups. 

Recent Comments

Comment RSS

Sign in