Пример #1
0
        private void LoginTry()
        {
            string user = usernameText.Text;
            string pass = passwordText.Text;
            bool   a    = login.LoginUser(user, pass);

            if (a)
            {
                ProfileControl pr = new ProfileControl();
                pr.Dock = DockStyle.Fill;
                this.Controls.Clear();
                this.Controls.Add(pr);

                MainForm m = (MainForm)this.FindForm();
                m.SetLoginButtonText();
            }
            else
            {
                usernameText.Clear();
                passwordText.Clear();
            }
        }
Пример #2
0
        private void ChangePanel(string name)
        {
            mainPanel.Controls.Clear();
            switch (name)
            {
            case "createQuiz":
                if (Login.Login.userID != -1)
                {
                    CreateQuizControl c = new CreateQuizControl();
                    c.Dock = DockStyle.Fill;
                    mainPanel.Controls.Add(c);
                }
                else
                {
                    GoToLoginPanel();
                }
                break;

            case "categories":
                SearchControl d = new SearchControl
                {
                    Dock = DockStyle.Fill
                };
                mainPanel.Controls.Add(d);
                break;

            case "feelLucky":
                QuizPanel e = new QuizPanel(new QuizPlayerController(new QuizHandler.FeelLucky().GetARandomQuiz(10)));
                e.Dock = DockStyle.Fill;
                mainPanel.Controls.Add(e);
                break;

            case "profile":
                if (LoginStatusData.userID != 0)
                {
                    ProfileControl f = new ProfileControl();
                    f.Dock = DockStyle.Fill;
                    mainPanel.Controls.Add(f);
                }
                else
                {
                    GoToLoginPanel();
                }
                break;

            case "feedback":
                if (LoginStatusData.userID != 0)
                {
                    FeedbackControl g = new FeedbackControl();
                    g.Dock = DockStyle.Fill;
                    mainPanel.Controls.Add(g);
                }
                else
                {
                    GoToLoginPanel();
                }
                break;

            default:
                Console.WriteLine("No control selected");
                break;
            }
        }