示例#1
0
        public override void Initialize()
        {
            CreatableTypes()
            .EndingWith("Service")
            .AsInterfaces()
            .RegisterAsLazySingleton();

            //CreatableTypes().
            //    EndingWith("Repository")
            //    .AsTypes()
            //    .RegisterAsLazySingleton();

            //Add AutoMapper
            Mvx.RegisterSingleton(MapService.ConfigureMapper());

            Mvx.RegisterType <IMvxJsonConverter, MvxJsonConverter>();
            Mvx.RegisterSingleton(() => UserDialogs.Instance);
            Mvx.RegisterType <IRequestProvider, RequestProvider>();
            Mvx.RegisterType <IAuthenticationService, AuthenticationService>();
            Mvx.RegisterType <IUserService, UserService>();

            AppResources.Culture = Mvx.Resolve <ILocalizeService>().GetCurrentCultureInfo();

            //Settings.AccessToken = null;
            //ToDo Test if the token is actually valid.
            //RegisterAppStart<SelectAvailabilityViewModel>();

            if (string.IsNullOrEmpty(Settings.AccessToken))
            {
                RegisterAppStart <LoginViewModel>();
            }
            else
            {
                RegisterAppStart <SplitRootViewModel>();
            }
        }