Saturday, October 26, 2013

An awesome alternative i18n implementation - opcode bags badge #2

Earlier this year, Stefan posted an article about how to integrate resx files with the MvvmCross localisation framework - http://opendix.blogspot.ch/2013/05/using-resx-files-for-localization-in.html


Recently Andrei - opcode - has taken the same resx files and pushed them in a different direction.


He looked at the existing Json code and he didn't like it... As he said, "I went through the N+1 video and tried to understand localization using the Json localization plugin but it almost made me cry"... so instead of crying he went off and created an alternative implementation - using resx files directly from ViewModels to allow i18n text bindings like:



"Text [UsernameText]"
android:layout_width="wrap_content" android:layout_height="wrap_content" />


This alternative option is awesome. It fits exactly with one of the fundamental principles of MvvmCross - that people should write the code they want to write - the app is the king!


If you want to learn more about this approach then the blog post and code is at: http://enginecore.blogspot.co.uk/2013/09/localization-in-xamarin-mvvmcross_18.html


Awesome!



Friday, October 25, 2013

An Awesome Detroit Mobile MvvmCross presentation from Rob Gibbens

Rob Gibbens recently gave a full MvvmCross introduction to the @DetMobileNet group.


I don't know much about this... but from the feedback it sure looks awesome!





Well deserving of a shiny badge of awesomeness - great work Rob!



MvvmCross.Mac awesomeness from Tim and Kevin

One of the goals for MvvmCross v3 was support for MonoMac and Xamarin.Mac


Kevin - @deapsquatter - at CentraStage has been pushing this work forwards for over 6 months now and has blogged about specific parts like Mac NSTableView support


More recently, Tim - @tofutim - at loqu8 has been pushing forwards with PCL code from the tip of v3.


Together, they've got our .mac support into a good state - as you can see:





This is .... of course.... awesome - doubly so! And I'm delighted to give Tim a first badge of awesomeness and Kevin his 4th


 

Thursday, October 24, 2013

More more more more awesome plugins from the big Cheese - badge #5

Regular MvvmCross users will already know Cheesebaron - he's already got **4** badges of awesomeness...


And today he gets number **5**!


The reason - he's posted lots of new plugins to his github repo - https://github.com/cheesebaron/Cheesebaron.MvxPlugins/


Beyond the Azure Access Control plugin I blogged about last month, these include:


  • an SMS plugin
  • a Settings plugin (with a notable assist for James M)
  • a basic phone info plugin
  • a Connectivity plugin



Beyond these, Cheesebaron's also really proactive and helpful on the MvvmCross Github issues, on Stackoverflow and on the Xamarin forums - applying skill and expertise to help lots of devs every day. So as well as badge #5 I'm delighted to say that Cheesebaron's now also a full admin on the MvvmCross repos.


Awesome NYC Code Camp samples from Greg Shackles - badge #2 !

In September Greg Shackles gave an awesome talk about multi-platform C# development at the New York Code Camp





The code for this talk is particularly awesome - it uses file linking rather than PCLs and it fully takes advantage of Task and of lots of the awesome async features in C#5 and Xamarin 2.0 - take a look at it on https://github.com/gshackles/NycCodeCamp8



It's a huge pleasure to announce badge #2 for Greg - thanks Greg - awesome code and awesome presenting!





A UserInteraction plugin - from Brian Chance - awesome again!

One of the common questions when writing Mvvm ViewModel code is "How do I show a MessageBox?"


There are a few answers around to this on StackOverflow - e.g. using an interaction helper or using a dialog service


However, for simple message boxes or for a simple message prompt, BrianChance has provided this open source plugin - https://github.com/brianchance/MvvmCross-UserInteraction


So now showing a message is as easy as:




This is awesome - and it happily earns Brian badge #2 - thanks Brian!



Using the Infragistics Nuclios Grid control with MvvmCross binding - awesome from Blake Davidson

Recently, Blake Davidson - @davidsonblake86 - has posted this blog post -
http://davidsonblake.wordpress.com/2013/10/15/single-row-gridview-using-mvvmcross-infragistics-nuclios-and-xamarin-ios/ - showing how monkeys can easily be databound into an Infragistics grid from an MvvmCross ViewModel.





Infragistics have been long-term supporters of MvvmCross and it's really awesome to see their controls databound this way!


Blake - thank you hugely for his awesomeness - an awesome badge of thanks!



Developers Developers Developers - awesome up North from Ross Dargan

Ross Dargan gave this presentation at DDD North recently:



It covers lots of MvvmCross topics - including file sharing, PCLs, IoC and Mvvm - and it comes with lots of awesome samples in https://github.com/rossdargan/Talks


Awesome stuff - and well deserving of a badge of awesomeness - thanks, Ross!



Awesome profiling and optimising from Miha Markic

Earlier this month we shipped 3.0.13 - this included lots of improvements - including a couple of speed optimisations for Android binding.


These came from some work Miha Markic has done in profiling Xamarin.Android using high frequency counters - see his excellent blog post on the topic about it on http://blog.rthand.com/post/2013/09/12/Poor-mans-performance-profiling.aspx


This is awesome work - really helping MvvmCross to keep improving - and hugely deserving of a first badge of awesomeness - thanks Mika!




Hawkes Bay awesomeness from Sean Cross

Sean Cross recently gave this Hot Tuna talk in Hawkes Bay, NZ:





It's awesome! And well deserving of a badge of awesomeness - top talking Sean!





More Montemagno awesomeness - sliding Nav Drawers

Following on from last month's badge for MvxUIRefreshControl, this month we've seen 2 superb new samples from James Montemagno:




The samples for these are fab - especially the monkey based sample for Android 'hamburger' menus:



You can take a look at the source on - https://github.com/jamesmontemagno/Xam.NavDrawer


These monkeys are awesome :) And they are very well deserving of James' second badge of awesomeness - thanks James!


Wednesday, October 09, 2013

3.0.13 - pushed to nuget

I've now pushed 3.0.13 to nuget :)


Thanks to everyone who's contributed code, ideas and assistance - I'm well behind on badges now - so many of you are awesome! I will catch up on badges soon!



Note that there are some potentially breaking changes in 3.0.13 - marked in bold in the change list below.

The most obvious of these will be in:
Other more subtle breaking changes may come out of some of the binding optimizations - if any bugs appear, please do report them (with reproduction examples if possible).


-----


The main changes from 3.0.12 are:


  • added UnsetValue and DoNothing binding constants to allow richer ValueConverter implementation (note that these constants are not fully supported across all Windows platforms)
  • changed binding implementation so that many more binders will now block feedback loops
  • changed binding implementation so that many more binders will now attempt value coercion when setting values on a target
  • optimised text binding in Droid and Touch - 'label' controls will be set directly using non-reflection and using one-way binding as default
  • optimisations for one-way binding - event subscription is not removed
  • added an IMvxInteraction helper interface to assist with 'dialog' user interactions
  • cleared up 'mixed spellings' of Initialisation/Initialization - the US spelling 'Initialization' is now used everywhere (this may break some overrides in people's Setup code)
  • event `Raise` extension methods now moved into shared code - into CrossCore
  • fragment inflation no longer causes an error message in trace
  • fixed two missing event hook calls in Android dialog code
  • Binding DataContext's now have a DataContextChanged event
  • By default, views can now be named with postfix 'View' or 'ViewController' on iOS, 'View' or 'Activity' on Android, 'View' or 'Page' on WindowsPhone/Store, 'View' or 'Control' on WPF
  • Small optimisation in internationalisation converter
  • Improved access to MasterNavigationController in Touch presenters - as requested via @deapsquatter's blog
  • Improved override capabilities for AndroidLifetime monitoring object
  • Improved error message for users using viewmodels from mutliple assemblies
  • Weak referencing is now used in Rio field binding
  • Added a new location interface into the location plugin - the old one still works but is now marked obsolete
  • Added a simple Reachability implementation for Android in the Network plugin
  • Fixed a "To" regression in the Android email plugin
  • Added simple UIView/View/Control boolean "Hidden" bindings for all platforms
  • FluentBindings can now use `FullyDescribed` and `SourceDescribed` methods to describe contents - e.g. Bind(textField).FullyDescribed("Text MyConverter(Property1)") and Bind(textField).For(t => t.Text).SourceDescribed("MyConverter(Property1)") - the previous Described method (which is SourceDescribed) is now marked as Obsolete
  • Integrated lots of Android Dialog changes from @csteeg - many improvements in usability and stability (if you have overridden GetViewImpl the signature has now changed)
  • Included improved Bitmap resource drawable binding from @Cheesebaron and @scatria
  • Fixed misaligned ViewDidAppear/Disappear calls in event source UIViewController
  • Added MvxRadioGroup from @BenGladman for Android (it's fab!)
  • Added SimplePickerElement from @BenPage for Android Dialog
  • Fixed ambiguous construction issue with MvxColor - and unit tests for the default RGB color value converters
  • Added named MvxColors class based on Mono standard name set
  • Merged Mac binding and Mvvm code from @loqu8 and @deapsquatter - Mac has separate solution currently (more on this soon hopefully)
  • Improved TeamCity buildability via @loqu8 
  • INotifyCollectionChanged event is LinkerPleaseInclude included within MvvmCross core library
  • Android Download image loader can use "res:" prefix for images
  • Android MvxImageView exposes DefaultImagePath and ErrorImagePath properties (matches iOS API now)
  • Android MvxImageView no longer has a IntPtr constructor
  • ToString error messages improved for binding debugging
  • Android MvxSpinner now uses radio elements by default 
  • Android MvxBaseListItem now supports ICheckable
  • Github projects have moved into /MvvmCross organisation

ios7 ... I seem to be using this code a lot

Most of my UIView layout changes for ios7 seem to come down to just adding:


Changes to custom bindings in v3.0.13

3.0.13 does include some breaking changes as we've changed some underlying APIs for custom bindings.


Sorry for this - these type of API changes are something we try to avoid - but in this case there were some good reasons.


We've changed the API for two key reasons:

  1. Improved Performance - we've found that by splitting the target binding event subscription out into a separate public API then we can achieve better binding performance for OneWay bindings
  2. Improved Functionality - we've identified that more bindings can benefit from auto-type coercion and from auto-change-loop removal by moving the SetValue helpers from the PropertyInfo-based bindings to a lower level.

With those justifications out of the way, the key changes you should make to any custom binding in v3.0.13 or later are:


Move event subscriptions into SubscribeToEvents

This isn't essential - but is good practice. If the user specifies OneWay binding, then this change will provide them with a small performance improvement with each binding.

Code before change:


Code after change:


Move value setting code from SetValue into SetValueImpl

This change is essential.With this change, then the MvvmCross base classes will provide additional type coercion for you (e.g. MvvmCross will automatically convert strings to ints)

Without it, you will get a compiler error saying: "Error 3 'YourTargetBinding' does not implement inherited abstract member 'MvxConvertingTargetBinding.SetValueImpl(object, object)'

Code before change:


Code after change:



Sorry again for any inconvenience caused by this change - we've tried very hard not to make breaking changes to APIs since we signed the v3 APIs off on March 1st this year - but in this case the benefits were worth it!

Tuesday, October 08, 2013

3.0.13 - release candidate built - just a bit more testing to complete....

Binaries for 3.0.13 release candidate have now been built- they are in https://github.com/MvvmCross/MvvmCross-Binaries/releases/tag/3.0.13


I've also merged and tagged the source in v3 - https://github.com/MvvmCross/MvvmCross/releases/tag/3.0.13


I've got a few more tests to complete tomorrow morning - it's looking good so far :) - I hope to push 3.0.13 packages to nuget midday tomorrow UK time :)


Thanks for your patience. I'll update with more full release notes when it ships :)

Sunday, October 06, 2013

3.0.13-beta4 testing update

I'm still running through 3.0.13-beta4 and testing it against all the projects in https://github.com/MvvmCross/MvvmCross-Tutorials/ plus against some of the N+1 (some of the key items not covered in those tutorials)

So far the build seems very solid.

I've found one blocking issue:

- some Android.Dialog issues with tapping on specific cells (e.g. datetime) - currently this is under investigation at the tail end of https://github.com/MvvmCross/MvvmCross/pull/363

Apart from that, it's not taken me very long at all to update the projects. The main issue I've encountered is changes in PCL setup each time (e.g. changing to use Xamarin's System.Windows assembly for each Touch project) and I've really only found a few minor issues with:


- one new exception thrown (and handled lower down) during double-string conversion - now masked in https://github.com/MvvmCross/MvvmCross/commit/219b9f37ea0db61a8e53954b6dabb50fd8410bca
- one missing setup call in Console projects (added in https://github.com/MvvmCross/MvvmCross/commit/a0e43434b5e25c017ffdad50a5978bde897d0b18)
- a misleading color debug output in https://github.com/MvvmCross/MvvmCross/commit/49cf0e91084a7de391e5fe35331ad6d637d85c84


So... I'm hopeful we'll be able to ship 3.0.13 to stable very soon :)

Saturday, October 05, 2013

"Every time I update using nuget I get FirstView added again :("

If this is happening to you... then the easiest thing to do is to remove the "MvvmCross" and "MvvmCross HotTuna StarterPack" packages from your project - instead rely just on the 'assembly only' packages like "MvvmCrossLibraries" and "CrossCore"


To do this, just edit the packages.config files in your projects.


This gist shows you what I do - what the config file looks like before and after:


Build 3.0.13-beta4 shipped to MvvmCross-Binaries and nuget

I've tagged, built and shipped 3.0.13-beta4

I will be testing it more tomorrow...

If all goes well I plan to ship this as "stable" soon.

Thanks to everyone who's contributed code, ideas and assistance - I'm well behind on badges now - so many of you are awesome! I will catch up on badges soon!

Note that there are some potentially breaking changes in 3.0.13 - marked in bold below. The most obvious of these will be in the changes across MvvmCross to consistently use the US spelling "Initialize" rather than UK spelling "Initialise". Other more subtle breaking changes may come out of some of the binding optimizations - if any bugs appear, please do report them (with reproduction examples if possible).

The main changes from 3.0.12 are:

  • added UnsetValue and DoNothing binding constants to allow richer ValueConverter implementation (note that these constants are not fully supported across all Windows platforms)
  • changed binding implementation so that many more binders will now block feedback loops
  • changed binding implementation so that many more binders will now attempt value coercion when setting values on a target
  • optimised text binding in Droid and Touch - 'label' controls will be set directly using non-reflection and using one-way binding as default
  • optimisations for one-way binding - event subscription is not removed
  • added an IMvxInteraction helper interface to assist with 'dialog' user interactions
  • cleared up 'mixed spellings' of Initialisation/Initialization - the US spelling 'Initialization' is now used everywhere (this may break some overrides in people's Setup code)
  • event `Raise` extension methods now moved into shared code - into CrossCore
  • fragment inflation no longer causes an error message in trace
  • fixed two missing event hook calls in Android dialog code
  • Binding DataContext's now have a DataContextChanged event
  • By default, views can now be named with postfix 'View' or 'ViewController' on iOS, 'View' or 'Activity' on Android, 'View' or 'Page' on WindowsPhone/Store, 'View' or 'Control' on WPF
  • Small optimisation in internationalisation converter
  • Improved access to MasterNavigationController in Touch presenters - as requested via @deapsquatter's blog
  • Improved override capabilities for AndroidLifetime monitoring object
  • Improved error message for users using viewmodels from mutliple assemblies
  • Weak referencing is now used in Rio field binding
  • Added a new location interface into the location plugin - the old one still works but is now marked obsolete
  • Added a simple Reachability implementation for Android in the Network plugin
  • Fixed a "To" regression in the Android email plugin
  • Added simple UIView/View/Control boolean "Hidden" bindings for all platforms
  • FluentBindings can now use `FullyDescribed` and `SourceDescribed` methods to describe contents - e.g. Bind(textField).FullyDescribed("Text MyConverter(Property1)") and Bind(textField).For(t => t.Text).SourceDescribed("MyConverter(Property1)") - the previous Described method (which is SourceDescribed) is now marked as Obsolete
  • Integrated lots of Android Dialog changes from @csteeg - many improvements in usability and stability (if you have overridden GetViewImpl the signature has now changed)
  • Included improved Bitmap resource drawable binding from @Cheesebaron and @scatria
  • Fixed misaligned ViewDidAppear/Disappear calls in event source UIViewController
  • Added MvxRadioGroup from @BenGladman for Android (it's fab!)
  • Added SimplePickerElement from @BenPage for Android Dialog
  • Fixed ambiguous construction issue with MvxColor - and unit tests for the default RGB color value converters
  • Added named MvxColors class based on Mono standard name set
  • Merged Mac binding and Mvvm code from @loqu8 - Mac has separate solution currently (more on this soon hopefully)
  • Improved TeamCity buildability via @loqu8

Thursday, October 03, 2013

N=41 - More Android maps - more advanced - N+1

Today we carry on to a finalé in our trip through data-bound maps on Android.

 
This maps tutorial follows on from:


For demos in the video, I use a real device - sorry for the bad camera work!


I also mess up a few times - sorry :)


I also try some really advanced stuff with making a bindable fragment - for which I make no apologies :)


For really working out how to use Google Maps - see https://developers.google.com/maps/documentation/android/views - it's actually very good documentation!




The source code for today is on: https://github.com/MvvmCross/NPlus1DaysOfMvvmCross/tree/master/N-41-Maps



The video:




For a full and wonderful N+1 index, see: http://mvvmcross.wordpress.com/

GitHub repos have moved across to https://github.com/MvvmCross

I've finally moved all the MvvmCross repos out of my personal account and across into https://github.com/MvvmCross


Hopefully most of the existing hyperlinks and git references should get redirected by the magic of GitHub.


Moving forwards, I do hope and plan that this should allow more people to use MvvmCross and to contribute to MvvmCross more easily. I'm slowly moving things forwards - I'm still very much learning how to do this stuff :)

Wednesday, October 02, 2013

N=40 First Part of Maps on Android - N+1

Today we move on to maps on Android.

 
This maps tutorial follows on from:


To get maps working we use the Google Play Services component - see https://components.xamarin.com/gettingstarted/googleplayservices for how get started on this.



For demos in the video, I use a real device - sorry for the bad camera work!



If you want to try to get maps working on an emulator, then I recommend you take a look at http://www.genymotion.com/ - although I don't think this plays nicely with the WP8 emulator or with the Intel HAXM driver either :(



The source code for today is on: https://github.com/slodge/NPlus1DaysOfMvvmCross/tree/master/N-40-Maps



The video:







Sorry again about the demos by hand rather than in a simulator - and for the pauses while I gather my thoughts each time :)


For a full and wonderful N+1 index, see: http://mvvmcross.wordpress.com/

Tuesday, October 01, 2013

3.0.13-beta2 packages pushed to nuget

I've pushed some 'pre-release' packages to nuget with the latest code from the BindingChanges branch.


This code is definitely pre-release at present - there are a few days of testing ahead of me updating and testing all the samples.


This code also includes a few potential breaking changes - so it is possible that it may eventually be released as 3.1 rather than 3.0. This decision and timeline also depends on Xamarin's release schedule for PCL support - which is outside of Mvx's control. There is still a chance that this support may require us to switch to a different profile - still waiting to find out any information at all on this.



The main changes from 3.0.12 are:

  • added UnsetValue and DoNothing binding constants to allow richer ValueConverter implementation (note that these constants are not fully supported across all Windows platforms)
  • changed binding implementation so that many more binders will now block feedback loops
  • changed binding implementation so that many more binders will now attempt value coercion when setting values on a target
  • optimised text binding in Droid and Touch - 'label' controls will be set directly using non-reflection and using one-way binding as default
  • optimisations for one-way binding - event subscription is not removed
  • added an IMvxInteraction helper interface to assist with 'dialog' user interactions
  • cleared up 'mixed spellings' of Initialisation/Initialization - the US spelling 'Initialization' is now used everywhere (this may break some overrides in people's Setup code)
  • event `Raise` extension methods now moved into shared code - into CrossCore
  • fragment inflation no longer causes an error message in trace
  • fixed two missing event hook calls in Android dialog code
  • Binding DataContext's now have a DataContextChanged event
  • By default, views can now be named with postfix 'View' or 'ViewController' on iOS, 'View' or 'Activity' on Android, 'View' or 'Page' on WindowsPhone/Store, 'View' or 'Control' on WPF
  • Small optimisation in internationalisation converter
  • Improved access to MasterNavigationController in Touch presenters - as requested via @deapsquatter's blog
  • Improved override capabilities for AndroidLifetime monitoring object
  • Improved error message for users using viewmodels from mutliple assemblies
  • Weak referencing is now used in Rio field binding


Several of these  are potential breaking changes - so please be careful to test your apps if you do choose to update.


This code is definitely pre-release at present - there are a few days of testing ahead of me updating and testing all the samples....