예제 #1
0
        protected override void Configure()
        {
            _container = new PhoneContainer();
            _container.RegisterPhoneServices(RootFrame);

            _container.Instance(RootFrame);

            _container.Singleton <ICache, FileSystemCache>();

            // View Models
            _container.Singleton <SplashViewModel>();
            _container.Singleton <AboutViewModel>();
            _container.Singleton <ShellViewModel>();
            _container.Singleton <MyBoardsViewModel>();
            _container.Singleton <MyCardsViewModel>();
            _container.Singleton <MyNotificationsViewModel>();
            _container.Singleton <ProfileViewModel>();

            _container.PerRequest <BoardViewModel>();
            _container.PerRequest <BoardListViewModel>();
            _container.PerRequest <CardViewModel>();
            _container.PerRequest <CardDetailPivotViewModel>();
            _container.PerRequest <CardDetailOverviewViewModel>();
            _container.PerRequest <CardDetailChecklistViewModel>();
            _container.PerRequest <CardDetailAttachmentsViewModel>();
            _container.PerRequest <CardDetailMembersViewModel>();
            _container.PerRequest <ChecklistViewModel>();
            _container.PerRequest <ChecklistItemViewModel>();
            _container.PerRequest <AttachmentViewModel>();
            _container.AllTransientTypesOf <NotificationViewModel>();

            // Event handlers
            _container.AllSingletonTypesOf <AbstractHandler>();

            // Services
            _container.PerRequest <Services.IApplicationBar, DefaultApplicationBar>();
            _container.Singleton <INetworkService, NetworkService>();
            _container.Singleton <IProgressService, ProgressService>();
            _container.Singleton <ITrelloApiSettings, TrelloSettings>();

#if DISCONNECTED
            _container.Singleton <IRequestClient, JsonFileRestClient>();
#else
            _container.Singleton <IRequestClient, TrelloRestClient>();
#endif
            var network = _container.Get <INetworkService>();
            var client  = AugmentClient(_container);
            var trello  = new Trello(network, client);
            _container.Instance <ITrello>(trello);

            PhoneToolkitConventions.Install();
            TelerikConventions.Install();

            // Force creation
            _container.InstantiateInstancesOf <AbstractHandler>();
        }