Building my first Window Phone 7 app.

After winning the “Innovation Day” on 2010 with “iProperty Android App”, we participated on “iProperty Hack day 2011″ with extending the company’s services to the Window Phone 7 platform. The ideas are the same as the Android App, but this time I participate with a team (consist of 1 designer and another web developer).

We didn’t win but we are given a go on developing the app.

Designer
For the designer, it was a golden opportunity to learn about “Metro UI” which personally I feel that the it is one of the key factor to become “iPhone” or “Android” killer. The simplicity and the standard of the design both on the phone and the apps, makes me feel that even my non IT literate dad can use it.

Web Developer
For the web developer, who is passionate on native mobile application development. It was a wonderful entry to the mobile development world.

Why? Because:

  1. Microsoft Visual Studio
    We .Net Developers eat “Microsoft Visual Studio” for breakfast, so we familiar with the IDE. No time wasted on making the IDE run at all.
  2. C# as the language
    Our “Mother Language”, what more can we say?
  3. The “Emulator” was fast and smooth, I was developing in a low end notebook and the “Emulator” still runs nicely.
  4.  Full of resource on how to get started. Oh yeah, less time taken on Google!!
  5. Toolkit that those awesome people created, that have a list of beautiful & fantastic UI component to use.

Me
For me? Well, comparing with Android, i suffered less due to the few factors mention above. 😀

But there is more, we have invested lots of our time creating the web services and the framework for the company’s site. We get to reuse those stuff (done with blood and sweat) without any efforts at all.
Oh yeah, is like adding Wings to them and make them fly!!

The surprising experience of implementing “Image Lazy Loading“, when we are starting to adding this to the app, I explained to the Web Developer on how complicated this is. It was based on my horrible experience applying it on the Android Application, I banged my head on the wall countless times on this!!

After hearing what I say, The Web Developer took over my laptop, added the URL to the image to a image control in the XAML. And run the application, and immediately i saw the “Image Lazy Loading” itself…

Next thing I realized is, open source stuff makes you become a complicated person, and forgot how easy and joyful programming with Microsoft Tools.

Team
By now, you must be wondering whether I’m over promoting. There is  however some challenges during the development.

  1. Some learning curve on XAML
  2. Understanding “Metro UI” and applying to the applications.
  3. Endless (Bottomless) list
    It was the most challenging part in the Android development previously, same situation here.
  4. Live Tiles
    The minimum interval is 30 minutes, so you have to manually run the Live Tiles when first running the application to test if it is working.
    It took us sometime, but glad we figured it out in the end. 😀

We gone through these difficult moments with “Pair Programming“, which really help us shorten the time wastage!!
The Web Developer paired with The Designer to understand more on “Metro UI”.
Me and The Web Developer paired to learn & solve all the obstacles.

We spent 2 to 3 days, and 3 to 4 hours each day after work, paring to solve our challenges, learning each other’s coding skills and knowledge.

Then we take up different areas and work on it after we went home.

Experience Gain
I can say out loud out with confident that with “Pair Programming”, we can learn any programming language we want. We can even conquer the world!!! (A bit over I guess :D)

The links to the application if your interested.
iProperty SG Window Phone 7 App
iProperty MY Window Phone 7 App

Mono doesn’t support ASP.NET Web Site Projects

When I first heard about Mono and it’s wonderful features that allows to host ASP.NET web sites in Linux environment, I have to admit… I jizzed a little in my pants… :B

Imagine hosting ASP.NET code without the need of Microsoft Licence, makes me love Open Source more. Man… I was excited… until today…

The adventures begins when I start setting up MonoDevelop and source control with Git on my Mac, cloned the repository of code (which was previously written with Visual Studio and running nicely in the production server).

Visual Studio's "Open Web Site"

Couldn’t find “Open Web Site” options that I use to open my ASP.NET Web Site in Visual Studio (refer to image1). Tried opening and created few new projects to run my existing codes, in the process, I have to manually add reference to some of the .NET Framework’s DLL (Example: System.Data.SqlClient).

 

 

After few try and failure, I seek answers from the wise “Google”. After that I was screaming OMFG (in my mind) when i saw the few discussions (the discussion that made me drop down from cloud 9 is listed at the bottom of this post).

It turns out that Mono only supports ASP.NET Web Application Project, and not Web Sites Project.

Is a disappointment at the moment, but I strongly believe that the best of Mono will continue to grow and become awesome one day. Until then, We’ll will have to wait patiently.

I’ll write another post to explain why ASP.NET Web Application Project doesn’t fit in a consumer based web site. Stay tuned. :B

Updates on 29 April 2012:
It seems that I’ve made a mistake on Mono, Mono do support ASP.NET Web Site Projects.
Is MonoDevelop that doesn’t support it, a Mono rookie mistake i made like others.
Tested and verified!!
Found out the answer by a link sent by “The General”, click here to find out more.

Reference:

Generate Nested object with Json.NET’s JsonWriter

Been using Json.NET for the pass few months for projects that is related to JSON, a wonderful features provided is to allow you to Serialize your .Net objects to JSON format automatically.

string json = JsonConvert.SerializeObject(myObject);

For my case, my objects is shared between search results and detail page, search result required around 15 values where as the detail page have 50 values.

Using the JsonConvert.SerializeObject() method will make my search result’s JSON large in size, so i decided to use the manual way of generating the JSON via JsonWriter.

However, took me some time to generate a nested object JSON string.

Code   
  1. using (JsonWriter jsonWriter = new JsonTextWriter(sw))
  2. {
  3.     jsonWriter.WriteStartObject();
  4.     jsonWriter.WritePropertyName("model");
  5.     jsonWriter.WriteValue("Impreza");
  6.  
  7.     jsonWriter.WritePropertyName("brand");
  8.     jsonWriter.WriteValue("Subaru");
  9.  
  10.     jsonWriter.WritePropertyName("Engine");
  11.     jsonWriter.WriteStartObject();
  12.     jsonWriter.WritePropertyName("cc");
  13.     jsonWriter.WriteValue("2500");
  14.     jsonWriter.WritePropertyName("type");
  15.     jsonWriter.WriteValue("boxer");
  16.     jsonWriter.WriteEndObject();
  17.  
  18.     jsonWriter.WriteEndObject();
  19. }
Results   
{
    "model": "Impreza",
    "brand": "Subaru",
    "Engine": {
        "cc": "2500",
        "type": "boxer"
    }
}

Reference:
Serializing/Deserializing Dictionary of objects with JSON.NET