Пример #1
0
        /// <summary>
        /// All the variables are initialized here.
        /// </summary>
        private void Initialize()
        {
            //Other
            this.resultModelList = new List<ResultModel>();
            this.resultList = new ArrayList();

            //Model
            dbConnection = new ConnectionModel();

            //View
            this.mainForm = new MainForm();
            this.mainView = new MainView(this);
            this.adminLoginView = new AdminLoginView();
            this.inleesView = new InleesView(this);
            this.resultView = new ResultView(this);
            this.loadMapView = new LoadMapView(this);
            this.statisticView = new StatisticView(this);

            //Controller
            this.mainViewController = new MainViewController(this);
            this.inleesViewController = new InleesViewController(this);
            this.resultController = new ResultController(this);
            this.resultDialogController = new ResultDialogController(this);
            this.colonyController = new ColonyController();
            this.fileSelectController = new FileController(this);
            this.statisticController = new StatisticController(this);

            // ADD INLEESVIEW AND RESULTVIEW TO MAINVIEW
            this.mainViewController.AddToPage(inleesView, 0);
            this.mainViewController.AddToPage(resultView, 1);
            this.mainViewController.AddToPage(statisticView, 2);
            this.mainForm.Controls.Add(mainView);
            this.mainView.Dock = DockStyle.Fill;
            this.resultView.Dock = DockStyle.Fill;
            this.statisticView.Dock = DockStyle.Fill;

            // START APP
            Application.EnableVisualStyles();
            Application.Run(mainForm);
        }
Пример #2
0
        /// <summary>
        /// Creates the adminLoginView. The user can login with this view. If the password is correct, login. 
        /// If not, show error and rerun this method.
        /// </summary>
        public void OpenAdminLoginWindow()
        {
            using (AdminLoginView adminLoginView = new AdminLoginView())
            {
                TextBox wachtwoordTxtBox = adminLoginView.wachtwoordTxtBox;

                DialogResult result = adminLoginView.ShowDialog();

                if (result == DialogResult.OK)
                {
                    //Hard coded YOLO
                    if (wachtwoordTxtBox.Text == "admin")
                    {
                        LogInAdmin();
                    }
                    else
                    {
                        MessageBox.Show("U heeft een verkeerd wachtwoord ingevoerd, probeer het opnieuw!");
                        OpenAdminLoginWindow();
                    }
                }
            }
        }