Beispiel #1
0
        private Form GetViewByName(string viewName)
        {
            if (views.ContainsKey(viewName))
            {
                return(views[viewName]);
            }

            switch (viewName)
            {
            case "indexView":
                IndexView indexView = new IndexView();
                views.Add(viewName, indexView);
                return(views[viewName]);

            case "setAdminView":
                SetAdminView setAdminView = new SetAdminView();
                views.Add(viewName, setAdminView);
                return(views[viewName]);

            case "contentView":
                ContentView contentView = new ContentView();
                views.Add(viewName, contentView);
                return(views[viewName]);

            default:
                return(null);
            }
        }
Beispiel #2
0
        public NavigationController(string databaseDriverName = "DatabaseDriver")
        {
            views       = new Dictionary <string, Form>();
            controllers = new Dictionary <string, Controller>();
            if (!InitDatabaseDriver(databaseDriverName))
            {
                ErrorMessageView errorMessageView = new ErrorMessageView(lastError, ErrorLevel.ErrorLevelSevere);
                errorMessageView.ShowDialog();
            }
            AccountController accountController = (AccountController)GetControllerByName("accountController");

            if (!accountController.IsAdminExists())
            {
                SetAdminView setAdminView = (SetAdminView)GetViewByName("setAdminView");
                setAdminView.AdminSet += SetAdminView_AdminSet;
                setAdminView.ShowDialog();
            }
            else
            {
                IndexView indexView = (IndexView)GetViewByName("indexView");
                indexView.Login += IndexView_Login;
                indexView.ShowDialog();
            }
        }