Skip to content

DevExpress-Examples/winforms-wait-form-cancel-operation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinForms Wait Form - How to cancel a time-consuming operation

This example shows how to close the Wait Form to cancel a time-consuming operation:

  • Add a GridControl onto the Form.

  • Place a BackgroundWorker component onto the Form and handle its RunWorkerCompleted and DoWork events.

  • Place a SplashScreenManager component onto the Form.

  • Invoke the SplashScreen Manager's smart tag menu and add a Wait Form.

  • Add a Load Data button onto the Form and handle its Click event to load data and display a wait form.

    private void simpleButton1_Click(object sender, EventArgs e) {
        Person.counter = 0;
        backgroundWorker1.RunWorkerAsync(locker1);
    
        splashScreenManager1.ShowWaitForm();
        splashScreenManager1.SendCommand(WaitForm1.WaitFormCommand.SendObject, locker1);
    }
  • Open the WaitForm designer and add a Cancel button.

  • Handle the Cancel button's Click event to cancel the operation:

    private void simpleButton1_Click(object sender, EventArgs e) {
        if (locker != null)
            ((ILocked)locker).IsCanceled = true;
    }

Files to Review

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)