Friday, November 30, 2012

BallControl - an open source Sphero C# controller - WP7, MonoDroid and hopefully MonoTouch (and WinRT?)

Meet my latest open source project - meet BallControl for Sphero:

Here's a first video I made for the project - sorry about the low audio volume!

Xamarin the Native, Sphero the Ball and Lumia the Phone....

After a long week of coding, this experiment in sleep deprivation reaches its inevitable conclusion....

- Xamarin.Mobile Picture capture
- Native voice control
- Native accelerometer control
- Native UI with lots of touch
- Native BlueTooth
- Guest Starring Sphero the ball
- Cross platform Mvvm

Xamarin the Monkey....  because going Native matters

Can I sleep now?

Here's the apps first public outing to a local user group:

Some technical info

The project demonstrates Xamarin.Mobile by using Xamarin.Mobile media picker.... But, beyond that it also extends Xamarin.Mobile tackling some elements of several Xamarin.Mobile requests on uservoice:

The Source

The source is on:

Currently, we have:
  • a working WP8 app
  • a working (but ugly) MonoDroid app
  • a non-working Windows Store app - it seems that Windows Store does not yet support BlueTooth SPP devices - which is so bad :(
I will get a MonoTouch app working soon....

I will also post to the WP8 app store soon.

And I will post some more videos soon....

If anyone is interested in how the app was built I did live blog the first 10 hours of coding... see PDF at (or email me for a Word doc). Sorry I didn't blog the whole lot - but there was a lot of code to write... and I did it in 5 days end-to-end while still holding down the day job too.

That's AmazeBalls! How do I get a Sphero:

If you want a sphero, then try:

If you cannot open your WP7 Project in Visual Studio 2012!

For the last month I've been swearing at the Visual Studio 2102 and WP8 teams...

The reason: because when I open my WindowsPhone 7 solutions, then it shows them as "unavailable" - which makes me very very sad - because I have to use VS2010:

However, last night @dsplaisted asked me if I'd tried right-clicking on them and reloading them.

It worked

I can now open my Windows Phone 7 projects in VS2012 :)

Apparently, the problem was:
  • I first tried to open this solution before the WP8 SDK was installed
  • Visual Studio 2012 didn't know about how to open these - so it marked them 'do not open' in my solution options.
I am sooooooooooooo glad I can open all my projects in VS2012 again!

Wednesday, November 28, 2012

If you cannot see WP8 packages in nuget....

Then you need to install a newer version of nuget -

I just wasted 30 minutes of my life trying to work out where the Phone Toolkit had gone and why I couldn't install it... ah well....


An awesome sample - Wish List from Redth

An awesome sample of using Azure Mobile Services, Azure Web Sites, MvvmCross, ZXing.Net bar code scanning and Xamarin.Mobile too:

Source code is on

There might be some blogging on it at and some tweeting from @Redth
  • if I were being critical:
    • it is currently a bit 'code heavy' in the UI layer, 
    • there are some #if things in the core code
    • the lack of portability support in Azure Mobile Services and in Xamarin.Mobile has forced it away from PCL which is a shame
  • but overall:
    • it's amazeballs - check it out!

Tuesday, November 27, 2012

A simple multitouch view for MonoDroid

I needed a multitouch view for MonoDroid (Mono for Android), so I built one :)

I based it on

It seems to work quite well - to see it in action, just include it in your project and then you can use it in your axml or in your C#

The code:

Monday, November 26, 2012

MvvmCross on the TabletShow :)

Thanks to @MrLacey for this tipoff:

What they said (about 30 minutes in):
It's basically an Mvvm framework using the Xamarin tools. It takes it all the way up to the UI layer, so that the only thing you are building is, for example on the Windows 8 side, just the XAML; on the iOS side just the XML that describes the screens; and the same thing on the Android side.
And you're binding - that's it!
Everything else from that UI definition down is all shared code - so you're basically building almost your entire app with shared code. You're just defining the views each time.
There were plenty of "So Cool", "pretty exciting" and "Awesome" comments thrown in - and some inciteful remarks about:
  • the importance of native UI
  • how MvvmCross provides you a native UI
  • how it allows you to swap out views on each platform
  • how it helps lower the cost of native development
  • and about how MvvmCross is ideal for business apps

Thanks to John Sonmez and the Tablet Show team for the nice comments about the 'huge potential for cross-platform development' :)

Sunday, November 25, 2012

Happy 1st Birthday to MvvmCross - How hard can it be...?

It's official: MvvmCross is 1 year old this week!

The MvvmCross story started early in November 2011 when I started work on the Star Wars Kinect social app.

I had a plan to technically build that app using WindowsPhone, MonoTouch and Mono for Android, and I had a basic WindowsPhone prototype that I'd hacked together using TweetSharp and some code-behind... but, beyond that, I really didn't know what I was building or how I was going to do it.

Luckily, towards the middle of the month, MonoCross 1.0 was released. I downloaded it eagerly, and also struck up some online conversations with some of the MX guys, especially Kenny Goers who patiently and skillfully dealt with all of my queries.

Over the next week or two I talked, walked and typed through lots of code. There were lots of prototypes written, lots of emails and code exchanges back and forth, and lots and lots of time spent swearing at compilers, debuggers and phones.

I *loved* what the MonoCross guys had done in trying to put down a rigid MVC structure for their apps - in trying to provide a formal structure for sharing code cross-platform. However, I also hit a few problems with the MVC pattern itself, with the way MonoCross memory management was architected and with the static nature of the MX code base.

To try to work around these problems somewhere around the 25th November, I checked in my first Cirrious.MonoCrossExtensions commit - and Kenny and I again exchanged some emails - especially about memory management, about IoC and about charging forwards...

It was also at about this point that we had a technical meeting inside the Star Wars Kinect project... and at some point during that meeting one of myself or John McLoughlin (imaji on Twitter) said something like:
We could just go the whole way with Mvvm. How hard can it be?
That question hung there for a while....
How hard can it be....?

And so... on the 28th November I ended up abandoning Cirrious.MonoCrossExtensions and commiting the first files into Cirrious.MvvmCross

This was the first proper MvvmCross commit - 'OMG! What haz I done?' - just 280 changed files and 60,000 additions...

The rest, as they say, is history :)

Happy Birthday Mvx!

Thursday, November 22, 2012

ThanksGiving post - Thanks for more Portable Class Library/Portable Library Project solutions for MonoTouch/MonoDroid

On this day of ThanksGiving in the US....


I'm really grateful for some of the input I've gotten recently from Microsoft and Xamarin.


1. Daniel Plaisted at Microsoft has just heroically supplied a detailed idiot-proof solution to the strong naming issues for ICommand, ObservableCollection, etc.

This solution is:

I think this is what you need to do to get around the type sharing / strong name signing issues for portable libraries on Mono:

-> Extract the public key of System.Windows.dll, and put it in the project directory for the Droid System.Windows project:

 Sn –e "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile\Profile104\System.Windows.dll" system_windows.snk  

-> Modify the Droid project to delay-sign using the extracted key. Put the following in a PropertyGroup in the csproj file:

<SignAssembly>true</SignAssembly>  <AssemblyOriginatorKeyFile>system_windows.snk</AssemblyOriginatorKeyFile>  <DelaySign>true</DelaySign>  

-> Change the assembly version of the Droid System.Windows project (in AssemblyInfo.cs) to:   

In my testing, I didn't seem to need to disable strong name verification. So I don't think it will present any extra barriers for newbies – once you have these changes made they'll just need to get your code and it will build correctly.

However, if you do run into problems, try running the following from an admin VS command prompt:

 sn -Vr *,7cec85d7bea7798e   

Let me know how this works!

I've tested it - it seems to work really, really well :) This solution is now pushed into vNext at

It seems to solve:

2. The Xamarin team for solving all the issues caused by sln file changes in VS11/VS2012 -

These changes may sound trivial, but they've been making code sharing very hard since May this year - and it's great that I can now dropbox/skydrive share my projects and solutions again now between Mac and PC :)

3. Michael, Alan, Jeff (and others) within Xamarin for fixing the problems with building the new Profiles - including 104 -

I hope by naming a few people I haven't upset anyone else who's helped.

I really am grateful to everyone who's helping  :)

Now... I'm going back to write some more PCL code... :)

Tuesday, November 20, 2012

Merging vNextDialog back into vNext

Firstly.... apologies if these changes cause you any problems... but I've tidied up the source tree in vNextDialog and I think these changes will have positive benefits for all users. So I'm merging the changes back into vNext.

The key details of the changes are:
  • Dialogs
    • I've added a version of Android.Dialog/MonoDroid.Dialog to the source - this is in CrossUI.Droid
    • I've added a PCL library - CrossUI.Core - which contains the shared Dialog/Menu/List code
    • I've moved the MT.Dialog code out of MvvmCross Dialog and back into a CrossUI.Dialog class
  • AutoViews
    • I've added projects for AutoViews - these aren't finished yet... but are a very good step in the right direction!
    • I've added an AutoView sample - based on CustomerManagement. This isn't a 'best practice' sample - it's more a 'here's 3 ways of using autoviews' - so may not be easy to follow yet.
    • AutoViews currently only exist for MonoTouch and MonoDroid
  • Build Paths
    • I've changed the build paths so that all the DLLs build into /bin/debug and /bin/release 
    • Importantly this means it should be easier to do a binary release of MvvmCross again soon :)
    • One side effect of these changes is that you probably won't be able to build both of Droid/Touch at the same time - this is because they will fight over the System.Windows and System.Net Assembly names - but otherwise they should still build individually.
  • MonoTouch project configurations
    • The MonoTouch library projects are now switched to simpler Debug/Release only - I'll try to maintain this as we move forwards! 
If these changes break your code.... sorry

The main things that will need changing to get you back building are:
  • If you were using MonoTouch.Dialog, then you will need to add the CrossUI.Core and CrossUI.Dialog projects and you will need to change some Cirrious.MvvmCross.Dialog.Touch.Elements namespaces to CrossUI.Touch.Dialog.Elements
  • If you were relying on the iPhone/iPhoneSimulator project configurations, then you will need to use the Configuration Manager to adjust these back to simpler Debug/Release dependencies.
Sorry again for making these changes so suddenly... but I was informed today that a new user was having problems building the main tree... and I wanted to fix these problems.

This merge back seemed like the best way to fix them and to provide the best possible platform moving forwards.

Monday, November 19, 2012

Cross Platform .Net Podcast from Jesse Liberty, Jon Galloway and Miguel de Icaza

@JesseLiberty, @jongalloway and @migueldeicaza discuss open source and Mono things including a couple of discussions around MvvmCross and MonoCross :)

Worth a listen - there's lots of good technical info; interesting questions like 'what does Miguel do all day?'; some great phrases like 'the delight of using Native APIs'; an intriguing comment right at the end about a major product launch next year - "a universe of goodness"; plus some interesting background on the relationships between Mono, Ximian, Novell, Xamarin, MonkeySpace, Microsoft and ... of course ... Monkeys :)

For the audio:

For a background post:

Thanks for the mentions :) I really want to know what the product next year is now :)

Saturday, November 17, 2012

AlphaLabs Node Garden - adding speech

My first attempt at a play with the AlphaLabs Node Garden.

I thought using the screen was too much like manual labour - so I thought I'd try voice control.

The verdict - wow, is it simple to add voice control to your apps!

wp8: speech is off until your new language pack has been installed

If you see the error 'speech is off until your new language pack has been installed'

Then this might just be because you've switched your phone from one language to another.

To get over this problem...
  • go to Speech in Settings
  • tap on the language box
  • choose your language (even if it's your existing language)
  • you'll then be asked to download it.... (needs WiFi really)
  • after the download, the phone will need  a reboot...

The speech privacy policy was not accepted prior to attempting a speech recognition

If you are trying to use SpeechRecognition and you see this general Exception - "The speech privacy policy was not accepted prior to attempting a speech recognition" - or possibly you see the "The text associated with this error code could not be found."...

Then the answer is

Basically - try pressing and holding the start key - then getting the user to accept the terms and conditions...

Also, in your own app... it seems like maybe you need to be sure you are requsting the speech recognition in an async call on the UI thread?

Some low light pictures taken with a Nokia 920

I took a Nokia 920 out for a run this morning.

It was a real Autumn day... rainy... overcast... gloomy...

Which made it perfect to test out the PureView floating lens in the 920 :)

These photos are just 'snaps' taken on the run... and the deer in Bushy Park weren't being at all friendly... but I'm definite that 'yes, the 920 has a quite nice camera!'

Friday, November 16, 2012

Aviva - Drive.... An MvvmCross Testimonial

Back at the end of the Summer I got this email through from a Solution Designer in Aviva - a very large UK Insurance company:

Thought you'd like to know that we are using MvvmCross in our RateMyDrive app that is currently being Beta tested:
There's been a fair amount of press about it, and it's even been on the telly:  (fast forward to 9:08)
So a big thank you for the major contribution your framework has made to this project. It has allowed us to share the complex algorithms for deriving the driver rating scores between Android, iOS and Console/Test apps. In fact 90% of the code is shared and easily testable.

This project is still ongoing - - and I think the above quotation says everything you need to know about MvvmCross.... :)

If you've been using MvvmCross, and you have any feedback, then please do send it to me :)

Hackery and WitchCraft - First AutoViews running on MonoTouch too

Following on from the MonoDroid work, I've started pushing some MonoTouch changes now for AutoViews too...

And after only a few hours - mostly filled with Reflection swearing - I now have this list view:

and this Dialog view:

These screens generated from the exact same code and JSON as the Droid UIs in Another update on the Default UI work for MvvmCross....

There's still a lot of code to write... and lots of debugging to go...  especially when I move to release builds on real devices....

But so far so good :)

Thursday, November 15, 2012

Free icons for ASP.Net, WinRT and WP development...

These are some of the icon sets I've used in the past - generally Creative Commons - and always used with attribution.

For maps:

For general use: - preview at:

For WinRT/WP7

- plus SyncFusion have a free set which is growing big now -

- plus BootStrap from Twitter has some interesting icons built-in

Wednesday, November 14, 2012

Updated: Flurry Analytics in MonoDroid

This is a follow up to an earlier post on using Flurry Analytics in MonoTouch and MonoDroid:

The community has spoken and one kind individual (I think it's this one) has contributed this gist back to the community with an extended Flurry API covered:

Excellent stuff - thanks "anonymous" :)

Lists in MvvmCross AutoView - first code :)

I've just completed the first stab at a List AutoView :)

This code still needs a little tinkering with - it will change as we go across to the other platforms, but a basic first pass is in this Gist:

Next up MonoTouch, and then WP and WinRT

Then back to Droid for Tab UIs too :)

Question: Should we try to shorten/simplify some of the MvvmCross class names?

I've done a few demos lately where I've had to write code live...

Doing this has made me pause and think when it comes to writing down names like: MvxBindableLinearLayout

These names seem overly verbose... e.g. wouldn't MvxLinearLayout do just as well?

Some of the names are unavoidable - e.g. MvxBindingTouchTableViewController inherits from MvxTouchTableViewController - but even these could be shortened to remove the Touch part of the name (the namespace already gives us that).

And then... of course... another question is whether Mvx should stay in place as a prefix? It is useful in places to know when you are using an MvvmCross class... but it's not very pretty and can make the code less readable.

There's nothing planned on this in the very short term, but what do people think?
  • Should we go on a big clean through the naming?
  • Should we try to shorten some names?
  • Should we try to remove the Mvx prefix?
  • Should we just focus on getting more code and better code (e.g. tests) in place?
Interested to hear any thoughts people have. Please feel free to leave comments here if you have any


P.S. The main class name which made me pause and think on this topic was MvxActionBasedBindableTableViewSource - it's a good descriptive name, but something like MvxFuncTableViewSource might be easier on the eye ?

Sunday, November 11, 2012

More work on AutoViews for MvvmCross

I've been looking some more at the AutoView code.

In addition to hand-crafted Json, I'm looking at the idea of allowing users to provide a simple description within each ViewModel.

I initially started this by looking at using Attributes, but now I'm moving more towards getting the user to provide descriptive methods, like the one below. This code is now working on Droid - but some refactoring is still needed to properly integrate it and to make it really beautiful.

SSL problems with Microsoft Azure Mobile Services on Mono for Android (MonoDroid)

My main test Android device - a SIM-unlocked Galaxy Note upgraded to ICS - doesn't like any 'Microsoft Secure Server Authority' certificates. e.g. it doesn't like or

This is a problem if you try to use Azure Mobile Services - because https connections to a service like will result in an AggregateException within which (several layers deep) will be a MobileServiceInvalidOperationException with a message saying just 'Send Failure' (derived from ServiceFilterResponseStatus SendFailure)

If anyone else encounters this issue... then below is some hacky code I transplanted from an old demo project. It seems to work.... but could probably be improved to work with just Microsoft Secure Server Authority messages.

This code hacks the ServicePointManager to allow it to accept all HTTPS/SSL addresses regardless of whether or not the certificate is trusted. Don't use this in your banking apps please :)

Saturday, November 10, 2012

Resources from Azure Mobile Services talk - MonoTouch and MonoDroid

I'm just pushing some resources for the Mvvm Azure Mobile Services sample shown at #SixStepsAzure yesterday to:

I'm afraid there's not too much info on this demo available yet and I've only included MonoTouch and MonoDroid code - there is a little in the but generally I'll need to get together with @AzureCoder to sort out more - I don't know how he did the server side wizardry :)

Azure to Wp/MonoDroid/MonoTouch - Video of my MvvmCross Talk

Here's a talk I gave yesterday at #SixStepsAzure here in London:

Slidedeck is:

And this is what one of the audience said:

Love the honesty of that feedback :)

Friday, November 09, 2012

The request could not be completed (Send failure)

Update: see

I've been playing with Azure Mobile Services on Mono for Android (and on MonoTouch too).

One thing that stumped me for a little while was a problem where I just couldn't talk to the server - all calls would fail with:

The request could not be completed (Send failure)

Eventually I worked out that:
  1. Make sure you've got INTERNET permissions in your app Manifest
  2. Make sure you are using http and not https for the service address

I'm not sure why https is not currently working - must be some SSL/certificate-level error?

Tuesday, November 06, 2012

Another update on the Default UI work for MvvmCross....

We've made more steady progress on the Default UI work.

We've now got the MvvmCross CustomerManagement demo (borrowed originally from MonoCross) completely rendering from JSON.

So, that's:
  • the front page screen (a List)
  • the details screen (a Dialog)
  • the edit and new screens (a Dialog)
  • a menu on each screen.

To do this, currently we're using JSON files loaded using convention rules from the Assets folder:

However, we want to move this to a set of conventions and/or attributes based on the ViewModels themselves. This is coming...

And then we'll look at porting this back to MonoTouch and MonoTouch.Dialog too...

And then also coming, is WP.Dialog - see @runegri's fork of MonoDroid Dialog at

There's a lot of code to tidy up - but will post more details and some demo code soon!

How to make a PIG UDF (beginners guide for C# engineers)

I got asked to create a UDF in Java... this is what I did :)

Any questions? Try

For the Apache PIG UDF documents try Try

Monday, November 05, 2012

Thank you JetBrains for free Resharper open source licensing

Just a quick word of thanks.

JetBrains provide Reshaper for free for me to use on MvvmCross:

Thank you, JetBrains!

If you are a C# dev and you haven't tried a tool like Resharper then you are wasting your own time - simple as that. In addition to the free 7.0 license above, I've also paid my own money (wow) for a license - and it paid for itself within a day.

MvvmCross at BUILD 2012 - Create Cross Platform App using Portable Class Libraries

Daniel Plaisted's talk introduced and extended the MvvmCross Twitter sample at BUILD

For his full talk, see:

For more info, see

Daniel's blog is on:

Sunday, November 04, 2012

Combining TinyMessenger with MvvmCross to provide "StartViewModelForResult" type behavior


A sample from @gshackles

Basically this pattern allows you to write a flow like:

- navigate from a parent viewModel to a child ViewModel
- the child viewModel collects some user input
- the user then presses OK
- a message is sent back from the child ViewModel  to the parent
- the child view then closes

We think there might be one very minor issues in this pattern - to do with some tombstoning edge cases - but for most apps this should work really well - and it has a nice test harness too!

Some Useful MvvmCross Links...

Key posts from and key questions and answers

Portable Class Libraries

Portable Class Library problems - "defined in an assembly that is not referenced"
Working around the profile1-only problem in Mono builds -
More on PCL setup for MonoTouch/MonoDroid -
Xamarin reported bugs that @slodge is involved with - mostly PCL -


Experiences and Limitations -
Getting Help -
Setting up a fork - basic GitHub steps -

Navigation and Architecture

Passing in variables to ViewModels -
MethodAccessException -
Providing different views for iPhone and iPad -
Replacing the default ViewModelLocator -
Passing in Services as constructor parameters -
Problems in release mode only -
Hunting for memory leaks -
One pattern for error reporting - and also at
Changes to IoC in vNext -


Testing ViewModels -


JSON Binding introduction -
Custom Favorites Button Binding - Custom binding for text color -
Binding MonoTouch UIViewController member variables -
Two way bindings for integers -
Binding doesn't work on a real device -
Custom binding for a Touch event -
ListItem Property Binding -
Displaying images - and
What do I do without CommandParameters?
Why doesn't Touch work -
Working around ICommand CanExecute problems -
Debugging binding problems -


Using Tabs/TabActivity -
AutoComplete -
Removing the splash screen -
Handling Back -
I want a simple View without a ViewModel -
Fragment support - current not done -
Using custom Intents -
Why won't my project include the MvxBindingAttributes.xml file -
Using ICommands within ListItems -
Receiving broadcast actions -
Displaying Selection -
Using custom controls in XML -
Responding to checkbox changes -
Integrating a custom Activity -


Modal presentation (and custom presenters) -
Using Tabs/UITabBarController -
Customising the Navigation Bar (UINavigationController) -
Modal Views - with a UINavigationController -
Displaying multiple modal views -
Using a DateTimeElement in MT.Dialog -
How to do a "combobox"/Uipickerview in Touch (also see
Problems with MT.D Element redrawing -


Intercepting Back key presses -
Using live tiles -


Getting Location -
Distance between 2 points -
Why no speed and bearing :( -
Integrating VideoView from Xamarin.Mobile -


How to write a Conventional plugin -
How to inject platform specific services -
Another introduction to Conventional plugins -

"Simple Projects"

Multiple View/ViewModel sample -