Exemplo n.º 1
0
        private void VisionRun(int index)
        {
            DateTime dtStart = DateTime.Now;

            //Run
            try
            {
                ArrayList data = new ArrayList();
                image2 = ProgramOperation.ALT(MainHwnd);
                if (image2 != null && image2 != image1)
                {
                    image1 = image2;
                }
                else
                {
                    return;
                }
                Vision.Run(image1, index, out data);
                switch (index)
                {
                case 0:
                    IsGameExit         = (bool)Vision.block.Outputs["GameExit"].Value;
                    IsCenterExit       = (bool)Vision.block.Outputs["CenterExit"].Value;
                    IsSearchButtonExit = (bool)Vision.block.Outputs["SearchButtonExit"].Value;
                    //IsExitInputName = (bool)Vision.block.Outputs["IsExitInputName"].Value;
                    SearchX     = Convert.ToInt32(Vision.block.Outputs["SearchX"].Value);
                    SearchY     = Convert.ToInt32(Vision.block.Outputs["SearchY"].Value);
                    InputX      = Convert.ToInt32(Vision.block.Outputs["InputX"].Value);
                    InputY      = Convert.ToInt32(Vision.block.Outputs["InputY"].Value);
                    BuyX        = Convert.ToInt32(Vision.block.Outputs["BuyX"].Value);
                    BuyY        = Convert.ToInt32(Vision.block.Outputs["BuyY"].Value);
                    InputCountX = Convert.ToInt32(Vision.block.Outputs["InputCountX"].Value);
                    InputCountY = Convert.ToInt32(Vision.block.Outputs["InputCountY"].Value);
                    CheckX      = Convert.ToInt32(Vision.block.Outputs["CheckX"].Value);
                    CheckY      = Convert.ToInt32(Vision.block.Outputs["CheckY"].Value);
                    YesX        = Convert.ToInt32(Vision.block.Outputs["YesX"].Value);
                    YesY        = Convert.ToInt32(Vision.block.Outputs["YesY"].Value);
                    MaxX        = Convert.ToInt32(Vision.block.Outputs["MaxX"].Value);
                    MaxY        = Convert.ToInt32(Vision.block.Outputs["MaxY"].Value);
                    FailCheckX  = Convert.ToInt32(Vision.block.Outputs["FailCheckX"].Value);
                    FailCheckY  = Convert.ToInt32(Vision.block.Outputs["FailCheckY"].Value);

                    break;

                case 1:
                    Parsedata(data);
                    break;

                case 2:
                    IsSearchOK = (bool)Vision.block.Outputs["IsSearchOK"].Value;
                    break;

                case 3:
                    IsBuyWindowShow = (bool)Vision.block.Outputs["IsBuyWindowShow"].Value;
                    break;
                }
                //cogRecordDisplay1.Image = outimage;
                //cogRecordDisplay1.Record = record;
                //UpdateGrid(data);
            }
            catch
            {
                timerUpdate.Stop();
                timerThread.Stop();
            }
            DateTime dtEnd    = DateTime.Now;
            TimeSpan diffTime = dtEnd - dtStart;

            CTinMm = diffTime.Milliseconds;
        }