Friday, March 29, 2013

Fixing the Spinner control - Now That's What I Call Bug Hunting - Hugo gagne un insigne d'awesomeness

Hot Tuna is almost Beta....

But officially it's still Alpha

And I'm 'totally stoked' that so many people are already using it :)



One such person is long-time user - Hugo Terelle - and this week he reported that the Android Spinner binding was broken....

... but he didn't just report it....

... he also fixed it...

.... and he also supplied a test repo on GitHub to make it quick and easy to confirm the fix.

Hugo - Thanks - Now That's What I Call Bug Hunting - and deserving of a Badge of Alpha Tuna Awesomeness:



Note: I *think* Hugo's the one on the right in this picture - but I'm sure the one on the left is also writing awesome code already :)

Conventional Views - from the Badge winning Camel - pure genius!

Last weekend, I got a tweet... just a few characters from Johan Otto - also known as: @MorbidCamel 

How about a custom attribute for views like [ViewModel(typeof(MyMvxViewModel))] alternative to naming convention reflection in Setup

This was a Tweet that HotTuna really needed....

This sort of thing has been discussed before... and I knew it was there... but recently I'd been spending so much time just GettingThingsWorking(TM) that I'd missed the obvious...

So I'm delighted to say that now in MvvmCross v3 if you have a ViewModel like:



Then you can simply declare a view for it like any of:



Really this is awesome - totally awesome - I've now switched all my apps to this - it is just so obviously good - it's lovely.

Not only that... but this Tweet served as a reminder for MvvmCross back to one its roots - back to CoC - Convention over Configuration - something that we've been trying to do since v0.

Thank you @MorbidCamel - you helped make the #HotTuna even Hotter.

100% Awesome - this badge is for a Conventional-not-Configured hero called Johan Otto:



Thank you Johan - pure genius!

Fixing Mvvm Commands - Making Hot Tuna better - @XamlDude bags a Tuna flavored Badge of Awesomeness

Last week @xamldude posted an interesting blog post on ICommands might be 'improved' -

http://xamlblog.tumblr.com/post/46187145555/fixing-mvvm-part-1-commands

Not everyone agreed with the post - a few notable names said it was an already solved problem - that, code snippets, for example negated the need for this.

However....

....

... I loved the idea.

So, MvvmCross v3 is going to ship with a new class - MvxCommandCollection

This class allows you to write and expose your ICommands as methods.


After you've done this, then the commands can be accessed in XAML or AXML using markup like:


This approach won't be to everyone's tastes - but I love it - it gives users the choice to just name methods ending with 'Command' and these will automatically translate to ICommand's

Behind the scene's there's also more going on too - e.g.  you can use parameterised commands, and you can use CanExecuteCommandName properties to enable/disable the Commands too. I will try to explain that more fully another day...

For now... @xamldude this was an awesome post - there's only one way to say 'thank you' - with a badge of Hot Tuna MvvmCross awesomeness:


Awesome @xamldude Awesome!

Thursday, March 28, 2013

An MvvmCross technical day in London - Feedback on date needed!

I'm in the final stage of organising this now :)

An MvvmCross technical day in London - a whole day of techie talks, hands-on coding and pure C# and Mvvm :)

If you're interested - and if you'd like to help influence the date (there are only two choices so far), then please give me your opinion today on:


Sunday, March 24, 2013

v3 TipCalc sample on CodeProject

Just following up from the post this week about the first of the v3 documents...

As well as publishing on the GitHub wiki - https://github.com/slodge/MvvmCross/wiki/_pages - the lovely people at CodeProject have also published the TipCalc sample.

It's online now at:

http://www.codeproject.com/Articles/566191/MvvmCross-v3-Writing-a-First-App



I'll keep working on more docs... you... all please keep the feedback coming :)

Friday, March 22, 2013

Binding the ViewPager with MvvmCross - part 2! Awesome with Double Cheese!

Last month we got an awesome submission from Steve Dunford at Sequence - a ViewPager which could be data-bound for use in MvvmCross.Android - http://slodge.blogspot.co.uk/2013/02/binding-to-androids-horizontal-pager.html

This month, the legend that is @CheeseBaron has taken this Gist further, bug fixed it, extended it and published a sample on a proper GitHub repo

Check it out at https://github.com/Cheesebaron/Cheesebaron.MvvmCross.Bindings - with Xamarin 1.0 dlls included.

The Android View and ViewModel code is so simple and clean - it's gorgeous!

Check it out - https://github.com/Cheesebaron/Cheesebaron.MvvmCross.Bindings/blob/master/Sample.Android.UI/Resources/Layout/Page_SimpleViewPagerView.axml

In fact... it's better than gorgeous... it's awesome!

CheeseBaron - thank you, sir - you are awesome twice over!



Thursday, March 21, 2013

Xamarin.iOS with MvvmCross in VS2012 - "The current project does not support references to Portable Library projects."

If you see this message in VS2012 with Xamarin.iOS working with MvvmCross

Unable to add a reference to project 'MyApp.Core'. The current project does not support references to Portable Library projects.

then this may be because you have not yet got PCL support added for MonoTouch (Xamarin.iOS)

To add this, create a new file

MonoTouch,Version=v1.0+.xml

inside:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile\Profile104\SupportedFrameworks

with contents:

Hot Tuna docs... MvvmCross v3 - slowly progressing...

I am slowly kicking through documentation for HotTuna, starting with ... Getting started.

The first few installments are now on:


Coming next will be the WindowsPhone and WinRT UIs - which I probably will cover in less detail.

After this first tutorial is done I'll start on other samples and walk-throughs, moving on from the intro and covering more advanced topics....

You'll notice I'm currently not saying too much about where to get files from or how to setup the IDEs for PCLs... this is partly because this area is changing a lot right now - so I think the docs could be out of date every week if I try to explain too much.

These are taking a lot of time to produce...

  • Are they worth it? 
  • Is there something else you'd prefer to see instead?
  • Or as well?
  • Feedback always welcome!

Wednesday, March 20, 2013

The MvvmCross Manifesto - Draft 1

MvvmCross is opinionated. It cares about how you write your code. Its opinions are:
  • Portability – you should use Portable Class Libraries for as much of your code as you possibly can - viewmodel, model, service and even view. Friends don’t let friends copy and paste. # is for twitter, not for code.
  • Interface Driven Development – you should use Dependency Injection, Inversion of Control and Plugins to get your applications richly and robustly to market on all of your target platforms.
  • Code for Test – you should use interfaces; you should develop small, cohesive, loosely coupled components; and you should add unit tests to allow your code to be used, reshaped and reused again and again.
  • Mvvm – you should use architectural patterns - especially Model-View-ViewModel with Data-Binding - in order to provide a structure within your app, and in order to deliver both a delightful application and a sustainable, flexible ongoing development process.
  • Native UIs – users love Native, and you should give them Native UIs that delight, that provide rich functionality and that are styled to fit naturally in the context of your users’ devices.
  • Your opinions matter – you should be able to override any part of MvvmCross, including it’s opinions.
  • The app is King –  more than anything else, what matters is that you ship. Delivering is everything. The app is King.

Tuesday, March 19, 2013

An Awesome Introduction to Mvvm on Xamarin.Android and Xamarin.iOS - from TechDays BE

A month ago, @gshackles raised the quality bar with his superb Building Android Apps with Mvvm and DataBinding article

Ladies and Gentlemen....

Today the bar has been raised again

A video from TechDays Belgium has been published today - and in it Gitte Titter provides just about the perfect introduction to cross platform Mvvm for existing Windows Mvvm developers.



And all of this in front of a huge and particularly rough looking audience...



For this AWESOME talk, Gitte, thank you....

... and hugely well done on becoming the first lady double-badger!


TeaLight... a T4 generation framework for MvvmCross applications - you know what... it's Awesome!

A trio from Avenade got in touch during February.

@jonkeda,  Matthijs van der Veer, and Jermaine Jong have together been building TeaLight - a huge and hugely impressive code generation framework for Business applications on top of Mvvm.

Featuring multi-platform support, local-remote data-synchronisation, customisable UI generation and automated testing, this framework builds on top of T4 templates and provides app generation direct from business definitions.



They presented this framework to an audience of over 80 at TechDays NL at the start of March, and are currently looking forwards to extending it to support Async, Nuget and more. If anyone else is interested and wants to get involved, then check out their wiki as the project builds and evolves on http://tealight.wikia.com/

For a really cool project, for beating brutal deadlines, and for truely delivering on the developers rule that real developers automate, I'm delighted to send out the first Netherlander Badge Van Awesomeness. Excellent stuff:


ALM2GO - an MvvmCross project management tracker ... and Alexey grabs a Badge of Awesomeness

SeeD-Seifer also known as Alexey has been in touch a few times over the last few months - including helping out with a few bugs and issues, especially around Dialog functionality.

I've now just found out that he and the team at ArtOfBytes have recently shipped ALM2GO - a super clean looking project tracking tool for iPhone.

This tool is built on top of MvvmCross, especially using Dialog functionality and it looks great - you can get it today from: https://itunes.apple.com/app/alm2go/id600778564



For shipping such a great MvvmCross/Dialog app, and for long-term services to Dialog, I'm really, really pleased to award Alexey a Badge Of Awesomeness!

It's great to see slick, delightful, robust business apps shipping on top of MvvmCross - awesome work by all in Hamburg and the Ukraine!


Friday, March 15, 2013

V3 code reaches Alpha...


Hot Tuna!

If you're interested in v3, then the code in GitHub builds and runs on Xamarin 2.0 code:

  • Xamarin.Android, WinRT, WPF and WindowsPhone all build and run on VS2012 on PC (Debug profile tested)
  • Xamarin.iOS builds and runs on the Mac for iPhoneSimulator
Xamarin.iOS doesn't yet build within VS2012 - there are problems with integrating System.Windows.ICommand

If you want to play... then it is Alpha... but it is the future - so please do :)

It's all on the v3 branch:


Hot Tuna!



Wednesday, March 13, 2013

Hot Tuna Training and Hacking - who's interested?

I'm currently trying to set up a day in London early this Summer for some Hot Tuna learning and hacking.

I've not got a solid date for this yet, nor any fixed idea on what the format should be

Also I'm not really too sure how many people might actually want to attend.

To collect some kind of feedback on this... I thought I'd ask a few questions.

If we organised:
  • a *free* weekday one day event in central London 
  • during May 
  • targeted at Mvvm Cross-Platform development 
  • including talks/demos about C# on all of Win8, WP8, Android and iOS
  • including some talks and some hands-on code
then who might be interested?

Tweet me, email me, or comment on here to let me know if you would be interested.

Also... would it make you more or less interested:
  • if we switched it to a weekend day?
  • if we opened it up to non-Mvvm coding?
  • if we opened it up to MonoGame coding?
  • if we made it include more hands-on coding time?
  • if we made it include more formal talks?
  • if we charged a small amount to cover food and drink?
Interested to hear your thoughts.

A Chimp is born.... Mvvm on MonoDroid without MvvmCross

One of the goals of MvvmCross v3, Hot Tuna, is to allow other Mvvm and non-Mvvm libraries to take advantage of MvvmCross Plugins and MvvmCross Data-Binding without the developers having to buy into the entire MvvmCross experience.

For reasons I can't quite remember, this part of the project got the codename Chimp.

---

The good news is that today a Chimp is born!

---

The source of a first demo is in: https://github.com/slodge/CrossLight/

This demo just has:
  • a simple INotifyPropertyChanged ViewModel
  • a simple Activity with an MvxBindingContext added
  • some simple AXML with some Swiss MvxBind statements inside

Importantly, this demo has references to only:
  • the very smallest core parts of MvvmCross - the CoreCross library
  • the MvvmCross.Binding libraries


On top of these references, I've added just a small amount of Setup infrastructure for starting IoC, Trace, etc, and this then allows the binding code to work for our simple View and ViewModel

 ---

To get to this stage has required turning MvvmCross completely upside-down in terms of dependencies... but I'm excited that we've now reached this result.

I'll try to add another demo or two in the next couple of days - but really... this is now an invitation to others - does anyone want to see if the Chimp will walk with their favorite Mvvm platform?

Tuesday, March 12, 2013

Hot Tuna Fragments

v3 of MvvmCross finally brings some Android Fragment action to MvvmCross

The integration is still a work in progress, but you can see some Fragment binding in https://github.com/slodge/FragmentSample/

This sample shows some basic principles:

- A fragment declared in AXML and it's DataContext (ViewModel) set in Code Behind


- Fragment switched in/out of a ViewGroup container programmatically using Code Behind


- Fragments loaded into Tabs


- Fragments used in Dialogs


----

There's still plenty more to learn and explore in these Fragments - the lifecycle of fragments really is a bit odd... so this code isn't really fully production ready yet...

There's also quite a few other things to try - like maps, view pagers and bound fragment collections...

But at least fragments can now be used and can be easily data-bound :)

NotSupportedException during HTTP Post - EndGetRequestStream


If you're making an HTTP Post on WP7/WP8 and you get back an annoying NotSupportedException, then one thing i might be is that you forgot to Flush/Close/Dispose the Request stream.

i.e. make sure that you do the `using` part of:

Monday, March 11, 2013

V3 - a new ViewModel lifecycle

One of the changes coming in MvvmCross v3 - Hot Tuna - is that the default ViewModel location and construction has been overhauled to provide 3 new features:

  • constructor based Dependency Injection
  • navigation using Typed navigation classes
  • saving and reloading VM state for 'tombstoning'

I'm sorry that these changes are breaking changes for existing v1 and vNext apps.

However, I hope we'll all find these changes very useful in the future.


How ViewModels are Created in v3

The default ViewModelLocator in v3 builds new ViewModel instances using a 4-step process - CIRS:
  1. Construction - using IoC for Dependency Injection
  2. Init() - initialisation of navigation parameters
  3. ReloadState() - rehydration after tombstoning
  4. Start() - called when initialisation and rehydration are complete

Construction

As in vNext, you navigate to a ViewModel using arguments like:



In vNext, these navigation parameters were passed to the constructor of the ViewModel.

However, in v3, these navigation parameters are instead passed to the Init() method, and the constructor is now free to be used for Dependency Injection.

This means that, for example, a DetailViewModel constructor might now look like:


This Dependency Injection is, of course, optional - you code can instead continue to use ServiceLocation if you prefer:



Init()

Now that the construction is used for Dependency Injection, the navigation parameters move to a new method - Init()

Init() will always be called after construction and before ReloadState() and Start()

Init() can come in several flavors:.
  • individual simply-Typed parameters
  • a single Typed parameter object with simply-Typed properties
  • as InitFromBundle() with an IMvxBundle parameter - this last flavor is always supported via the IMvxViewModel interface.
You can declare zero or more of each of these types, but generally you will probably only want to use one within your application

So, for example, to support the navigation:


you could implement any of:


or:



or:



Note that multiple calls can be used together if required. This allows for some separation of logic in your code:




ReloadState

If the View/ViewModel is recovering from a Tombstoned state, then ReloadState will be called with the data needed for rehydration.

If there is no saved state then no ReloadState() methods will be called. 

Exactly as with Init(), ReloadState can be called in several different ways.
  • individual simply-Typed parameters
  • a single Typed parameter object with simply-Typed properties
  • as ReloadStateFromBundle() using an IMvxBundle parameter - this last flavor is always supported via the IMvxViewModel interface.
Normally, I'd expect this to be called as:



Aside: where does the SavedState come from?

One of the new ViewModel APIs available in Hot Tuna is a SaveState pattern.

This can be implemented in one of two ways:
- using one or more paremeterless methods that return Typed state objects
- using the override SavedStateToBundle(IMvxBundle bundle)

Using a Typed state object:


Using SavedStateToBundle:




Start()

After all of Construction, Init, and ReloadState is complete, then the Start() method will be called.

This method is simply:





Putting it all together

For a real app, I would expect the navigation, construction and state saving/loading code to actually look like:


and




Oh yuk - I hate it - this CIRS stuff is not for me....

If you don't like this CIRS flow for building your ViewModels, then the good news is that you can easily override the ViewModelLocator within v3, just as you could within vNext :)

You can easily go back to vNext style ViewModel construction - or you can easily invent something new.


Oh yes - I love it - when can I use it?

Soon... very soon ... 

... well, just as soon as I work out some of this MonoTouch->Xamarin.iOS pain :/

Friday, March 01, 2013

Hot Tuna - MvvmCross v3 progress

The work on MvvmCross v3 is picking up pace :)

The current tip of the v3 code is on https://github.com/slodge/MvvmCross/tree/v3 and I'm now beginning to build my first customer project using v3.


MvvmCross - v3 - Hot Tuna


Most of the progress continues to be over weekends - but I'm planning on investing some serious time on v3 during March.

The current v3 status is still very much Alpha - names, namespaces, apis, and functionality may all still change - so I don't recommend using v3 unless (like me) you like pain.

But if you do try to use v3, then I'd love to hear from you ;)

Some more advice for intrepid adventurers who want to fish for some Hot Tuna:
  • As with previous versions, the best documentation today is the samples - but I am looking to change this.
  • There are a large number of changes from master and vNext - especially when it comes to namespaces and class names. I will try to explain this more in blog posts during March.
  • There are some big structural changes in v3 - especially the introduction of CoreCross, and the reversal of dependencies between MvvmCross and the Data-Binding code. I will try to explain this more in blog posts during March.
  • If porting code from vNext to v3, then there are some tedious changes to make. I will try to explain these more in blog posts during March:
    • Views to change from generic to non-generic
    • Namespaces to move
    • Project references to change
    • IoC to switch over to the new syntax
    • Problems with Xamarin2.0 to overcome
    • ... and more besides!

If you would like an insight into v3, then I've prepared this slide deck as an introduction:



I'm still loving MvvmCross and cross-platform C# development - the future is bright, databound, and portable :)

Wednesday, February 27, 2013

More InPurgeable fixes - Steve Dunford is on fire!

The latest fix is for drawables - https://github.com/slodge/MvvmCross/pull/177/files

This fix is not likely to effect you much unless you used BIG images in your drawables.

No badge this time... sorry ;)

But you get to see Greg Broadmore's awesome art again


Tuesday, February 26, 2013

HUGE ANDROID MEMORY BUG - and bug hunting badge of awesomeness #2 to Steve Dunford

I received a really small but important bugfix today, containing:

new BitmapFactory.Options() {InPurgeable = true};

See https://github.com/steveydee82/MvvmCross/commit/460f71ed323b0b64386408341097de3b0c82987d

This bugfix is awesome and really very very important!



Without it, Android's Bitmap engine can fill up your device's RAM and will never give it back.

You can read about the inPurgeable and other options on http://developer.android.com/reference/android/graphics/BitmapFactory.Options.html

For heroic work in hunting down this 'leak' ... and for this awesome bugfix, Steve Dunford, we salute you and reward you with our highest honour - a second Badge of Awesomeness:



Also a special note of thanks also to Greg Broadmore for permission to use his fabulous Bug Hunter picture - http://www.gregbroadmore.com/imgpg.php?page=126

Monday, February 25, 2013

MvvmCross v3 - the documentation plan....

For 'Hot Tuna' I'm planning to make much better documentation....

It's not written yet, but below are the headings for what I'm currently planning.

No idea when I'm going to get it all done - but will try. I may also try crowdsourcing these docs - not sure yet....

Anyone got any opinions on this? Please share them via comments or via the normal channels...


Behaviors for Windows 8 WinRT Store Applications - Nuget goodness and a Belgian Badge of Awesomeness

From StackOverflow yesterday I found an answer from :
If you are looking for behaviors in WinRT with MvvmCross, you can now use the Windows.UI.Interactivity nuget package for it (https://nuget.org/packages/Windows.UI.Interactivity).


When using it with MvvmCross, I made a copy with some small alterations to the existing MvxEventToCommand class (inherit from TriggerAction(FrameworkElement) instead of TriggerAction(DependencyObject)). Works like a charm.

This is excellent news - it's going to save me from so much ugly code behind work :)

Definitely awesome - and it bags GitteTitter a WinRT-flavoured MvvmCross Badge of Awesomeness - thanks!

(Sorry - I couldn't find any slick chips+mayonnaise clipart to make the look more Belgian!)

Thursday, February 21, 2013

MvvmCross Rocks - MVP Edition - Daniel bags badge #2

Right now the annual Microsoft Valued Professional Summit is happening at Microsoft's HQ in Redmond - #mvp13 or #mvpSummit

It's all very hush hush.

DNA has been taken, Irises have been scanned, Lawyers are briefed, Guns are pointed at Puppies - so no-one's saying much about what they see there.

However....

The odd very pleasant rumbling noise is coming out of Redmond



Behind closed doors, our friend @dsplaisted has clearly been spreading the love - and the wisdom - behind MvvmCross. Excellent!

Thanks Daniel - that is awesome!

Also really awesome some of the things Daniel's let slip this week - it turns out that the Microsoft dev teams *love* the MVP summit week - it's something they look forwards to every year. It's really fab to hear that!

All this, plus shipping some fab portable HttpClient code this week.... It's all definitely deserving of a second Badge Of Awesomeness - and this one is a special NDA edition ;)



Wednesday, February 20, 2013

1er Placa de Impresionante - MvvmCross Espanol!

Gracias a Juan M Gómez - http://geeks.ms/blogs/jmgomez

An introduction to MvvmCross in Spanish - how awesome is that!


A pleasure to award the very first....

MvvmCross Placa de Impresionante!


Monday, February 18, 2013

Saturday, February 16, 2013

An MvvmCross powered app for New Zealand coastguard weather and tide reporting

This app is iOS only for now - but built from the ground up using Test Driven Development and designed for portability and future platforms - https://itunes.apple.com/gb/app/coastguard/id584112438?mt=8



A MonoTouch AccordionView

One of my clients at Cirrious is CloudZync - they're an amazing startup with solid investment backing, some exciting lead customers and some really fun and relevant tech to work on.

They're also hiring....


As part of the work we've done for them, we ported an extended an AccordionView to MonoTouch - and they're very happy to contribute this back to the community.

You can play with this on https://github.com/slodge/MonoTouch.AccordionView

Hope you enjoy it.



If you spot any bugs or improvement, please do let us know :)




Somewhat shockingly... currently there are no bindings for MvvmCross - but hopefully one of us will add them soon :)

Friday, February 15, 2013

Android TextView Color Binding

Not sure how I've never included any example of this in the source before - I use this sort of thing all the time!


A PCL Version of TinyIoC - awesome!

I've just received an email about a new TinyIoC fork that's ready for use inside Portable Class Library.

This is completely awesome - especially after some of the recent discussions about v3 and SimpleIoC, OpenNetCFIoC, etc.

The world is going Portable :)

The fork is on https://github.com/mgernand/TinyIoC - it's not quite perfect yet as there are a couple of tests still to go green - but it's almost there :)

Awesome stuff - love it - and it's a pleasure to give @mgernand  a Badge Of Awesomeness for the contribution!


Recap on 'what are AutoViews?'

There are a couple of blog posts on AutoViews available - but not that much info.


To try to help, here's a practical guide to what works today... All of this is based on the sample in http://slodge.blogspot.co.uk/2013/02/recap-on-what-are-autoviews.html



To add AutoViews:

You can use ViewModels in Droid and Touch only, although we do have some work in WP slowly underway.

If you want to use AutoViews, you have to add some more assembly references and a little bit more setup code.

After that, you can then provide AutoView definitions by a few routes...



AutoViews from C# in your ViewModels:
 
In each ViewModel you can add the IMvxAutoListViewModel interface and can then declare whether each ViewModel is a List or a Dialog, and you can also declare a Menu

See two examples of this:

AutoViews from JSON in EmbeddedResource files

In the ViewModel project, you can include AutoView JSON files - in a location found by convention.

See two examples of this in - https://github.com/slodge/MvvmCross/tree/vnext/Sample%20-%20CustomerManagement/CustomerManagement%20-%20AutoViews/CustomerManagement/ViewModels/AutoViews


AutoViews from JSON in Content/Assets in your UI
In you UI projects you can override the JSON files in the ViewModel projects.


For example, see https://github.com/slodge/MvvmCross/blob/vnext/Sample%20-%20CustomerManagement/CustomerManagement%20-%20AutoViews/CustomerManagement.Droid/Assets/DefaultViews/NewCustomerViewModel/Dialog.json


What MvvmCross does with AutoView definitions...
 
At runtime, when the framework navigates to a ViewModel, then the framework:

  • loads a normal View if one exists (a normal view always beats an AutoView)
  • loads a View-project based AutoView if one exists
  • then goes looking for an AutoView in the Core project - looking for either Json or for that IMvxAutoListViewModel inteface.
  • if it finds nothing, then the UI can also use Reflection to guess a Dialog to show... but this is normally really very basic - just shows UITextFields for string properties and UIButtons for ICommands


Why?

My first attempt at this code is mainly for rapid prototyping - for Sketchflow-level coding

But later on...  maybe apps can actually use this for some or all screens...


Next steps?

We will make Dialog's for WP and WinRT one day soon (one day...)

We also want to extend the AutoView idea to Tabbed/Pivot pages - and maybe to Dialog's too.

Beyond that.... who knows? :)



I don't get it - show me some sample code...

Sure - the working sample is in:

Thursday, February 14, 2013

Love Beautiful Animated Interfaces on Android

Needs no introduction....


http://blog.neteril.org/
http://blog.neteril.org/
http://blog.neteril.org/
http://blog.neteril.org/
http://blog.neteril.org/
http://blog.neteril.org/

Binding to Android's Horizontal Pager - Awesome!

Another awesome contribution!

This time from Steve Dunford and the Cross Platform app development team working inside SequenceAgency on some really awesome projects.

They've taken binding code from MvvmCross and inspiration from @CheeseBaron's HorizontalListView and combined them with the Android v3 HorizontalPager in order to provide  a new implementation for fast fluid horizontal paging. Code is provided as MS-PL - so expect to see this integrated back into v3 :)

Thanks for contributing back to the project - totally awesome - a badge of awesomeness well deserved!



The code is here:

Android DatePicker and TimePicker binding - it's Awesome!

Following on from a StackOverflow question a couple of days ago, eMi- has released a new repo - https://github.com/eMi-/mvvmcross_datepicker_timepicker/

This provides the custom Droid View classes and all the instructions you need to use the code.

It's  awesome - and its Creative Commons licensed to it can be included in v3 :)

A pleasure to award Badge of Awesomeness Number #12 to eMi-



P.S. Yes, he really is that young and yes, I really do feel that old now!

"I want my MvvmCross app to start differently on Droid"

 I got asked this by email... please don't ask things by email - please ask by http://stackoverflow.com/questions/tagged/mvvmcross - thanks :)

If you want your app to start differently... then just use a different start interface.

For example, your app could register an interface and startup object like:


Then each platform could just call GetService for this interface and can choose it's own startup path....

Wednesday, February 13, 2013

A second take on Constructor Injection IoC in MvvmCross - and a Badge of Awesomeness

Received this today - fab contribution from @Asudbury

By changing some of the OpenNetCf IoC files (by removing some of the changes I made!), Adrian's managed to get 'proper' IoC working - i.e. he's using code that has constructors like:

        ///

        /// Initializes a new instance of the class.
        ///

        /// The service.
        /// The translator.
        [MvxOpenNetCfInjectionAttribute]
        public LoginModel(
            IAuthenticationService service,
            ITranslator translator)
        {
            this.service = service;
            this.translator = translator;
        }

This isn't the only way to do this sort of thing - I know that someone else has also got TinyIoC working really cleanly - using some techniques built around http://slodge.blogspot.co.uk/2013/01/navigating-between-viewmodels-by-more.html - hopefully will share that with you soon too.

The code changes from Adrian are in the attached gist....
But in the meantime... Adrian - thanks - a badge of awesomeness is your's :)


Tuesday, February 12, 2013

Open Source Contribution Etiquette Part II

As the current maintainer of MvvmCross, in the last 7 days I've had contacts via email, GitHub and forum private messaging and Skype from 8 separate individuals who've been looking to contribute.

This is awesome - really it is totally awesome - they've all been lovely and I love it.

Please don't stop!

And please don't have any doubt that I'm very open to people contributing....

If you have any ideas then get in touch via any of the mechanisms on http://slodge.blogspot.co.uk/p/if-youve-got-questions.html - if your contribution is good, you might even get a badge :)

However...

.... please also consider that I'm human, you're not the only user, I'm doing work for free, I care about my work passionately, and that I'm trying to find time to earn a living, write v3 and have a life too....

------

A few year's back Miguel posted about Open Source Contribution Etiquette

It's a post about trying to make sure that any code you submit as a patch fits well within the project you are contributing to.

-----

As some of you know, I'm not the best at sticking to that rule ... it's not my fault, it's resharper's ... sorry!

-----

However... it's not just about code formatting - there are some other important points that I think it's worth considering when you start contributing to an open source project.

In particular, please do try to have some empathy for the person who is maintaining the project - as Miguel said:
The maintainer is in for the long-haul, and has been working on this code for longer than you have. Chances are, he will keep doing this even after you have long moved into your next project. 

In particular, some of the things I'd ask you to consider are:
  • If the maintainer asks you to contact them via some mechanism then please try to do it - e.g. if they ask you to contact them via GitHub issues instead of Email, then please do not keep sending them emails. And if they then ask a second time, please do not then switch to sending them messages by Skype...
  • Consider that the maintainer owns the project and has final say:
    • They might have plans or dreams which conflict with your immediate requirements - in which case please respect that and find some other way forwards.
    • They should justify their decisions - but they don't deserve to be dragged into drawn out debates on issues - they can ask you to walk away, and you should
    • They can ask you to justify your decisions - and they can drag you into whatever level of justification they choose to - if this is too much, you can, of course, walk away
  • Relationships take time - you can and should always try to be courteous, but respect takes longer to build.
    • The maintainer has probably already earned some respect from you - after all, you want to use and contribute to their work.
    • If this is the first time the maintainer has heard from you, then don't expect respect from them - respect is like that - you have to earn it.
    • Be careful with what you say you are going to deliver - if you criticise a piece of the existing project, say you'll deliver something to fix it, but don't... then don't expect the maintainer to show you much respect when you move on to start criticising something else.
    • Consider that maintainers are often donating large chunks of their time to the project, that they may have other work and/or family matters to attend to; and that they may have recently had to deal with other contributors who did not contribute very well... so those other factors will influence how they deal with your request.
  • Constructive criticism is useful, but constructive action is better - sending criticism of lack of versioning, lack of unit tests, lack of documentation isn't as good as helping make a new build system, a new unit test, or some new documents.
  • The maintainer no doubt has a list of other priorities on his/her list - and those priorities may mean your current contribution is not welcome right now. If that's the case, try to be patient...
  • For whatever reason, if the maintainer says the time's not right for them to accept a contribution, then you should respect that.
  • Solutions to real problems and demonstrable advantages win over possible solutions to possible problems and vague promises of future benefits.
    • If you can show why your changes improve things now, then they can understand why it's worth doing.
    • But if you send them a patch telling them that this will enable something amazing next time, then they have every right to ignore you until next time.
  • Consider that maintainers sometimes want to work on their own project - there are interesting puzzles to solve and things to learn - maintainers love to get inputs but sometimes you also need to give the maintainer space to enjoy their own project too.
  • Regardless of who you are, IMO the best way to push changes into a project is to push small changes - these are easy for both you and the maintainer to qualify, to quality assure and to understand.
  • I understand, though, that sometimes bigger changes are needed, and that sometimes the only way to find out if things will work is to build a prototype - I totally 100% understand that's the way code is sometimes.

    If this is the case and you do need to make bigger changes, consider:
    • If there is any way to make these additions externally to the project - using an add-on pack of some description.
    • If there is some way you can make these change more slowly:
      • Whether you could work on building up a relationship with the maintainer before flooding them with new code
         
      • Whether you could ask about those changes before making them...
      • Whether you could make those changed by forking
  • Coders (Maintainers and contributors):
    • are all mainly lovely - so you can normally talk before making huge changes.
    • are all mainly ass-holes - we are often stubborn ego-driven psychopaths - we all know that no-one else on the planet understands problemX as well as we do. We all have to live with this - Apple, Microsoft, Facebook would never have happened if Steve, Bill and Mark weren't so special ;)
  • Maintainers have the upper hand and the final say
    • they have put in the hard graft and deserve some additional courteousy as a result
    • if a maintainer says 'no' you can query that once... but if you continue to query a point then the chances are you're going to get nowhere except burning up valuable time and getting deeper entrenched into argument... so stop arguing and find another way forwards independently.
  • Contributors aren't slaves - they have other options:
    • if a maintainer says 'no' you can still publish your changes - that's what the OSS licenses allow for.
    • this may not be perfect - it may not be what you want - but it may be what you need - http://www.youtube.com/watch?v=OagFIQMs1tw
  • No decision is final - if you fork today, then there are always ways of merging forks back together again later.
  • Forking isn't necessarily a bad thing - evolution is good. (IMO)
  • If you really need something then you can sometimes offer to pay for the maintainer to assist - but be very careful about how you ask that question!

Note that this isn't a one-way street - maintainers shouldn't be jerks - see http://lostechies.com/derickbailey/2012/12/14/dear-open-source-project-leader-quit-being-a-jerk/ for some very sage advice for maintainers!

----

Note also that you shouldn't listen to me....

I've broken the etiquette rules and been very, very naughty in my open source contributions.

If you don't believe me, take a look at what I did what Resharper did to MonoTouch.Dialog within MvvmCross!

----

Now, back to the code....

F5 ;)

MvvmCross on the Tablet Show

I suspect most of you have already seen this...

If not, then you can get an hour of me talking rubbish and sounding like Donald Trump on http://bit.ly/mvxTabShow


For direct to MP3 try - http://bit.ly/mvxTabMp3

GitHub Badge

How's this look?




Get your's at http://githubbadge.appspot.com

P.S. No idea when I last worked on Python... but GitHub never lies ;)

Sunday, February 10, 2013

MvvmCross v3

What is v3?

v3 will be the most ambitious MvvmCross release to date.

For v3, my mission is to continue…

Native, Cross-Platform, Portable, Reusable C# delight for all.




Is it v3 or VeeThree?

It's pronounced Veeeeeeeeeee-Threeeeeeeeeee





What is MvvmCross?

It’s a cross-platform framework for efficiently and effectively developing delightful C# apps.

So far, MvvmCross has evolved through:

v0
Dec 2011
  • Interface-Driven Development
  • Shared ViewModel-based architectures
  • Available on Windows Phone, MonoTouch and MonoDroid
v1
Mar 2012
  • Data-binding layer added
  • MonoTouch.Dialog support
  • Samples and tutorials
  • Cross-Platform APIs for features like Camera and Location
vNext
Oct 2012
  • Portable Class Libraries
  • Plugins for Cross-Platform APIs
  • WinRT added.
  • MonoDroid.Dialog support.
Iterations
...
  • WPF added
  • Additional Plugins – like Sphero
  • ‘Swiss’ bindings
  • Initial AutoViews added



How has this happened?

Throughout the last 15 months I've been very lucky to have had:
  • wonderful customers;
  • skillful co-coders who continue to teach me so much;
  • a small number of utterly awesome contributors;
  • very thoughtful issues, problems and questions logged, discussed and resolved;
  • superb tools to work with - especially from Microsoft and Xamarin.
  • some donor sponsors - JetBrains (Resharper); PixelCut (PaintCodeApp); Infragistics (NetAdvantage); Microsoft (BizSpark); Nokia (Lumia)

Thanks to all!




What is V3?

All of the feedback I've had from the users of v1 and vNext have helped me shape the requirements and features that will be at the beating beautiful heart of v3.

They are:
  • Add Mono.Mac and Xamarin.Mac platforms
  • Add high quality documentation
  • Enable MvvmCross Plugins to be easily used by non-MvvmCross and non-Mvvm code.
  • Enable other Mvvm platforms to use the MvvmCross data-binding layers
  • Improve all platforms:
    • On Android, we will extend support for Android 3 and 4 features – it’s time for Android to move Android on from Gingerbread!
    • On Touch, we will provide better integration with existing developer workflows including both XIB and Storyboard workflows
    • On Windows Phone and RT, we will look for better designer and Design-Time data support, plus we’ll provide additional Live Tile and background service samples.
    • For Unit-Testing to provide additional helper classes so that tests can be written and maintained more efficiently
  • Make the MvvmCross APIs cleaner, simpler, easier to use and easier to extend
  • Extend Swiss Binding further - remove the dependency on JSON.Net (I'll still *love* JSON.Net, but you'll no longer have to share that love)
  • Consider using WeakReferences in Bindings
  • Tackle some key known open issues –including the infamous Heizenbugs
  • Make the MvvmCross ecosystem simple to navigate – making it easier for users to find 3rd party plugins and extensions.
  • To be NuGet ready – even if NuGet isn’t ready for all the MvvmCross platforms

Beyond these, there’s one big other goal I’d also like to add:
  • Async/await on all platforms
However, currently I’m not sure if this is going to be possible within the near-term timeline of V3 – it depends on external releases and on how things just generally fit together.


Beyond that, there are other things I’d like to achieve – like adding a CrossGraphics plugin, perhaps adding Tombstoning support, perhaps adding a showcase app sample, perhaps providing more Android service examples, etc, etc, etc, etc, etc, etc - but with time short all those can come in iterations beyond v3 if they don't make the cut.





So should I use vNext today?

Yes :)

If you write your existing apps today targeting vNext, then v3 will feel very familiar. It will continue with:
  • interface driven development,
  • portable class libraries for sharing code
  • plugins for the times where platform abstractions are needed
  • using INotifyPropertyChanged-based Mvvm to maximize code share
So, if you start on an app using the stable vNext code base today, then you will be in a great position to leverage v3, with only the need to make small adjustments to shift to v3. To switch you should only need to perform relatively simple tasks like changing some base class names; adjusting some of the namespace names you are using; and perhaps shifting some code between generics and non-generics.





I like the pain of working with Beta code. Can I use v3 today?

Not today... today the code is pre-Alpha and changing very quickly...

... but I will blog details of in-progress v3 changes very soon :)





When will this happen?

I’m working on v3 now.

It’s ‘spare time’ work only for now - and work commitments are doing their best to reduce that time.

However, I expect customers and partners to start being able to use versions of v3 almost from the start – so I expect to be committing the source and blogging about the changes in the coming weeks – and I expect to recommend v3 as the stable platform sometime in the next 3 months.





When is v4 arriving?

I’ve no concrete plans for v4… and no roadmap in my head beyond v3.
Just as with vNext, after the v3 release we can continue to easily add small iterations … so I’m hopeful that v3 will be followed by much smaller releases (commits), each one adding new features without any significant breaking changes.

I’m 100%  sure:
  • MvvmCross will be driven by its use - both in my projects and in your's
  • The future will surprise us all!




Can YOU help?

Yes.
  • as long as you can agree to contribute under MvvmCross’ Ms-PL license.
  • as long as you can put up with @slodge OCD…
There’s lots to do - including thinking, coding, sample authoring, idea and issue logging, testing, documentation writing and beyond.
 Some significant code changes are already underway now. If there’s some way you want to help, please don’t hesitate to get in touch!

However, please remember I am doing this for free, I am trying to do this quickly, and I am learning and solving as I go. Please always think of using StackOverflow, Xamarin forums or GitHub Issues for questions before interrupting me by email, chat or skype; please don't get upset when I don't take on-board one or more of your ideas; please don't get upset when someone else does the work you wanted to do; and please don't be off when we don't implement some inferior way...

Please also remember that the code is Ms-PL - so you can always fork...






Can I donate?

The vast majority of gear and time needed for MvvmCross is funded out of my company's own time/money and out of my own evening, weekends and early mornings. I use MvvmCross in most of my customer projects - so it is partly a commercial investment - but I've been careful to choose an open 'free' license for the code, and I 'freely' try to promptly answer all queries and issues that get logged on StackOverflow and on GitHub. 

The time and money I invest in MvvmCross is all about 1 coder, 5 laptops, 6 phones, 3 tablets, 999 problems, and the thrill of F5 :)

However, a few companies have provided some things for free - thanks:
  • JetBrains (Resharper), 
  • PixelCut (PaintCodeApp) 
  • Infragistics (NetAdvantage); 
  • Microsoft (BizSpark)
  • Nokia (a lovely Lumia!)
Further, almost all of my customers have been very open to me sharing MvvmCross-level code that has been developed within their projects - especially noteworthy are McCann London, without whom this project might never have started.

If you know of a business that is interested in MvvmCross, and they want to contribute to the project in some way, then please do get them to get in touch.

These contributions are all very much appreciated.

Now... back to the code....

Friday, February 08, 2013

CentraStage - a new MvvmCross Monotouch app published on iOS - and since it's awesome...

CentraStage have this week published their iOS app on iTunes:

https://itunes.apple.com/gb/app/centrastage/id588264037?mt=8&ign-mpt=uo%3D2

It's a full IT asset management app for the award-winning CentraStage service - including search, alerts, secure login, alerts and remote console functions (and plenty more that I haven't found yet).

You can use it free for up to 5 devices - so you can give it a go today




The reason I'm listing it here....

It's an MvvmCross MonoTouch app - released only on iOS so far, but with work for Android and for Mac already underway - all from a shared PCL code base :)

Check out the videos of the early prototypes on:




This is all *clearly awesome*...

.... so I have no choice ....

@Deapsquatter on behalf of CentraStage gets a third MvvmCross Badge of Awesomeness!





He's also now blogging some of his experiences - check it out on http://deapsquatter.blogspot.co.uk - also leave him some comments - just to encourage him to keep blogging ;)



MvvmCross tutorial updated - Awesomeness from Wosi!

There's been a fun discussion thread on the Xamarin forums recently - all about how to get started with MvvmCross

From that, the project now has a new fabulous/amazing/stunning/beautiful contribution

Wosi - whoever Wosi is - has updated the Tutorial:


Thanks Wosi - totally awesome - I and everyone who will read the Tutorial thank you with a Badge Of Awesomeness. Thanks!


A patched MonoDevelop for PCLs - AWESOME!


A patched MonoDevelop for Portable Class Libraries is available:
For those doing PCL stuff, I've posted a patched MonoDevelop 3.1.1 build with improved PCL support here: files.xamarin.com/~jeff/MonoDevelop-3.1.1.dmg - it's still not perfect, but it's better than the official builds so far (my patches will be in a future official release) – jstedfast 


I've tested this patch and:
  • It allows you to target .Mac projects with PCLs
  • It allows you to target profiles other than 104


To install it:
  • Download the .dmg to your Mac
  • Mount the drive
  • In Finder, drag the MonoDevelop.app icon to the Applications shortcut
  • When asked, if you want to replace the existing MonoDevelop click 'Yes'


Thanks @jstedfast - this is totally **totally** awesome - it makes me bounce with excitement - makes me want to code all weekend - this badge is most definitely your's:





From http://stackoverflow.com/questions/14764011/monotouch-creating-multiplatform-apps-using-portable-class-libraries/14767926#comment20684486_14767926

Thursday, February 07, 2013

VeeThree

I received an email today asking what was on the vNextDialog branch and whether it was worth looking at....

The answer is that I'm currently playing with VeeThree prototypes on that branch... By all means look - but don't expect it to build!

I will post about what VeeThree is soon... just as soon as I know!

Creating a Custom UIView in MonoTouch and using it in the XCode XIB editor

This was my answer in response to:

  I cannot figure out how to add a custom control to the XIB.

in http://stackoverflow.com/questions/14738964/how-do-you-add-a-custom-uiviewcontroller-to-existing-xib/

----


For a normal UIView, the basic steps you need to go through are:
  1. Create your custom view in C# as a class

    public class MyView
    {
    }
    
    
  2. Add the UIView base class to it, add a Register attribute and add two constructors:

    [Register("MyView")]
    public class MyView : UIView
    {
        public MyView() {}
        public MyView(IntPtr handle) : base(handle) {}
    }
    
    
  3. To make it do something useful, then add a Draw implementation:

    public override Draw(RectangleF rect)
    {
        var context = UIGraphics.CurrentGraphics();
        UIColor.Red.SetFill();
        context.FillEclipseInRect(rect);
    }
    
    
  4. Save and Build your project
  5. Now double click on the XIB for the UIViewController in which you want to use your custom view.
  6. This will open up the XIB editor in xCode
     
  7. In the editor, add a UIView to the design surface
  8. Select that UIView and in the Identity Inspector, set the UIView's "Custom Class" to "MyView"
  9. Save everything in XCode
  10. Return to MonoDevelop, build and run
There's a video of this flow available at: - http://www.youtube.com/watch?v=ggwO46dd-50&feature=youtube_gdata




For a custom UICollectionView, UILabel, UITableViewCell, or any other UIView base class, then you follow similar steps, just with a different base class and with different constructors too in order to support the specific View.

For a video about custom Table cells, see: http://slodge.blogspot.co.uk/2013/01/uitableviewcell-using-xib-editor.html

MonoDevelop Tips


Head to http://mjhutchinson.com/tags/monodevelop_tips