C# BackgroundWorker
1. Masukkan BackgroundWorker ke dalam Windows Form. Search BackgroundWorker di Toolbox. Double click pada BackgroundWorker.
2. Invoke Cross-thread
BackgroundWorker - Cross-thread operation not valid
3. Start and Stop BackgroundWorker
private void btnStart_Click(object sender, RoutedEventArgs e)
{
worker.RunWorkerAsync();
}
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
worker.CancelAsync();
}
Sumber
- BackgroundWorker - Cross-thread operation not valid - https://stackoverflow.com/a/39009632/10763264
- How to use a BackgroundWorker? - https://stackoverflow.com/a/6481328/10763264
- Cancelling the BackgroundWorker - https://www.wpf-tutorial.com/misc/cancelling-the-backgroundworker/
Ulasan