private void btnStart_Click(object sender, EventArgs e) { try { if (this.basicHMPath.Text.Length > 1||this.groupHMPath.Text.Length>0) { this.MCScreen.Clear(); this.btnStart.Enabled = false; this.btnBrowse.Enabled = false; //GroupHM String TaskType = ConfigurationManager.AppSettings["TaskType"]; if (TaskType == "GroupHM")//执行组合产品的初始化 { GroupDataProcess process = new GroupDataProcess(this.groupHMPath.Text); process.OperateNotify += HM_OperateNotify;//关联委托 Thread t = new Thread(new ThreadStart(process.StartProcess)); t.Start(); } else//执行基础产品的初始化 { DataProcess process = new DataProcess(this.basicHMPath.Text); process.OperateNotify += HM_OperateNotify;//关联委托 Thread t = new Thread(new ThreadStart(process.StartProcess)); t.Start(); } //this.txtBoxResult.AppendText(prints); } else MessageBox.Show(" 请选择文件!"); } catch (Exception ex) { this.MCScreen.AppendText(ex.Message); //注意 ,如果用多线程,子线程出来一场,主线程压根不会捕获到,所以必须在子线程里面再try catch。。。 //Lee 2013年12月12日16:37:36 HMLog.Error(ex.Message); HMLog.Error(ex.StackTrace); HMLog.Error(ex.Source); HMLog.Error(""); } }
/// <summary> /// 获取颜色列表信息,提交给Larfier筛选 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnMaterial_Click(object sender, EventArgs e) { if (this.basicHMPath.Text.Length > 1) { DataProcess process = new DataProcess(this.basicHMPath.Text, this.groupHMPath.Text); process.OperateNotify += HM_OperateNotify;//关联委托 Thread t = new Thread(new ThreadStart(process.GetMaterialList)); t.Start(); } else { MessageBox.Show(" 请选择文件!"); } }