Esempio n. 1
0
        static void Main()
        {
            string dataDir;

#if DEBUG
            dataDir = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\.."));
#else
            dataDir = AppDomain.CurrentDomain.BaseDirectory;
#endif
            AppDomain.CurrentDomain.SetData("DataDirectory", dataDir);


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

            IShopModel     shopModel      = new ShopModel(new ShopDBFactory());
            MainController mainController = new MainController(shopModel);

            IBaseController registerContoller     = new RegisterController(shopModel, new RegisterForm("RegisterForm"));
            IBaseController loginController       = new LoginController(shopModel, new LoginForm("LoginForm"));
            IBaseController shopProductsContoller = new ShopProductsController(shopModel, new ShopProductsMainForm("ShopProductsForm"));

            IBaseController selectController = new SelectController(shopModel, new SelectControl("SelectControl"));
            IBaseController insertController = new InsertController(shopModel, new InsertControl("InsertControl"));
            IBaseController updateController = new UpdateController(shopModel, new UpdateControl("UpdateControl"));
            IBaseController deleteController = new DeleteController(shopModel, new DeleteControl("DeleteControl"));
            IBaseController cartController   = new CartController(shopModel, new CartControl("CartControl"));

            mainController.AddControler(registerContoller);
            mainController.AddControler(loginController);
            mainController.AddControler(shopProductsContoller);

            ((ShopProductsController)shopProductsContoller).AddPage(selectController, "Все товары");
            ((ShopProductsController)shopProductsContoller).AddPage(insertController, "Добавление");
            ((ShopProductsController)shopProductsContoller).AddPage(updateController, "Изменение");
            ((ShopProductsController)shopProductsContoller).AddPage(deleteController, "Удаление");
            ((ShopProductsController)shopProductsContoller).AddPage(cartController, "Корзина");



            mainController.Start(loginController);



            Application.Run();
        }