コード例 #1
0
        private bool CheckField()
        {
            bool temp = true;

            if (txtTitle.Text == "")
            {
                errorProvider1.SetError(txtTitle, "Please, Insert the Title...!");
                txtTitle.Focus();
                temp = false;
            }

            if (CountQuestion.Text == "")
            {
                errorProvider1.SetError(CountQuestion, "Please, Insert the Count of Question...!");
                CountQuestion.Focus();
                temp = false;
            }

            if (txtDuration.Text == "")
            {
                errorProvider1.SetError(txtDuration, "Please, Insert the Duration...!");
                txtDuration.Focus();
                temp = false;
            }

            return(temp);
        }
コード例 #2
0
        public TestControlVM(IRepo repo, int roleId, View.TestControlV view)
        {
            _repo = repo;
            _view = view;
            if (roleId == 1)
            {
                StackVisible   = Visibility.Visible;
                Content        = "Создать";
                OpenCommandCmd = new RelayCommand(CreateTest);
            }
            if (roleId == 2)
            {
                StackVisible   = Visibility.Collapsed;
                Content        = "Начать тест";
                OpenCommandCmd = new RelayCommand(LoginTest);
            }
            int count = _repo.CountQuestion();

            for (int i = 1; i <= count; i++)
            {
                CountQuestion.Add(i);
            }
        }