以下のようなボタンがあります。
private void btnStartAdventure_Click(object sender, EventArgs e)
{
if (backgroundWorker5.IsBusy)
{
btnStartAdventures.Enabled = false;
lblStatusValueInAdventures.Text = "Canceling...";
backgroundWorker5.CancelAsync();
}
else
{
txtLogInAdventures.Text = string.Empty;
btnStartAdventures.Text = "Cancel";
lblUsersDoneCountValueInAdventures.Text = "---";
lblStatusValueInAdventures.Text = "Running...";
backgroundWorker5.RunWorkerAsync();
}
}
仕事btnStartAdventure_Click
が終わったらまたイベントを呼びたい!
そのため、終わりのないループが発生します。
置いた: backgroundWorker_RunWorkerCompleted
Thread.Sleep(3600000);
の終わりにbackgroundWorker_RunWorkerCompleted()
。今、私は再び
呼び出すためにどのコードを使用する必要がありますか?
タイマーは私の目的に適していますか?
その仕事をすることでハングやクラッシュを防ぐにはどうすればよいですか? btnStartAdventure_Click
前もって感謝します