private void stream_OnProgressStarted(object sender, IStreamEventArgs e) { if (InvokeRequired) { BeginInvoke(new MethodInvoker(() => { stream_OnProgressStarted(sender, e); })); return; } try { progressBar.Value = 0; string methodName = e.Stream.Attributes["MethodName"]; listView_AddItem(methodName, "Started", e.Stream.FileId); } catch (Exception exception) { MessageBox.Show(this, "Exception - " + exception.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void stream_OnProgressChanged(object sender, IStreamEventArgs e) { if (InvokeRequired) { BeginInvoke(new MethodInvoker(() => { stream_OnProgressChanged(sender, e); })); return; } try { progressBar.Value = e.Stream.PercentCompleted; string methodName = e.Stream.Attributes["MethodName"]; listView_AddItem(methodName, "Processing " + e.Stream.PercentCompleted + "...", e.Stream.FileId); if (_isCancelling) { e.Stream.Cancel(); _isCancelling = false; } } catch (Exception exception) { MessageBox.Show(this, "Exception - " + exception.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }