I read this guide about the BackgroundWorker class.
I am trying to implement a reset button, so I added following code.
In Page.xaml:
<Button x:Name="buttonReset" Content="Reset" Click="buttonReset_Click"
Width="80" Height="30"/>
and in Page.cs:
private void buttonReset_Click(object sender, RoutedEventArgs e)
{
if (bw.WorkerSupportsCancellation == true)
{
bw.CancelAsync();
}
// How to restart?
bw.RunWorkerAsync(); // Raises busy exception
}
But I get following error:
From italian:
This BackgroundWorker is busy and couldn't execute more than one task in the same time
This exactly occurs only when I press Start a then Reset.
Why? And how to fix?