예제 #1
0
        private void PlantingThread()
        {
            try
            {
                f = new Func();
                f.SetDMPath(PicPath);
                Thread.Sleep(500);
                int pid = 0, handle = 0;
               // int plantIndex=this.Invoke(delegate(){return int.Parse(this.cbxPlantIndex.Text.Trim());});
               int plantIndex= int.Parse(this.Invoke(new GetControlText(delegate(Control c) { return c.Text; }),new object[]{this.cbxPlantIndex}).ToString());

                if (this.txtPID.Text.Trim() != "")
                {
                    pid = int.Parse(txtPID.Text.Trim());
                }
                if (this.txtHandle.Text.Trim() != "")
                {
                    handle = int.Parse(txtHandle.Text.Trim());
                }
                f.BindDM(ClassName, pid, handle);
                Thread.Sleep(3000);
                int x=0, y=0;
                f.ReadyToPlanting(ref x, ref y);//调整稻草人窗口到,x,y
                while (true)
                {
                    f.Planting(plantIndex,x,y);
                }
            }
            catch (Exception ex)
            {
                this.Invoke(delegateShowMsg, new object[] { ex.Message });
            }
        }