private void button2_Click(object sender, EventArgs e) { name = comboBox1.Text; FileStream aFile = new FileStream("StuNum.txt", FileMode.Create); StreamWriter sw = new StreamWriter(aFile); sw.WriteLine(textBox1.Text); sw.Close(); aFile = new FileStream("Password.txt", FileMode.Create); sw = new StreamWriter(aFile); sw.WriteLine(textBox2.Text); sw.Close(); StuNumber = textBox1.Text.Trim(); if (button2.Text == "激活离线练习") { if (MessageBox.Show("没有找到题库,是否帮助您下载一份?(需要联网)", "", MessageBoxButtons.YesNo) == DialogResult.Yes) { button2.Text = "正在下载"; DownloadFolder.downftp("ftp://202.118.26.80", "ChoiceSource", Directory.GetCurrentDirectory()); button2.Text = "离线练习"; MessageBox.Show("传输完毕"); } else { if (Directory.Exists("ChoiceSource")) { button2.Text = "离线练习"; } } } else { StuNumber = textBox1.Text; base.DialogResult = DialogResult.No; } }