public void WorkAsync(WorkAsyncInfo info) { if (info.Host == null) { throw new NullReferenceException("WorkAsyncInfo Host property is null!"); } _infoPanel = InformationPanel.GetInformationPanel(info.Host, info.Message, info.MessageWidth, info.MessageHeight); _worker = new BackgroundWorker { WorkerReportsProgress = info.ProgressChanged != null, WorkerSupportsCancellation = info.IsCancelable }; _worker.DoWork += info.PerformWork; if (_worker.WorkerReportsProgress && info.ProgressChanged != null) { _worker.ProgressChanged += info.PerformProgressChange; } if (info.PostWorkCallBack != null) { _worker.RunWorkerCompleted += (s, e) => { if (info.Host.Controls.Contains(_infoPanel)) { _infoPanel.Dispose(); info.Host.Controls.Remove(_infoPanel); } info.PostWorkCallBack(e); }; } _worker.RunWorkerAsync(info.AsyncArgument); }
public void WorkAsync(WorkAsyncInfo info) { if (info.Host == null) { throw new NullReferenceException("WorkAsyncInfo Host property is null!"); } _infoPanel = InformationPanel.GetInformationPanel(info.Host, info.Message, info.MessageWidth, info.MessageHeight); _worker = new BackgroundWorker { WorkerReportsProgress = info.ProgressChanged != null, WorkerSupportsCancellation = info.IsCancelable }; _worker.DoWork += info.PerformWork; if (_worker.WorkerReportsProgress && info.ProgressChanged != null) { _worker.ProgressChanged += info.PerformProgressChange; } _worker.RunWorkerCompleted += (s, e) => { if (info.Host.Controls.Contains(_infoPanel)) { _infoPanel.Dispose(); info.Host.Controls.Remove(_infoPanel); } if (info.PostWorkCallBack != null) { info.PostWorkCallBack(e); } }; _worker.RunWorkerAsync(info.AsyncArgument); }
public void WorkAsync(WorkAsyncInfo info) { info.Host = this; _worker = new Worker(); _worker.WorkAsync(info); OnWorkAsync?.Invoke(this, new EventArgs()); }
public void WorkAsync(string message, Action<DoWorkEventArgs> work, object argument = null, int messageWidth = 340, int messageHeight = 150) { var info = new WorkAsyncInfo(message, work) { AsyncArgument = argument, Host = this, MessageWidth = messageWidth, MessageHeight = messageHeight }; WorkAsync(info); }
public void WorkAsync(string message, Action<DoWorkEventArgs> work, Action<RunWorkerCompletedEventArgs> callback, object argument = null, int messageWidth = 340, int messageHeight = 150) { var info = new WorkAsyncInfo(message, work) { AsyncArgument = argument, Host = this, MessageWidth = messageWidth, MessageHeight = messageHeight, PostWorkCallBack = callback }; WorkAsync(info); }
public void WorkAsync(string message, Action <BackgroundWorker, DoWorkEventArgs> work, object argument, bool enableCancellation, int messageWidth, int messageHeight) { var info = new WorkAsyncInfo(message, work) { AsyncArgument = argument, Host = this, IsCancelable = enableCancellation, MessageWidth = messageWidth, MessageHeight = messageHeight }; _worker.WorkAsync(info); }
public void WorkAsync(string message, Action<BackgroundWorker, DoWorkEventArgs> work, Action<RunWorkerCompletedEventArgs> callback, object argument, bool enableCancellation, int messageWidth, int messageHeight) { var info = new WorkAsyncInfo(message, work) { AsyncArgument = argument, Host = this, IsCancelable = enableCancellation, MessageWidth = messageWidth, MessageHeight = messageHeight, PostWorkCallBack = callback }; WorkAsync(info); }
public void WorkAsync(string message, Action <BackgroundWorker, DoWorkEventArgs> work, Action <RunWorkerCompletedEventArgs> callback, Action <ProgressChangedEventArgs> progressChanged, object argument = null, int messageWidth = 340, int messageHeight = 150) { var info = new WorkAsyncInfo(message, work) { AsyncArgument = argument, Host = this, MessageWidth = messageWidth, MessageHeight = messageHeight, PostWorkCallBack = callback, ProgressChanged = progressChanged }; _worker.WorkAsync(info); }
public void WorkAsync(WorkAsyncInfo info) { info.Host = this; _worker.WorkAsync(info); }
public void WorkAsync(WorkAsyncInfo info) { info.Host = this; _worker.WorkAsync(info); }