public void Start() { PathLocator.SetCurrentDirectoryPathFromExecutingAssembly(); AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; SetupLoggers(); _logHelper.LogWelcomeMessage(); SetupNesper(); SetupWcf(); SetupTimers(); _logHelper.LogFooter(); StartDeque(); }
/// <summary> /// Initializes a new instance of the <see cref="T:ReactiveUIAroundMe.Droid.AppBootstrapper"/> class. /// </summary> public AppBootstrapper() { Router = new RoutingState(); Locator.CurrentMutable.RegisterConstant(this, typeof(IScreen)); HttpClientHandler clientHandler = new HttpClientHandler(); //_isWindows ? new HttpClientHandler() : new NativeMessageHandler(); clientHandler.UseCookies = false; clientHandler.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip; // TODO: singletons, we want to pull resolved items from container, rather than outside declarations var sqliteplatform = new SQLitePlatformAndroid(); var logger = new LoggerAndroid(); var settings = new Settings(); var userDefaults = new UserDefaults(settings); // temp until settings page added userDefaults.Host = Config.BaseUrl; var device = new Device.Device(); var sqliteSetup = new SQLiteSetup(sqliteplatform); var sqliteStorage = new SQLiteStorage(sqliteSetup, logger); var scheduler = new ReactiveUIAroundMe.Droid.Threading.HandlerScheduler(); var webServiceController = new WebServiceController(sqliteStorage, logger, clientHandler, scheduler, userDefaults); var googleMapsWebServiceController = new GoogleMapsWebServiceController(sqliteStorage, logger, clientHandler, scheduler, userDefaults); var applicationStateHandler = new ApplicationStateHandler(sqliteStorage); //var orientationHandler = new OrientationHandlerAndroid(); var pathLocator = new PathLocator(); var locationManager = new LocationManager(); // pages // todo: we could use reflection here //Locator.CurrentMutable.Register(() => new LoginPage(), typeof(IViewFor<LoginPageViewModel>)); Locator.CurrentMutable.Register(() => new HomeActivity(), typeof(IViewFor <HomePageViewModel>)); //Locator.CurrentMutable.Register(() => new SuperAdminPage(), typeof(IViewFor<SuperAdminPageViewModel>)); //Locator.CurrentMutable.Register(() => new SearchResultsPage(), typeof(IViewFor<SearchResultsPageViewModel>)); //Locator.CurrentMutable.Register(() => new MapPage(), typeof(IViewFor<MapPageViewModel>)); Locator.CurrentMutable.Register(() => new FlyoutMenuActivity(), typeof(IViewFor <FlyoutMenuPageViewModel>)); // singletons Locator.CurrentMutable.RegisterLazySingleton(() => applicationStateHandler, typeof(ApplicationStateHandler)); Locator.CurrentMutable.RegisterLazySingleton(() => webServiceController, typeof(WebServiceController)); Locator.CurrentMutable.RegisterLazySingleton(() => googleMapsWebServiceController, typeof(GoogleMapsWebServiceController)); Locator.CurrentMutable.Register <ISettings>(() => settings); Locator.CurrentMutable.Register <IUserDefaults>(() => userDefaults); Locator.CurrentMutable.Register <ISQLitePlatform>(() => sqliteplatform); Locator.CurrentMutable.Register <ISQLiteSetup>(() => sqliteSetup); Locator.CurrentMutable.Register <ISQLiteStorage>(() => sqliteStorage); Locator.CurrentMutable.Register <Portable.Logging.ILogger>(() => logger); Locator.CurrentMutable.Register <IDevice>(() => device); //Locator.CurrentMutable.Register<IOrientationHandler>(() => orientationHandler); Locator.CurrentMutable.Register <IPathLocator>(() => pathLocator); Locator.CurrentMutable.Register <IScheduler>(() => scheduler); Locator.CurrentMutable.Register <ILocationManager>(() => locationManager); Locator.CurrentMutable.Register <HttpClientHandler>(() => clientHandler); // converters Locator.CurrentMutable.RegisterConstant(new NotConverter(), typeof(IBindingTypeConverter)); //Locator.CurrentMutable.RegisterViewsForViewModels(this.GetType().GetTypeInfo().Assembly); _flyoutMenuViewModel = new FlyoutMenuPageViewModel(scheduler, applicationStateHandler, sqliteStorage, webServiceController, googleMapsWebServiceController, pathLocator, logger, device, this, locationManager); //// Navigate to the opening page of the application Router.Navigate.Execute(new HomePageViewModel(scheduler, applicationStateHandler, sqliteStorage, webServiceController, googleMapsWebServiceController, pathLocator, logger, device, this, locationManager)); }