private void 本地图片ToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog openDlg = new OpenFileDialog(); // 指定打开文本文件(后缀名为txt) openDlg.Filter = "图片文件(*.jpg,*.jpeg,*.png)|*.jpg;*.jpeg;*.png"; if (openDlg.ShowDialog() == DialogResult.OK) { this.textBox1.Text = "文件上传中,请稍等..."; var baidu = new BaiduSDK(); this.textBox1.Text = baidu.GeneralBasicDemo("file", openDlg.FileName); this.Show(); } }
public void Fun(object o) { //这里是你的操作代码,循环,根据条件退出while string result = ""; while (true) { var baidu = new BaiduSDK(); result = baidu.GeneralBasicDemo(this.type, this.path); break; } SetTextCallback cbd = o as SetTextCallback; //执行回调. cbd(result); }
private void ThreadProcSafe(string type) { var baidu = new BaiduSDK(); var result = baidu.GeneralBasicDemo(type, ""); }