Exemple #1
0
        static void Main()
        {
            var unityContainer = new UnityContainer();

            unityContainer
            .RegisterType <IMainView, MainView>(new ContainerControlledLifetimeManager())
            .RegisterType <IMainPresenter, MainPresenter>(new ContainerControlledLifetimeManager())
            .RegisterType <IErrorMessageView, ErrorMessageView>()
            .RegisterType <IAddStudent, AddStudent>()
            .RegisterType <IStudentService, StudentService>(new ContainerControlledLifetimeManager())
            .RegisterType <ITeacherService, TeacherService>(new ContainerControlledLifetimeManager())
            .RegisterType <IAppointmentService, AppointmentService>(new ContainerControlledLifetimeManager())
            .RegisterType <IAddStudentPresenter, AddStudentPresenter>(new ContainerControlledLifetimeManager())
            .RegisterType <IStudentsGridViewPresenter, StudentsGridViewPresenter>(new ContainerControlledLifetimeManager())
            .RegisterType <IStudentsListViewPresenter, StudentsListViewPresenter>(new ContainerControlledLifetimeManager())
            .RegisterType <IChartViewPresenter, ChartViewPresenter>(new ContainerControlledLifetimeManager())
            .RegisterType <ISchedulerViewPresenter, SchedulerViewPresenter>(new ContainerControlledLifetimeManager())
            .RegisterType <IReportViewPresenter, ReportViewPresenter>(new ContainerControlledLifetimeManager())
            .RegisterType <IUnitOfWork, UnitOfWork>(new ContainerControlledLifetimeManager())
            .RegisterType <IModelDataAnnotationCheck, ModelDataAnnotationCheck>(new ContainerControlledLifetimeManager())
            .RegisterType <IUniversityLocalContext, UniversityLocalContext>(new ContainerControlledLifetimeManager())
            .RegisterType <IStudentDbContext, StudentDbContext>(new ContainerControlledLifetimeManager());

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            IMainPresenter mainPresenter = unityContainer.Resolve <MainPresenter>();

            IMainView mainView = mainPresenter.GetMainView();

            Application.Run((MainView)mainView);
        }
        static void Main()
        {
            // -- config logger
            log4net.Config.XmlConfigurator.Configure();

            // -- config container
            var builder = new ContainerBuilder();

            // -- repositoy
            builder.RegisterType <PortfolioDbContext>().As <DbContext>();
            builder.RegisterType <LiveDataRepository>().As <ILiveDataRepository>();
            // -- service
            builder.RegisterType <PortfolioService>().As <IPortfolioService>();
            builder.RegisterType <UserService>().As <IUserService>();
            // -- presentation
            builder.RegisterType <MainView>().As <IMainView>();
            builder.RegisterType <MainPresenter>().As <IMainPresenter>();
            var container = builder.Build();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            IMainPresenter mainPresenter = container.Resolve <IMainPresenter>();
            IMainView      mainView      = mainPresenter.GetMainView();

            Application.Run((MainView)mainView);
        }
Exemple #3
0
        static void Main()
        {
            IUnityContainer UnitiC;

            string _connectionString = "Data Source=" +
                                       Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\OO_PocketGourmet_REAL-UnitTest\MVPDB.sqlite;";

            UnitiC = new UnityContainer().RegisterType <IMainView, MainView>(new ContainerControlledLifetimeManager())
                     .RegisterType <IMainPresenter, MainPresenter>(new ContainerControlledLifetimeManager())
                     .RegisterType <IErrorMessageView, ErrorMessageView>(new ContainerControlledLifetimeManager());



            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            IMainPresenter mainPresenter = UnitiC.Resolve <MainPresenter>();
            IMainView      mainView      = mainPresenter.GetMainView();

            Application.Run((MainView)mainView);
        }
Exemple #4
0
        static void Main()
        {
            IUnityContainer UnityC;

            string connectionString = "Data Source=" + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) +
                                      @"\ForgetMeNot\nazwa;Version = 3";

            UnityC = new UnityContainer()
                     .RegisterType <IMainView, MainView>(new ContainerControlledLifetimeManager())
                     .RegisterType <IMainPresenter, MainPresenter>(new ContainerControlledLifetimeManager())
                     .RegisterType <IErrorMessageView, ErrorMessageView>(new ContainerControlledLifetimeManager())
                     .RegisterType <IAddEventView, AddEventView>(new ContainerControlledLifetimeManager())
                     .RegisterType <IAddEventPresenter, AddEventPresenter>(new ContainerControlledLifetimeManager());


            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            IMainPresenter mainPresenter = UnityC.Resolve <MainPresenter>();
            IMainView      mainView      = mainPresenter.GetMainView();


            Application.Run((MainView)mainView);
        }
Exemple #5
0
 public void ShowMainView(UserDTO user)
 {
     _mainPresenter.LoadAll();
     _rootView.SetUserControl((BaseUserControlUC)_mainPresenter.GetMainView());
 }
Exemple #6
0
        static void Main()
        {
            try
            {
                string connectionString = ConfigurationManager.ConnectionStrings["SqlCEConnection"].ConnectionString;

                UnityC = new UnityContainer()
                         .RegisterType <IMainView, MainView>(new ContainerControlledLifetimeManager())
                         .RegisterType <IMainPresenter, MainPresenter>(new ContainerControlledLifetimeManager())

                         .RegisterType <ICommonRepository, CommonRepository>(new ContainerControlledLifetimeManager())

                         .RegisterType <ISettingsPresenter, SettingsPresenter>(new ContainerControlledLifetimeManager())
                         .RegisterType <ISettingsUC, SettingsUC>(new ContainerControlledLifetimeManager())

                         .RegisterType <IUnitsUC, UnitsUC>(new ContainerControlledLifetimeManager())
                         .RegisterType <IUnitsDetailUC, UnitsDetailUC>(new ContainerControlledLifetimeManager())
                         .RegisterType <IUnitsPresenter, UnitsPresenter>(new ContainerControlledLifetimeManager())
                         .RegisterType <IUnitsDetailPresenter, UnitsDetailPresenter>(new ContainerControlledLifetimeManager())
                         .RegisterType <IUnitsService, UnitsService>(new ContainerControlledLifetimeManager())
                         .RegisterType <IUnitsRepository, UnitsRepository>(new InjectionConstructor(connectionString))

                         .RegisterType <ISuppliersUC, SuppliersUC>(new ContainerControlledLifetimeManager())
                         .RegisterType <ISuppliersDetailUC, SuppliersDetailUC>(new ContainerControlledLifetimeManager())
                         .RegisterType <ISuppliersPresenter, SuppliersPresenter>(new ContainerControlledLifetimeManager())
                         .RegisterType <ISuppliersDetailPresenter, SuppliersDetailPresenter>(new ContainerControlledLifetimeManager())
                         .RegisterType <ISuppliersService, SuppliersService>(new ContainerControlledLifetimeManager())
                         .RegisterType <ISuppliersRepository, SuppliersRepository>(new InjectionConstructor(connectionString))

                         .RegisterType <IProductsUC, ProductsUC>(new ContainerControlledLifetimeManager())
                         .RegisterType <IProductsDetailUC, ProductsDetailUC>(new ContainerControlledLifetimeManager())
                         .RegisterType <IProductsPresenter, ProductsPresenter>(new ContainerControlledLifetimeManager())
                         .RegisterType <IProductsDetailPresenter, ProductsDetailPresenter>(new ContainerControlledLifetimeManager())
                         .RegisterType <IProductsService, ProductsService>(new ContainerControlledLifetimeManager())
                         .RegisterType <IProductsRepository, ProductsRepository>(new InjectionConstructor(connectionString))

                         .RegisterType <IParametersUC, ParametersUC>(new ContainerControlledLifetimeManager())
                         .RegisterType <IParametersDetailUC, ParametersDetailUC>(new ContainerControlledLifetimeManager())
                         .RegisterType <IParametersPresenter, ParametersPresenter>(new ContainerControlledLifetimeManager())
                         .RegisterType <IParametersDetailPresenter, ParametersDetailPresenter>(new ContainerControlledLifetimeManager())
                         .RegisterType <IParametersService, ParametersService>(new ContainerControlledLifetimeManager())
                         .RegisterType <IParametersRepository, ParametersRepository>(new InjectionConstructor(connectionString))

                         .RegisterType <IImagesUC, ImagesUC>(new ContainerControlledLifetimeManager())
                         .RegisterType <IImagesDetailUC, ImagesDetailUC>(new ContainerControlledLifetimeManager())
                         .RegisterType <IImagesPresenter, ImagesPresenter>(new ContainerControlledLifetimeManager())
                         .RegisterType <IImagesDetailPresenter, ImagesDetailPresenter>(new ContainerControlledLifetimeManager())
                         .RegisterType <IImagesService, ImagesService>(new ContainerControlledLifetimeManager())
                         .RegisterType <IImagesRepository, ImagesRepository>(new InjectionConstructor(connectionString))

                         .RegisterType <IGroupsUC, GroupsUC>(new ContainerControlledLifetimeManager())
                         .RegisterType <IGroupsDetailUC, GroupsDetailUC>(new ContainerControlledLifetimeManager())
                         .RegisterType <IGroupsPresenter, GroupsPresenter>(new ContainerControlledLifetimeManager())
                         .RegisterType <IGroupsDetailPresenter, GroupsDetailPresenter>(new ContainerControlledLifetimeManager())
                         .RegisterType <IGroupsService, GroupsService>(new ContainerControlledLifetimeManager())
                         .RegisterType <IGroupsRepository, GroupsRepository>(new InjectionConstructor(connectionString))

                         .RegisterType <ICategoriesUC, CategoriesUC>(new ContainerControlledLifetimeManager())
                         .RegisterType <ICategoriesDetailUC, CategoriesDetailUC>(new ContainerControlledLifetimeManager())
                         .RegisterType <ICategoriesPresenter, CategoriesPresenter>(new ContainerControlledLifetimeManager())
                         .RegisterType <ICategoriesDetailPresenter, CategoriesDetailPresenter>(new ContainerControlledLifetimeManager())
                         .RegisterType <ICategoriesService, CategoriesService>(new ContainerControlledLifetimeManager())
                         .RegisterType <ICategoriesRepository, CategoriesRepository>(new InjectionConstructor(connectionString))

                         .RegisterType <IErrorMessageView, ErrorMessageView>(new ContainerControlledLifetimeManager())
                         .RegisterType <IDeleteConfirmView, DeleteConfirmView>(new ContainerControlledLifetimeManager())

                         .RegisterType <IParametersAgent, ParametersAgent>(new ContainerControlledLifetimeManager())
                         .RegisterType <IImagesAgent, ImagesAgent>(new ContainerControlledLifetimeManager())
                         .RegisterType <ISaverToCsvAgent, SaverToCsvAgent>(new ContainerControlledLifetimeManager())
                         .RegisterType <ISaverToXmlAgent, SaverToXmlAgent>(new ContainerControlledLifetimeManager())

                         .RegisterType <IStoreFacade, StoreFacade>(new ContainerControlledLifetimeManager());

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                IMainPresenter mainPresenter = UnityC.Resolve <MainPresenter>();
                IMainView      mainView      = mainPresenter.GetMainView();
                Application.Run((MainView)mainView);
            }
            catch (Exception)
            {
                MessageBox.Show("Помилка початкових налаштувань.");
            }
        }