private void Result() { if (isEnded) { Close(); return; } isEnded = true; SQLData.Q1 = KettelTest.GetAnswer(KettelTest.Type.Q1); SQLData.B = KettelTest.GetAnswer(KettelTest.Type.B); SQLData.Q3 = KettelTest.GetAnswer(KettelTest.Type.Q3); SQLData.Q4 = KettelTest.GetAnswer(KettelTest.Type.Q4); SQLData.math_result = MathematicalTest.GetAnswer(); SQLData.math_time = MathematicalTest.GetBonusTime(); SQLData.memory_count = MemoryTest.GetAnswer(); SQLData.encryption_count = EncryptionTest.answersCount; SQLData.miss_count = MissingDetailsTest.GetAnswer(); SQLScripts.SetAnswers(); SQLScripts.RemoveUser(); this.Size = new Size(900, 700); ResultView view = new ResultView(); view.AddElement(); view.AlignX(); missingDetailsElement?.Hide(); AlignElements(); }
public ResultView() { userNameLabel = new Label(); userNameLabel.AutoSize = true; userNameLabel.Text = "Спасибо за уделенное время!"; userNameLabel.TabIndex = 0; Program.mainForm.Controls.Add(userNameLabel); userNameLabel.Location = new System.Drawing.Point((Program.mainForm.Size.Width - userNameLabel.Size.Width) / 2, 50); userNameLabel = new Label(); kettelLabel = new Label(); mathLabel = new Label(); memoryLabel = new Label(); encryptionLabel = new Label(); missLabel = new Label(); labelList = new List <Label>() { userNameLabel, kettelLabel, mathLabel, memoryLabel, encryptionLabel, missLabel }; int x = 0, y = 70; userNameLabel.Text = SQLData.user_name; kettelLabel.MaximumSize = new System.Drawing.Size(650, 1000); kettelLabel.Text = "Результат по фактору " + KettelTest.Type.B.ToString() + " " + KettelTest.GetAnswer(KettelTest.Type.B) + "\n" + BriefDescription.GetDescription(KettelTest.Type.B) + "\n" + "Результат по фактору " + KettelTest.Type.Q1.ToString() + " " + KettelTest.GetAnswer(KettelTest.Type.Q1) + "\n" + BriefDescription.GetDescription(KettelTest.Type.Q1) + "\n" + "Результат по фактору " + KettelTest.Type.Q3.ToString() + " " + KettelTest.GetAnswer(KettelTest.Type.Q3) + "\n" + BriefDescription.GetDescription(KettelTest.Type.Q2) + "\n" + "Результат по фактору " + KettelTest.Type.Q4.ToString() + " " + KettelTest.GetAnswer(KettelTest.Type.Q4) + "\n" + BriefDescription.GetDescription(KettelTest.Type.Q4) + "\n"; mathLabel.Text = "Результат по арифметической части " + MathematicalTest.GetAnswer() + "/" + MathematicalTest.questions.Count; //+ " бонусное время : " + MathematicalTest.GetBonusTime(); memoryLabel.Text = "Результат по тесту \"Ряды\"" + MemoryTest.GetAnswer().ToString() + " запомненых цифр"; encryptionLabel.Text = "Результат по тесту \"Шифрование\"" + EncryptionTest.answersCount.ToString() + " правильных расшифровок"; missLabel.Text = "Результат по тесту \"Недостащие детали\"" + MissingDetailsTest.GetAnswer().ToString() + "/" + MissingDetailsTest.GetInfo().Count; for (int i = 0; i < LABEL_COUNT; i++) { labelList[i].AutoSize = true; labelList[i].Location = new Point(x, y); labelList[i].TabIndex = 0; y += 40; if (i == 1) { y += 200; } } AlignX(); }