我正在尝试加载进度条表单,并且在加载时,如果我按下取消按钮,整个应用程序将停止它正在执行的任何操作。
下面是我调用进度条表单的代码。我想知道有人可以帮忙吗?
Loading loader = new Loading();
private void lockButton_Click(object sender, EventArgs e)
{
if (this.ddCheckBox.Checked == false)
{
if (this.passwordtextBox.Text == "")
{
MessageBox.Show("Please enter a password!");
}
else if (this.retypeTextBox.Text == "")
{
MessageBox.Show("Please retype password!");
}
else if (this.passwordtextBox.Text == this.retypeTextBox.Text)
{
//details = new Details();
details.SetPassword(this.passwordtextBox.Text);
if (this.EncryptionComboBox.Text == "AES - 128 bit" | this.EncryptionComboBox.Text == "AES - 192 bit" | this.EncryptionComboBox.Text == "AES - 256 bit")
{
this.Hide();
Thread thread = null;
thread = new Thread(new ThreadStart(delegate() { loader.dLabel.Text = "Locking Files..."; loader.ShowDialog(); }));
thread.Start();
details.SetEncryption(this.EncryptionComboBox.Text);