2. Intro
For the next 17mins- ish we want to discuss the mobile market today and how the mobile
user is changing. We will also touch upon the opportunity that Windows 8 & Windows
Phone 8 brings to this key channel and your brands. However our main focus will be to
showcase the upcoming release of the Official application for the British & Irish Lions.
so lets begin…. First up
7. The brief
Create a multi-platform application that works on desktop,
tablet and mobile.
Excite fans with a slick application experience and
exclusive
content centered around this year’s tour.
Integrate with 3rd party APIs to provide real time
information.
15. Lions app core
• Uses the IoC built in to Mvx to implement a SOA
(Service OrientatedArchitecture) approach
• Allows for components to be swapped in / out easily
– Fake data source
– Different caching strategies
– Unit Testing / Mocking
18. Customizing MvvmCross – Overriding Components
• App.cs (our MvxApplication in our PCL)
• This approach gets really messy really quickly…
//Inject our own image caching into Mvx
Cirrious.MvvmCross.Plugins.File.PluginLoader.Instance.EnsureLoaded();
var imageFileCache = new LionsImageCacheService(………);
this.RegisterServiceInstance<IMvxFileDownloadCache>(imageFileCache);
19. Customizing MvvmCross – Overriding Components
• Plugin Manager
public class DroidPluginManager : MvxFileBasedPluginManager
{
public DroidPluginManager()
: base("Droid")
{
}
protected override Cirrious.MvvmCross.Interfaces.Plugins.IMvxPlugin LoadPlugin(Type toLoad)
{
if (toLoad == typeof (Cirrious.MvvmCross.Plugins.DownloadCache.PluginLoader)) {
return new LionsCachePlugin();
}
return base.LoadPlugin(toLoad);
}
public class LionsImagePlugin : IMvxPlugin
{
public void Load()
{
//Do exactly what the Mvx plugin does, except load our custom service instead
}
}
}
20. Customizing MvvmCross – Cross-platform services
• Providing images from the app package – a platform
specific task
• In the core:
var packageProv = this.GetService<IPackagedImageProvider>();
var fileName = packageProv.GetPackagedImageFileName(httpSource);
if (!String.IsNullOrEmpty(fileName))
{
packageProv.CopyPackagedImage(fileName, (succeeded) =>
{
…
});
}
21. Customizing MvvmCross – Cross-platform services
• In Windows 8 Setup:
protected override void InitializeFirstChance()
{
this.RegisterServiceInstance<IPackagedImageProvider>(
new Win8PackagedImageProvider());
base.InitializeFirstChance();
}
22. Customizing MvvmCross – Manual Navigation
• Using some Mvx services to navigate when we’re not
in a view model
var myParams = new { nodeId }.ToSimplePropertyDictionary();
var req = new MvxShowViewModelRequest(
viewModelType, myParams, true, MvxRequestedBy.Bookmark);
this.GetService<IMvxViewDispatcherProvider>().Dispatcher.RequestNavigate(req);