// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { // NB: GrossHackAlertTiem™: // // Monotouch appears to not load assemblies when you request them // via Type.GetType, unlike every other platform (even // Xamarin.Android). So, we've got to manually do what RxUI and // Akavache would normally do for us var r = new ModernDependencyResolver(); (new ReactiveUI.Registrations()).Register((f,t) => r.Register(f, t)); (new ReactiveUI.Cocoa.Registrations()).Register((f,t) => r.Register(f, t)); (new ReactiveUI.Mobile.Registrations()).Register((f,t) => r.Register(f, t)); (new Akavache.Registrations()).Register(r.Register); (new Akavache.Mobile.Registrations()).Register(r.Register); (new Akavache.Sqlite3.Registrations()).Register(r.Register); RxApp.DependencyResolver = r; window = new UIWindow(UIScreen.MainScreen.Bounds); var client = new GitHubClient(new System.Net.Http.Headers.ProductHeaderValue("RxUISample", "0.1")); client.Credentials = new Credentials("paulcbetts", GiveMeAToken.DoIt()); r.RegisterConstant(client.Notification, typeof(INotificationsClient)); viewController = new NotificationsListViewController(); window.RootViewController = viewController; window.MakeKeyAndVisible(); return true; }
public void ApplicationStateShouldBeRoundtrippable() { var resolver = new ModernDependencyResolver(); resolver.InitializeResolver(); resolver.InitializeAkavache(); resolver.Register(() => new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore, TypeNameHandling = TypeNameHandling.All, ObjectCreationHandling = ObjectCreationHandling.Replace, }, typeof(JsonSerializerSettings)); using (resolver.WithResolver()) { string path; var input = new DummyAppBootstrapper(); var expected = ((DummyRoutedViewModel) input.Router.NavigationStack[0]).ARandomGuid; input.Router.Navigate.Execute(new DummyRoutedViewModel(input) {ARandomGuid = Guid.NewGuid()}); Console.WriteLine("After Nav Count: {0}", input.Router.NavigationStack.Count); using(Utility.WithEmptyDirectory(out path)) using (var fixture = CreateBlobCache(path)) { fixture.InsertObject("state", input).First(); var result = fixture.GetObjectAsync<DummyAppBootstrapper>("state").First(); var output = (DummyRoutedViewModel) result.Router.NavigationStack[0]; Assert.Equal(expected, output.ARandomGuid); } } }