private void btnStart_Click(object sender, EventArgs e) { if (cbZLDW.Checked == false) { if (this.cbxDT.Text == "") { MessageBox.Show("目标帮会地图还没选"); return; } if (this.cbxNPC.Text == "") { MessageBox.Show("自动寻路NPC还没选"); return; } if (this.cbxSDIndex.Text == "") { MessageBox.Show("第几个属地还没选"); return; } } try { this.cbxDT.Enabled = false; this.cbxNPC.Enabled = false; this.cbxSDIndex.Enabled = false; this.btnStop.Enabled = true; string toPath = ""; string xlPath=""; string xlNpcPath = ""; int sdIndex = 0; if (cbZLDW.Checked == false) { toPath = "驿站_前往" + cbxDT.Text + ".bmp"; xlPath = ((XLNPC)this.cbxNPC.SelectedItem).XlNpc; xlNpcPath = ((XLNPC)this.cbxNPC.SelectedItem).NPC; sdIndex = int.Parse(this.cbxSDIndex.Text); } ThreadParam p = new ThreadParam(toPath, xlPath, xlNpcPath, sdIndex); //DoWork(p); ParameterizedThreadStart ps = new ParameterizedThreadStart(DoWork); worker = new Thread(ps); worker.Start(p); } catch (Exception ex) { MessageBox.Show(ex.Message); } this.Text = "专利"; }
private void btnStartPS_Click(object sender, EventArgs e) { Func.Log("StartPS"); if (this.cbxDT.Text == "") { MessageBox.Show("目标帮会地图还没选"); return; } if (this.cbxNPC.Text == "") { MessageBox.Show("自动寻路NPC还没选"); return; } if (this.cbxSDIndex.Text == "") { MessageBox.Show("第几个属地还没选"); return; } try { if (txtDtStr.Text.Trim() == "") { MessageBox.Show("你没有填写答题账号,无法自动答题,不能跑商"); return; } string toPath = cbxDT.Text ; string xlPath = ((XLNPC)this.cbxNPC.SelectedItem).XlNpc; string xlNpcPath = ((XLNPC)this.cbxNPC.SelectedItem).NPC; int sdIndex = int.Parse(this.cbxSDIndex.Text); ThreadParam p = new ThreadParam(toPath, xlPath, xlNpcPath, sdIndex); //DoWork(p); ParameterizedThreadStart ps = new ParameterizedThreadStart(PSThread); worker = new Thread(ps); worker.Start(p); this.Invoke(DelegateSetControl, new object[] { gbSetting, false }); this.Invoke(DelegateSetControl, new object[] { gbStart, false }); } catch (Exception ex) { MessageBox.Show(ex.Message); } this.Text = "跑商"; }