private void simpleButton_start_Click(object sender, EventArgs e) { if (simpleButton_start.Text == "选择") { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.OK) { textEdit_dir.Text = ofd.FileName; simpleButton_start.Text = "开始"; } } else if (simpleButton_start.Text == "开始") { simpleButton_start.Enabled = false; PcapAnalysis analysis = new PcapAnalysis(this); ThreadCallBack tcb = new ThreadCallBack(analysis.initAnalysis); IAsyncResult result = tcb.BeginInvoke(new AsyncCallback(CallBackFun), null); } }
public void CallBackFun(IAsyncResult result) { ThreadCallBack tcb = (ThreadCallBack)((AsyncResult)result).AsyncDelegate; simpleButton_start.Enabled = true; }
public InfluxDBThreadTask(HttpInfluxDBClient influxDBClient, DBOptsType type, string database, string sql, ThreadCallBack threadCallBack) { this.influxDBClient = influxDBClient; this.type = type; this.database = database; this.sql = sql; this.threadCallBack = threadCallBack; }