-1
我怎樣才能顯示自定義的背景工人的取消事件取消消息背景工人自取消消息
我使用DoWork的事件下面的代碼取消工人
string custom_cancel_msg="Cancelling BG WORKER due to some xxx reeasons";
if (bw.WorkerSupportsCancellation == true)
{
bw.CancelAsync();
}
我該怎麼讓這在完成的事件。我只能訪問下面的事情
if ((e.Cancelled == true))
{
lblMessage.Text = "Transaction Canceled in between!";
//HOW CA|N I ACCESS THE CUSTOM MESSA|GE HERE??????????????????
}
else if (!(e.Error == null))
{
lblMessage.Text = ("Error: " + e.Error.Message);
}
else
{
lblMessage.Text = "Done!";
}
這將幫助,如果你表現出多一點的上下文,但你的代碼相同的課程的一部分? –
在** Form **級別聲明'custom_cancel_msg',而不是本地變量。 –