private void WorkAsyncWithCancel(WorkAsyncInfo info) { WorkAsync(new WorkAsyncInfo { AsyncArgument = info.AsyncArgument, Host = info.Host, IsCancelable = info.IsCancelable, Message = info.Message, MessageHeight = info.MessageHeight, MessageWidth = info.MessageWidth, PostWorkCallBack = (args) => { if (InvokeRequired) { Invoke((Action)(() => { tsbStop.Enabled = false; })); } else { tsbStop.Enabled = false; } info.PostWorkCallBack(args); }, ProgressChanged = info.ProgressChanged, Work = (worker, args) => { if (InvokeRequired) { Invoke((Action)(() => { tsbStop.Enabled = true; })); } else { tsbStop.Enabled = true; } info.Work(worker, args); } }); }