Created
March 4, 2016 17:47
-
-
Save vitek999/30517db866665aef7072 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
namespace Test_Alpha_govnokod_ | |
{ | |
public partial class Form1 : Form | |
{ | |
//Переменные | |
string UserName; | |
int QuestionNumber = 0; | |
public int TrueAns; | |
string[] questionsArray = | |
{ | |
"Who are you?", | |
"what's new" | |
}; | |
int[] TrueAnsArray = { | |
4, 2, 1, 3, | |
}; | |
//Инициализация новой формы с логером | |
Form2 logger = new Form2(); | |
//Инициализация 1-ой формы | |
public Form1() | |
{ | |
InitializeComponent(); | |
logger.Show(); | |
LoadAllQuestion(QuestionNumber); | |
} | |
//Авторизация | |
private void button1_Click(object sender, EventArgs e) | |
{ | |
if (UserNameBox.Text == "") | |
{ | |
logger.ButLog("Error:[Bad User Name!];"); | |
} | |
else | |
{ | |
UserName = UserNameBox.Text; | |
string logmess = ("I: User: " + UserName + " was logged in successfully! "); | |
//вызов метода со второй формы для вывода лога (временный метод) | |
logger.ButLog(logmess); | |
tabControl1.SelectTab(1); | |
UserNameLabel1.Text = UserName; | |
UserNameLabel2.Text = UserName; | |
} | |
} | |
private void button2_Click(object sender, EventArgs e) | |
{ | |
tabControl1.SelectTab(2); | |
string logmess = ("I: Frame was loaded in successfuly"); | |
logger.ButLog(logmess); | |
} | |
public void LoadAllQuestion(int QuestionNumber) | |
{ | |
labelQuest.Text = questionsArray[QuestionNumber]; | |
TrueAns = TrueAnsArray[QuestionNumber]; | |
} | |
private void NextQuestion_Click(object sender, EventArgs e) | |
{ | |
int ButAns; | |
if (checkBox1.Checked) | |
{ | |
ButAns = 1; | |
} else if (checkBox2.Checked) | |
{ | |
ButAns = 2; | |
} else if (checkBox3.Checked) | |
{ | |
ButAns = 3; | |
} else | |
{ | |
ButAns = 4; | |
} | |
if (ButAns == TrueAns) | |
{ | |
MessageBox.Show("true"); | |
} | |
else | |
{ | |
MessageBox.Show("false"); | |
} | |
QuestionNumber++; | |
LoadAllQuestion(QuestionNumber); | |
checkBox1.Checked = false; | |
checkBox2.Checked = false; | |
checkBox3.Checked = false; | |
checkBox4.Checked = false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment