示例#1
0
文件: App.xaml.cs 项目: z33bs/MVP
        public App(IAnalyticsService analyticsService,
                   IMvpApiService mvpApiService,
                   IAuthService authService,
                   IDialogService dialogService)
        {
            InitializeComponent();

            this.analyticsService = analyticsService;
            this.authService      = authService;
            this.dialogService    = dialogService;

            // 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.RequestErrorOccurred += MvpApiService_RequestErrorOccurred;

            MvpApiService = mvpApiService;

            Device.SetFlags(new[] { "IndicatorView_Experimental" });
            Resolver.SetResolver(new AutofacResolver(ContainerService.Container));
            Sharpnado.Shades.Initializer.Initialize(loggerEnable: false);
            Akavache.Registrations.Start(Constants.AppName);
            On <iOS>().SetHandleControlUpdatesOnMainThread(true);

            // Set the theme that the user has picked.
            Current.UserAppTheme = (OSAppTheme)Preferences.Get(Settings.AppTheme, Settings.AppThemeDefault);

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

            navHelper.SetRootView(nameof(SplashScreenPage));
        }
示例#2
0
        public SplashScreenPageModel(IAuthService authService, IMvpApiService mvpApiService)
        {
            _authService   = authService;
            _mvpApiService = mvpApiService;

            PrefetchDataCommand = new AsyncCommand(() => PrefetchData());
        }
示例#3
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));
        }