public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { var nav = new NavigationService(); nav.Initialize(Window.RootViewController as UINavigationController); SimpleIoc.Default.Register<INavigationService>(() => nav); SimpleIoc.Default.Register<IDialogService, DialogService>(); return true; }
// In iOS the CreateNavigationService method needs to be called outside the Bootstrapper to gain accees to the RootViewController public void CreateNavigationService(UIWindow window) { var navigationService = new NavigationService(); navigationService.Initialize((UINavigationController)window.RootViewController); navigationService.Configure("Add", "AddViewController"); navigationService.Configure("Details", "DetailsViewController"); SimpleIoc.Default.Register<INavigationService>(() => navigationService); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); var nav = new NavigationService(); nav.Initialize((UINavigationController)Window.RootViewController); nav.Configure(Page2Key, "Page2Controller"); nav.Configure(Page3Key, "Page3Controller"); SimpleIoc.Default.Register<INavigationService>(() => nav); return true; }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); var nav = new NavigationService(); nav.Initialize((UINavigationController)Window.RootViewController); nav.Configure(Views.About, "AboutView"); nav.Configure(Views.AddNew, "AddNewView"); nav.Configure(Views.History, "AboutView"); nav.Configure(Views.Home, "HomeView"); nav.Configure(Views.Settings, "SettingsView"); nav.Configure(Views.Startup, "StartupView"); nav.Configure(Views.UpdateExisting, "UpdateExistingView"); SimpleIoc.Default.Register<INavigationService>(() => nav); var dataContext = new DataContext(); dataContext.Init(); SimpleIoc.Default.Register<IDataContext>(() => dataContext); SimpleIoc.Default.Register<IPlatformServices>(() => new DeviceServices.PlatformServices()); // Override point for customization after application launch. if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { var splitViewController = (UISplitViewController)Window.RootViewController; // Get the UINavigationControllers containing our master & detail view controllers var masterNavigationController = (UINavigationController)splitViewController.ViewControllers[0]; var detailNavigationController = (UINavigationController)splitViewController.ViewControllers[1]; var masterViewController = (MasterViewController)masterNavigationController.TopViewController; var detailViewController = (DetailViewController)detailNavigationController.TopViewController; masterViewController.DetailViewController = detailViewController; // Set the DetailViewController as the UISplitViewController Delegate. splitViewController.WeakDelegate = detailViewController; } Profile.EnableUpdatesOnAccessTokenChange(true); Settings.AppID = appId; Settings.DisplayName = appName; return true; }
// 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) { var nav = new NavigationService(); nav.Configure( ViewModelLocator.DetailsPageKey, "Details"); nav.Configure( SeeCommentsPageKey, "SeeComments"); nav.Configure( ViewModelLocator.AddCommentPageKey, "AddComment"); nav.Initialize(Window.RootViewController as UINavigationController); SimpleIoc.Default.Register<INavigationService>(() => nav); SimpleIoc.Default.Register<IDialogService, DialogService>(); return true; }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { var nav = new NavigationService(); nav.Initialize((UINavigationController)Window.RootViewController); nav.Configure(Views.Main.ToString(), "MainView"); nav.Configure(Views.Hello.ToString(), "HelloViewController"); var builder = new ContainerBuilder(); builder.RegisterInstance<INavigationService>(nav); builder.RegisterType<MainViewModel>(); builder.RegisterType<HelloViewModel>(); var container = builder.Build(); var serviceLocator = new AutofacServiceLocator(container); ServiceLocator.SetLocatorProvider(() => serviceLocator); return true; }
// 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) { // MVVM Light's DispatcherHelper for cross-thread handling. DispatcherHelper.Initialize(app); // Illustrates how to use the Messenger by receiving a message // and sending a message back. Messenger.Default.Register<NotificationMessageAction<string>>( this, HandleNotificationMessage); // Configure and register the MVVM Light NavigationService var nav = new NavigationService(); SimpleIoc.Default.Register<INavigationService>(() => nav); nav.Initialize((UINavigationController)Window.RootViewController); nav.Configure(ViewModelLocator.SecondPageKey, "SecondPage"); // Register the MVVM Light DialogService SimpleIoc.Default.Register<IDialogService, DialogService>(); return true; }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { // create a new window instance based on the screen size window = new UIWindow(UIScreen.MainScreen.Bounds); // Add the Navigation Controller and initialize it var navController = new UINavigationController(new MainViewController()); window.RootViewController = navController; // Initialize and register the Navigation Service ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); var nav = new NavigationService(); nav.Initialize(navController); nav.Configure(Page2Key, typeof(Page2Controller)); nav.Configure(Page3Key, typeof(Page3Controller)); SimpleIoc.Default.Register<INavigationService>(() => nav); // make the window visible window.MakeKeyAndVisible(); return true; }
private void Bootstrap() { System.Diagnostics.Debug.WriteLine("Bootstrap"); if (_container == null) { var builder = new ContainerBuilder(); // shared modules builder.RegisterModule<CoreModule>(); // platform-specific registrations builder.RegisterType<DispatcherHelper>() .AsSelf() .As<IDispatcherHelper>() .SingleInstance(); builder.RegisterInstance(Ble.Adapter.Current) .As<Ble.IAdapter>(); var nav = new NavigationService(); nav.Initialize((UINavigationController)Window.RootViewController); nav.Configure(ViewModelLocator.DeviceListViewKey, "DeviceListViewController"); nav.Configure(ViewModelLocator.DeviceViewKey, "DeviceViewController"); nav.Configure(ModeSmsViewKey, "ModeSmsViewController"); nav.Configure(ModeSmsStatusViewKey, "ModeSmsStatusViewController"); nav.Configure(ModePanoViewKey, "ModePanoViewController"); nav.Configure(ModePanoStatusViewKey, "ModePanoStatusViewController"); nav.Configure(ModeAstroViewKey, "ModeAstroViewController"); nav.Configure(ModeAstroStatusViewKey, "ModeAstroStatusViewController"); nav.Configure(JoystickViewKey, "JoystickViewController"); builder.RegisterInstance(nav) .As<INavigationService>(); builder.RegisterType<DialogService>() .As<IDialogService>() .SingleInstance(); _container = builder.Build(); } if (!ServiceLocator.IsLocationProviderSet) { var csl = new AutofacServiceLocator(_container); ServiceLocator.SetLocatorProvider(() => csl); } }