Exemple #1
0
        public TranslateForm(Question question, TrainingForm parentForm)
        {
            _question   = question;
            _parentForm = parentForm;
            InitializeComponent();
            Controls.Add(_tempLabel);

            QuestionLabel.Text     = question.EnglishText;
            QuestionLabel.Location = new Point(10, 20);

            QuestionTranslateTextBox.Text     = question.RussianText;
            QuestionTranslateTextBox.Location = new Point(QuestionLabel.Location.X, QuestionLabel.Location.Y + QuestionLabel.Height + 10);

            _answers.AddRange(new List <KeyValuePair <TextBox, TextBox> >
            {
                new KeyValuePair <TextBox, TextBox>(AnswerLabel1, AnswerTextBox1),
                new KeyValuePair <TextBox, TextBox>(AnswerLabel2, AnswerTextBox2),
                new KeyValuePair <TextBox, TextBox>(AnswerLabel3, AnswerTextBox3),
                new KeyValuePair <TextBox, TextBox>(AnswerLabel4, AnswerTextBox4),
                new KeyValuePair <TextBox, TextBox>(AnswerLabel5, AnswerTextBox5)
            });
            for (var i = 0; i < question.Answers.Count; i++)
            {
                var key   = _answers[i].Key;
                var value = _answers[i].Value;
                key.Text      = question.Answers[i].EnglishText;
                value.Text    = question.Answers[i].RussianText;
                key.Visible   = true;
                value.Visible = true;
                if (i == 0)
                {
                    key.Location = new Point(QuestionTranslateTextBox.Location.X,
                                             QuestionTranslateTextBox.Location.Y + QuestionTranslateTextBox.Height + 30);
                }
                else
                {
                    var previousElement = _answers[i - 1].Value;
                    key.Location = new Point(previousElement.Location.X, previousElement.Location.Y + previousElement.Height + 20);
                }
                value.Location = new Point(key.Location.X, key.Location.Y + key.Height + 10);
                if (i == question.Answers.Count - 1)
                {
                    var last = _answers[i].Value;
                    SaveButton.Location = new Point(last.Location.X + 300, last.Location.Y + last.Height + 20);
                }
            }
        }
Exemple #2
0
        private void startTraining_Click(object sender, EventArgs e)
        {
            var button = ((Button)sender);
            var text   = button.Text;

            button.Text      = @"Открываю ...";
            button.BackColor = Color.FromArgb(58, 180, 115);
            Enabled          = false;
            var form = new TrainingForm(this);

            Hide();
            form.Show();
            form.Activate();
            button.Text      = text;
            button.BackColor = _buttonBackColor;
            Enabled          = true;
        }