I want to provide a button which cancels the present task,
Let's say I want to perform the following task, which takes approximately 30 minutes
private void CaptureSignal()
{
// Capture Signal Code ......
}
I need to display a button which cancels the current task(any time during the process).
any suggestions...?
Thanks in advance...:)
If your capture is done inside main thread, try this:
bool abort = false;
private void CaptureSignal()
{
while (!abort) {
{
// Capture Signal Code ......
}
}
private void OnButtonClick(.............)
{
abort = true;
}
If you're using a BackgroundWorker you can send a cancellation request.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.