protected override void Configure()
        {
            container = new PhoneContainer(this);

            container.RegisterSingleton(typeof(MainPageViewModel), "MainPageViewModel", typeof(MainPageViewModel));
            container.RegisterSingleton(typeof(PageTwoViewModel), "PageTwoViewModel", typeof(PageTwoViewModel));
            
            container.RegisterInstance(typeof(INavigationService), null, new FrameAdapter(RootFrame));
            container.RegisterInstance(typeof(IPhoneService), null, new PhoneApplicationServiceAdapter(PhoneService));

            container.Activator.InstallChooser<PhoneNumberChooserTask, PhoneNumberResult>();
            container.Activator.InstallLauncher<EmailComposeTask>();
        }
コード例 #2
0
        /// <summary>
        /// Override to configure the framework and setup your IoC container.
        /// </summary>
        protected override void Configure()
        {
            m_container = new PhoneContainer();

            m_container.RegisterSingleton(
                typeof(MainPageViewModel),
                "MainPageViewModel",
                typeof(MainPageViewModel));

            m_container.RegisterSingleton(
               typeof(ThreadingPageViewModel),
               "ThreadingPageViewModel",
               typeof(ThreadingPageViewModel));

            m_container.RegisterSingleton(
               typeof(SterlingPageViewModel),
               "SterlingPageViewModel",
               typeof(SterlingPageViewModel));

            m_container.RegisterSingleton(
              typeof(SterlingExtensionsPageViewModel),
              "SterlingExtensionsPageViewModel",
              typeof(SterlingExtensionsPageViewModel));

            m_container.RegisterSingleton(
             typeof(CodeOnlyPageViewModel),
             "CodeOnlyPageViewModel",
             typeof(CodeOnlyPageViewModel));

            m_container.RegisterInstance(
                typeof(ICargoRepository),
                null,
                new CargoRepository());

            m_container.RegisterInstance(
                typeof(INavigationService),
                null,
                new FrameAdapter(RootFrame));

            m_container.RegisterInstance(
                typeof(IPhoneService),
                null,
                new PhoneApplicationServiceAdapter(PhoneService));

            m_container.Activator.InstallChooser<PhoneNumberChooserTask, PhoneNumberResult>();
            m_container.Activator.InstallLauncher<EmailComposeTask>();
        }
コード例 #3
0
ファイル: Bootstrapper.cs プロジェクト: perfp/Trafikanten-WP7
 protected override void Configure()
 {
     container = new PhoneContainer(this);
     container.RegisterPerRequest(typeof(IRealtimeStopVisitsService), null, typeof(RealtimeStopVisitsService));
     container.RegisterPerRequest(typeof(IRealtimeStopsService), null, typeof(RealtimeStopsService));
     container.RegisterPerRequest(typeof(StopsViewViewModel), "StopsViewModel", typeof(StopsViewViewModel));
     container.RegisterPerRequest(typeof(RealtimeResultsViewModel), "RealtimeResultsViewModel", typeof(RealtimeResultsViewModel));
     container.RegisterInstance(typeof(INavigationService), null, new FrameAdapter(RootFrame));
 }
コード例 #4
0
 protected override void Configure()
 {
     AddCustomConventions();
     _container = new PhoneContainer(RootFrame);
     _container.RegisterPhoneServices();
     PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Disabled;
     _container.RegisterSingleton(typeof(AudioCaptureDevice), String.Empty, typeof(AudioCaptureDevice));
     _container.RegisterSingleton(typeof(IRecordingManager), String.Empty, typeof(RecordingManager));
     _container.RegisterSingleton(typeof(ITagManager), String.Empty, typeof(TagManager));
     _container.RegisterSingleton(typeof(IAudioRecorder), String.Empty, typeof(AudioRecorder));
     _container.RegisterInstance(typeof(RecordingsContext), String.Empty, new RecordingsContext("Data Source=isostore:/Items.sdf"));
     _container.PerRequest<IRecordingStreamManager, RecordingStreamManager>();
     RegisterActions();
     RegisterViewModels();
 }
コード例 #5
0
        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" });

        }