private void AddRows(int from, int to) { var operation = new InsertRowsOperation(this, from, to); var form = new ProgressBarForm(); var insert = new RowInsertCounter(form); operation.Progress += insert.Add; operation.Cancelled += delegate { InvalidateGrid(); }; operation.Completed += delegate { InvalidateGrid(); }; operation.Failed += delegate { InvalidateGrid(); }; new ExecuteWithProgressBar(operation, form).Run(); }