Exporting application progress changed event

Exporting application progress changed event

ahmed.elhawary73
Advocate Advocate
304 Views
0 Replies
Message 1 of 1

Exporting application progress changed event

ahmed.elhawary73
Advocate
Advocate

I have my application created with Windows Forms which exports Images from multiple family files to a specific path, I used background Worker to avoid application freeze and also to update the progress bar and progress percentage, 

 

 

 

public static  BackgroundWorker BGWORKER { get; set; }
 
// initialize my form
public Main_Form()
        {  InitializeComponent();
            BGWORKER = new BackgroundWorker();
            BGWORKER.DoWork += BGWORKER_DOWORK;
            BGWORKER.ProgressChanged += BGWORKER_ProgressChanged;
            BGWORKER.WorkerReportsProgress = true;
            BGWORKER.RunWorkerCompleted += BGWORKER_COMPLETED;
        }
//start button click event
private void StartBtn_Click(object sender, EventArgs e)
        {
 if (!BGWORKER.IsBusy)
                {
                    BGWORKER.RunWorkerAsync();
                }
       }
// do work event
 private async void BGWORKER_DOWORK(object sender, DoWorkEventArgs e)
        {
           
                ExtHand.Request = My_Requests.test;
                ExtEvent.Raise();
            
        }

//and inside my method I called for each file path
foreach (path in mypaths)
{
//do export method then

Main_Form.BGWORKER.ReportProgress(1);
}

 

 

 

and I got this error within the first loop

"This operation has already had OperationCompleted called on it and further calls are illegal"

 

any one can help please?

 

0 Likes
305 Views
0 Replies
Replies (0)