Archive for

November 2010

Mobile Boarding Pass Success

P602

I've tried mobile boarding passes before without success. By the time I've tried to navigate round my phone to get to the appropriate image or web site, getting a piece of paper out has generally been quicker. So it was with a degree of scepticism that I tried out the BA iPhone app with it's board pass option for a flight to Lyon today.

It worked a treat.

The key for me was that it worked well enough for the gate agent who hadn't used it before to let me board without issue.

Why did it work this time and not before? A well designed app with good state management and fast app switching was they key. It meant I wasn't tentatively nursing my phone as I approached each of the check points desperately trying to keep the screen alive while not navigating away from the boarding code.

A long promised revolution in travel documentation may well be upon us.

Posted

Base View Model in ASP.NET MVC

I needed to reference some user context variables from within my site master page that had some logic behind their retrieval.

In this example I need to choose the display language for a user.

  1. Check cookie present indicating user's language preference
  2. if not use HTTP language header
  3. if not use the application default language

The pattern I've ended up using is to implement a base view model from which all my specific view models inherit as follows:

public class BaseViewModel {     
    public string UserLanguage     
    {      
       get      
       {          
           return HttpContext.Current.Request.Cookies["language"] != null        
               ? HttpContext.Current.Request.Cookies["language"].Value           
               : CultureInfo.CurrentCulture.TwoLetterISOLanguageName;     
        }
    } 
}

 

I then use the generic class for the master page

<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage<BaseViewModel>" %>

Which then allows me to reference the model in the master page and keep the logic for deciding the language to display centralised.

Not sure I'm wholly happy with the inheritance as it adds a level of dependencies which smells a bit off but in the small application I'm working in it was easy to implement and does what I need.

Filed under  //  dev  
Posted