I have trouble to register a progress changed event. with the above error message from the question title.
Code:
public class AudioFileSearcher
{
public AudioFileSearcher(string searchPath, bool includeSubFolders, Views.SoundListView.SoundList parentView)
{
this.progress1 = new Progress<int>();
progress1.ProgressChanged += backgroundWorker1_ProgressChanged; //<- Error Here!
}
// void backgroundWorker1_ProgressChanged(object sender, EventArgs e) // also not working
void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
// Do something
}
public async Task FindAudioFiles(IProgress<int> progress)
{
foreach (string item in longItemList)
{
// do long operation
if (progress != null)
progress.Report(0);
}
}
}
Every single example and stack overflow question I checked states that the Issue lays in
void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
which would correctly be
void backgroundWorker1_ProgressChanged(object sender, EventArgs e) // also not working
other questions I checked about IProgress unfortunately all have incomplete or pseudo examples which do not work for me.