Пример #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>();
        }
        protected override void Configure()
        {
            container = new CompositionContainer(
                new AggregateCatalog(AssemblySource.Instance.Select(x => new AssemblyCatalog(x)))
                );

            var batch = new CompositionBatch();

            batch.AddExportedValue <IWindowManager>(new TelerikWindowManager());
            batch.AddExportedValue <IEventAggregator>(new EventAggregator());
            batch.AddExportedValue(container);

            // This is essential to enable Telerik's conventions
            TelerikConventions.Install();

            StyleManager.ApplicationTheme = ThemeManager.FromName("Windows8");

            container.Compose(batch);
        }
        /// <summary>
        /// By default, we are configured to use MEF
        /// </summary>
        protected override void Configure()
        {
            var catalog = new AggregateCatalog(
                AssemblySource.Instance.Select(x => new AssemblyCatalog(x)).OfType <ComposablePartCatalog>()
                );

            container = CompositionHost.Initialize(catalog);

            var batch = new CompositionBatch();

            batch.AddExportedValue <IWindowManager>(new WindowManager());
            batch.AddExportedValue <IEventAggregator>(new EventAggregator());
            batch.AddExportedValue(container);
            batch.AddExportedValue(catalog);

            container.Compose(batch);

            // This is essential to enable Telerik's conventions
            TelerikConventions.Install();

            StyleManager.ApplicationTheme = ThemeManager.FromName("Metro");
        }