My entry to Xamarin Store Pull Request Contest

If you normally read my blog or follow me on twitter it’s at no surprise that i m current working a lot with Xamarin to build IOS and Android applications using C#. And i have to say it’s fantastic, and i m loving it.. add a little bit of  azure mobile services magic, and you are in the dream land to build mobile apps.

A couple of weeks ago Xamarin launched an application to promote it’s product, in a wonderful idea, they created an app where you could order a T-Shirt, for that you had to clone and run the solution on your favorite ide and do a small task by adding your email and registering an account. It was a great idea, and i was quick to get the app up and running and order my self a t shirt that made me look really sharp! 🙂

Then some days ago they announced they were doing a pull request contest, where the community could submit any improvements, new design, or anything they could think it will benefit the Xamarin Store app . There are some cool prizes like a ticket to the Xamarin Evolve conference.
I was excited, and after a 1h deciding what i could do, i thought that submitting the Windows Version of the app would be great, after all there’s where C# shines specially when used with XAML. Also imo most of the developers coming to Xamarin are people already doing C# , most of then are using Xamarin because they want to reuse the knowledge they already have, by adding windows version you could show how something that is done in some way or form in XAML/C#/MVVM could also be done in the other platforms with xamarin tools, and show how much code they could share and easily cover 90% of the mobile market.
With the last updates to Windows Phone and Visual Studio 2013, we can now build Universal Apps for Windows Phone 8.1 and Windows Store, that it’s in short, you have a new Shared project type that let’s you share a lot of the code between the 2 versions, and this is different from PCL because Microsoft  had some more work into to this project type, and we have more things like sharing resources and xaml controls using the new WInRT convergence, even the navigation stack is the same now.

I must say i have been working with phone and store apps for some time now, but this was my first take at the new Universal Apps. So anything suggestion is always welcome 🙂

Fortunately my good friend at my XAML endeavors MVVMLight Toolkit is already compatible with the new Universal apps , so all my mvvm stack for connecting my view model to my views, dependency injection and messaging were already working  by just installing some nugets. Here is the gotcha  for universal apps, you can’t add refenreces to your shared project, you should add references to your phone and store projects, and then you can use the naspaces in the shared project, (Laurent has a good intro to mvvmlight and universal apps here).

The initial task was to put everything up and running , and since the already Shared project in the solution wasn’t PCL i had some work to make the Shared data access project working  for the windows platform, first i linked the files, then  i commented a couple of lines, used some #if preprocessor directives and after a while it was working and making all the request to the api.


After that i tried to mimic the flow of the code that was used in the other platforms, making some tweaks to target the MVVM pattern and fit with xaml bindings.

Visual Studio design time support
You have to love the design time support when using databinding and constructing your UI

After getting windows phone to work, i  implemented the same flow for the Window Store, and that was pretty straight forward, i also made some “design” (attention i m not a designer, so don’t expect to see a great beautiful mock up, but i did my best)  changes so that the app feels more native (metro) to each platform..
Products Main page WIndows

I must say that i still created pages for each platform, but one could do more code reuse by creating shared pages, and usercontrols, since i had a deadline to finish the project, i was pragmatic and did the quickest way i could, leaving details for the end , like the animations for example.

After finishing the windows draft i went to under task that was taunting me that was the existing shared project , i din’t like to see all that preprocessor directives in there, and lots of code that wasn’t “modern” , (with that i m saying it wasn’t using the new HttpClient stack and more the async pattern). I changed the WebService and SSOCLiente to httpclient,. Also the project made sense in my head to be a PCL, since it was mostly data related stuff (FileCache was the only platform specific stuff in there), so i started porting he project to a new PCL, the funny thing was when i was searching for MD5 implementations for PCL i found out  a branch of XamarinStore that was already a pcl project, that saved me a little of time.

I was midway there, both projects were up and running, and the next task was to finish all the work flow, and brush up some of the design,create the animations and  fix some bugs..

I created some of the default resources for the Phone and Store apps using the existing assets from other platforms and the awesome Paint.NET. Fired up Blend to help me out in the animations, the two that i was focus in getting on this version were the ken burns effect and add to cart one. The second one was entirely build in Blend, the ken burns effected is created fromcode behind since  i used this existing ideia for wpf.

I did everything at night after coming home from work and on a Saturday, it took me more or less 18 hours of coding, what  i find it’s pretty good since i was also learning my way with the new universal apps.

One thing i regret i didn’t had time to do was to combined the DataAcess Layer (existing Shared project) with the new Universal Shared project.It seems that Xamarin Studio already has supports this new project type, so i think we could merge the 2. Also we could inject our viewmodel into our IOS ViewControllers and reuse some of the logic in there too.

So now it’s time to waiting for the contest results and see what the team at Xamarin thinks.
I already won  for my standards since i got new experience using Universal apps, and got more experience with Xamarin platform and GitHub that i  don’t use as often (i more a tfs kind of guy).


One response to “My entry to Xamarin Store Pull Request Contest”

  1. […] jQuery(".menu").addClass('current_page_item'); mobileNav(); }); ← My entry to Xamarin Store Pull Request Contest Introducing Xamarin Forms Labs […]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.