/// <summary> /// Progress callback, called when we've read another packet of data. /// It get's the GUIs thread and calls pd /// </summary> private void Progress(ProgressDelegate pd, DownloadState ds) { if (this.InvokeRequired) { ProgressFormDelegate del = new ProgressFormDelegate(Progress); this.Invoke(del, new object[] { pd, ds }); } else { pd(ds); } }
/// <summary> /// Progress callback, called when we've read another packet of data. /// Used to set info in GUI on % complete & transfer rate. /// </summary> private void Progress(ProgressDelegate pd, RequestState ds) { if (ds.ctrl != null) { if (ds.ctrl.InvokeRequired) { ProgressFormDelegate del = new ProgressFormDelegate(Progress); try { ds.ctrl.Invoke(del, new object[] { pd, ds }); } catch (Exception e) { } } else { pd(ds); } } else { pd(ds); } }