日期:2014-05-18 浏览次数:20976 次
private void ax_OnAttTransactionEx(object sender, Axzkemkeeper._IZKEMEvents_OnAttTransactionExEvent e) { //.... }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Threading.UI.Winforms { public partial class BackgroundWorkerBadExample : Form { public BackgroundWorkerBadExample() { InitializeComponent(); } private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { try { for (int i = 0; i < (int)e.Argument; i++) { txtResults.Text += string.Format( "processing {0}\r\n", i.ToString()); } } catch (InvalidOperationException oex) { MessageBox.Show(oex.Message); } } private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { MessageBox.Show("Completed background task"); } private void btnGo_Click(object sender, EventArgs e) { backgroundWorker1.RunWorkerAsync(100); } } }