Skip to content

Instantly share code, notes, and snippets.

@detroitpro
Last active August 29, 2015 14:12
Show Gist options
  • Save detroitpro/8bb2b02e597ab985e711 to your computer and use it in GitHub Desktop.
Save detroitpro/8bb2b02e597ab985e711 to your computer and use it in GitHub Desktop.
Xamarin Forms 1.3.1 Navigation.
namespace Mumsee.Mobile.Core.ViewModels
{
public class AppBootstrapper : ReactiveObject //, IScreen
{
// The Router holds the ViewModels for the back stack. Because it's
// in this object, it will be serialized automatically.
//public RoutingState Router { get; protected set; }
public AppBootstrapper ()
{
//Router = Router ?? new RoutingState ();
Locator.CurrentMutable.RegisterConstant (this, typeof(IScreen));
// Set up Akavache
//
// Akavache is a portable data serialization library that we'll use to
// cache data that we've downloaded
BlobCache.ApplicationName = "Mumsee.Mobile";
// Set up Fusillade
//
// Fusillade is a super cool library that will make it so that whenever
// we issue web requests, we'll only issue 4 concurrently, and if we
// end up issuing multiple requests to the same resource, it will
// de-dupe them. We're saying here, that we want our *backing*
// HttpMessageHandler to be ModernHttpClient.
Locator.CurrentMutable.RegisterConstant (new NativeMessageHandler (), typeof(HttpMessageHandler));
// CoolStuff: For routing to work, we need to tell ReactiveUI how to
// create the Views associated with our ViewModels
//Locator.CurrentMutable.Register (() => new LoadingView (), typeof(IViewFor<LoadingViewModel>));
// Kick off to the first page of our app. If we don't navigate to a
// page on startup, Xamarin Forms will get real mad (and even if it
// didn't, our users would!)
//Router.Navigate.Execute (new LoadingViewModel (this));
}
public Application CreateMainPage ()
{
return new MainApp ();
}
}
public class MainApp : Application
{
public MainApp ()
{
MainPage = new NavigationPage (new LoadingView ());
}
}
}
@detroitpro
Copy link
Author

The incompatibly is that in 1.3 all Xamarin forms app derive from Application, ReactiveUI can't just return a navigation page. The RoutedViewHost that is normally returned is a NavigationPage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment