Exemplo n.º 1
0
        private void InitApp()
        {
            var container = new SimpleIoc();

            container.Register(() => new UserProfileViewModel());

            LifecycleViewModelProvider.SetFactory(
                new DefaultLifecycleViewModelFactory(container));
        }
Exemplo n.º 2
0
        private void InitApp()
        {
            var container = new SimpleIoc();

            container.Register <INavigationService>(() => new AppNavigationService());
            container.Register(() => new EntryViewModel(container.Get <INavigationService>()));
            container.Register(() => new UserProfileViewModel());

            LifecycleViewModelProvider.SetFactory(
                new DefaultLifecycleViewModelFactory(container));
        }
Exemplo n.º 3
0
        public void Execute(BootstrapperConfig config)
        {
            var simpleIoc = config.GetSimpleIoc();

            simpleIoc.Register(() => new EntryViewModel(simpleIoc.Get <INavigationService>()));
            simpleIoc.Register(() => new HomeViewModel(simpleIoc.Get <INavigationService>()));
            simpleIoc.Register(() => new FirstViewModel(simpleIoc.Get <INavigationService>()));
            simpleIoc.Register(() => new SecondViewModel(simpleIoc.Get <INavigationService>()));
            simpleIoc.Register(() => new ThirdViewModel(simpleIoc.Get <INavigationService>()));
            simpleIoc.Register(() => new CustomFlowNavigationViewModel());

            LifecycleViewModelProvider.SetFactory(new DefaultLifecycleViewModelFactory(simpleIoc));
        }
Exemplo n.º 4
0
        private void InitApp()
        {
            var container = new SimpleIoc();

            container.Register <INavigationService>(() => new AppNavigationService());
            container.Register <IVacationClientService>(() => new VacationClientService(), Reuse.Singleton);
            container.Register <IMessageRoot>(() => new MessageRoot(), Reuse.Singleton);
            container.Register <IVacationProvider>(() => new VacationProvider(container.Get <IVacationClientService>()), Reuse.Singleton);

            container.Register(() => new SplashViewModel(container.Get <INavigationService>(), container.Get <IVacationClientService>()));
            container.Register(() => new LoginViewModel(container.Get <IVacationClientService>(), container.Get <INavigationService>()));
            container.Register(() => new MainListViewModel(container.Get <IVacationProvider>(), container.Get <INavigationService>(), container.Get <IMessageRoot>()));
            container.Register(() => new DetailScreenViewModel(container.Get <INavigationService>(), container.Get <IVacationProvider>(), container.Get <IMessageRoot>()));

            LifecycleViewModelProvider.SetFactory(
                new DefaultLifecycleViewModelFactory(container));
        }
Exemplo n.º 5
0
        public void Execute(BootstrapperConfig config)
        {
            InitApi(config);

            var simpleIoc = config.GetSimpleIoc();

            simpleIoc.Register <IOperationFactory>(() => new OperationFactory(simpleIoc, new OperationErrorHandler()), FlexiMvvm.Ioc.Reuse.Singleton);

            simpleIoc.Register <IUserDialogs>(() => UserDialogs.Instance, FlexiMvvm.Ioc.Reuse.Singleton);

            simpleIoc.Register <IRealmProvider>(() => new RealmProvider(), FlexiMvvm.Ioc.Reuse.Singleton);

            simpleIoc.Register <IVacationRequestsRepository>(() => new VacationRequestsRepository(new ExpressMapperRealmRepositoryEntriesMapper <VacantionRequest, VacationRequestRealmObject>(), simpleIoc.Get <IRealmProvider>()));

            simpleIoc.Register <IVacationRequestsManagerService>(() => new VacationRequestsManagerService(simpleIoc.Get <IVacationRequestsRepository>(), simpleIoc.Get <IVacationRequestsApiService>()), FlexiMvvm.Ioc.Reuse.Singleton);

            simpleIoc.Register <IVacationRequestsFilterService>(() => new VacationRequestsFilterService());

            simpleIoc.Register <INavigationService>(
                () => new NavigationService(simpleIoc.Get <IFlexiMvvmViewPresenter>(), simpleIoc.Get <IViewResolver>()),
                Reuse.Singleton);

            IocHelper.RegisterViewModelsFromAssemblyByReflection(simpleIoc, GetType().Assembly);

            LifecycleViewModelProvider.SetFactory(new DefaultLifecycleViewModelFactory(simpleIoc));

            simpleIoc.Register <ISessionService>(() => new SessionService(simpleIoc.Get <IApiSettingsService>(), simpleIoc.Get <IAuthenticationApiService>()), FlexiMvvm.Ioc.Reuse.Singleton);

            var session = simpleIoc.Get <ISessionService>();

            simpleIoc.Get <IApiSettingsService>().RefreshTokenUpdater = session;

            session.OnCredentialsFails += async(sender, e) =>
            {
                await simpleIoc.Get <INavigationService>().Navigate <LoginViewModel>();

                await simpleIoc.Get <IRealmProvider>().Drop().ConfigureAwait(false);
            };

            RegisterMappings();
        }
 private void SetupLifecycleViewModelProvider(IServiceProvider serviceProvider)
 {
     LifecycleViewModelProvider.SetFactory(new DefaultLifecycleViewModelFactory(serviceProvider));
 }