Пример #1
0
        private static IApplicationController InitializeApplicationController()
        {
            IIocContainer container = new LightInjectContainer();

            // UI classes
            IApplicationController controller = new ApplicationController(container)
                                                .RegisterView <IMainView, MainForm>()
                                                .RegisterView <IThumbnailView, ThumbnailView>()
                                                .RegisterView <IThumbnailDescriptionView, ThumbnailDescriptionView>()
                                                .RegisterInstance(new ApplicationContext());

            // Application services
            controller.RegisterService <IThumbnailManager, ThumbnailManager>()
            .RegisterService <IThumbnailViewFactory, ThumbnailViewFactory>()
            .RegisterService <IThumbnailDescriptionViewFactory, ThumbnailDescriptionViewFactory>()
            .RegisterService <IConfigurationStorage, ConfigurationStorage>()
            .RegisterInstance <IAppConfig>(new AppConfig())
            .RegisterInstance <IThumbnailConfig>(new ThumbnailConfig());

            return(controller);
        }
Пример #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // TODO Switch to another container that provides signed assemblies
            IIocContainer container = new LightInjectContainer();

            // UI classes
            IApplicationController controller = new ApplicationController(container)
                                                .RegisterView <IMainView, MainForm>()
                                                .RegisterView <IThumbnailView, ThumbnailView>()
                                                .RegisterView <IThumbnailDescriptionView, ThumbnailDescriptionView>()
                                                .RegisterInstance(new ApplicationContext());

            // Application services
            controller.RegisterService <IThumbnailManager, ThumbnailManager>()
            .RegisterService <IThumbnailViewFactory, ThumbnailViewFactory>()
            .RegisterService <IThumbnailDescriptionViewFactory, ThumbnailDescriptionViewFactory>()
            .RegisterService <IConfigurationStorage, ConfigurationStorage>()
            .RegisterInstance <IApplicationConfiguration>(new ApplicationConfiguration());

            controller.Run <MainPresenter>();
        }