protected override void Configure() { Container = new PhoneContainer(); if (!Execute.InDesignMode) { Container.RegisterPhoneServices(RootFrame); } NavigationService = Container.GetInstance(typeof(INavigationService), null) as INavigationService; EventAggregator = Container.GetInstance(typeof(IEventAggregator), null) as IEventAggregator; RegisterServices(); RegisterViewModels(); AddCustomConventions(); }
protected override void Configure() { container = new PhoneContainer(RootFrame); container.RegisterPhoneServices(); container.PerRequest<MainPageViewModel>(); container.PerRequest<ApplicationLifeCycleViewModel>(); // get the caliburn phone service to handle even more lifecycle hooks var phoneService = container.GetInstance(typeof(IPhoneService), null) as IPhoneService; phoneService.Resurrecting += this.phoneService_Resurrecting; phoneService.Continuing += this.phoneService_Continuing; AddCustomConventions(); }
protected override void Configure() { InteractionEffectManager.AllowedTypes.Add(typeof(RadDataBoundListBoxItem)); container = new PhoneContainer(RootFrame); container.RegisterPhoneServices(); // Loggers container.Singleton<ILog, DebugLogger>(); // Database container.Handler<DbDataContext>( ioc => new DbDataContext(DbDataContext.DbConnectionString) { DeferredLoadingEnabled = false, ObjectTrackingEnabled = true }); using (var context = (DbDataContext)container.GetInstance(typeof(DbDataContext), null)) { if (!context.DatabaseExists()) { context.CreateDatabase(); context.SubmitChanges(); } } // Clients container .Singleton<ITwitterClient, TwitterClient>() .Singleton<IFacebookClient, FacebookClient>() .Singleton<ITrainshareClient, TrainshareClient>() .Singleton<ITimeTable, CacheTimeTable>(); // ViewModels container .Singleton<MainPageViewModel>() .Singleton<MainViewModel>() .Singleton<AccountsViewModel>() .Singleton<AboutViewModel>() .PerRequest<SearchViewModel>() .PerRequest<SearchResultViewModel>() .PerRequest<CheckinViewModel>(); AddCustomConventions(); }
protected async override void Configure() { container = new PhoneContainer(RootFrame); container.RegisterPhoneServices(); container.PerRequest<MainViewModel>(); container.PerRequest<IDbService,DbService>(); container.RegisterInstance(typeof(SQLiteAsyncConnection), "SQLiteAsyncConnection", new SQLiteAsyncConnection(Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "TestDb.sqlite"))); AddCustomConventions(); SQLiteAsyncConnection connection = (SQLiteAsyncConnection)container.GetInstance(typeof(SQLiteAsyncConnection), "SQLiteAsyncConnection"); //connection.DropTableAsync<Product>(); await connection.CreateTableAsync<Product>(); await connection.InsertAsync(new Product { Name = "Product 1", Serial = "123456" }); await connection.InsertAsync(new Product { Name = "Product 2", Serial = "123456" }); }