Exemplo n.º 1
0
        public App(IAnalyticsService analyticsService, IMvpApiService mvpApiService, IAuthService authService, LanguageService languageService)
        {
            InitializeComponent();

            this.AnalyticsService = analyticsService;

            // We add exception handling here, because the MVP API is shared
            // through this app class with every page. Errors in it need to handled
            // generically through here as well.
            mvpApiService.AccessTokenExpired += MvpApiService_AccessTokenExpired;

            MvpApiService = mvpApiService;
            AuthService   = authService;

            if (Device.RuntimePlatform == Device.Android)
            {
                languageService.Initialize();
            }

            Resolver.SetResolver(new AutofacResolver(ContainerService.Container));
            Akavache.Registrations.Start(Constants.AppName);
            On <iOS>().SetHandleControlUpdatesOnMainThread(true);

            // Set the theme that the user has picked.
            Current.UserAppTheme = Settings.AppTheme;

            // Set our start page to the splash screen, as that is what we want
            // everyone to see first. It's glorious.
            NavigationHelper = Resolver.Resolve <INavigationHelper>();
            NavigationHelper.SetRootView(nameof(SplashScreenPage));
        }