예제 #1
0
 private void ContinueRun()
 {
     while (isContinueRun)
     {
         try
         {
             ICogImage  outimage = new CogImage8Grey();
             ICogRecord record;
             ArrayList  data = new ArrayList();
             Bitmap     image;
             image = ProgramOperation.ALT(MainHwnd);
             if (image == null)
             {
                 return;
             }
             Vision.Run(image, 1, out data, out outimage, out record);
             cogRecordDisplay1.Image  = outimage;
             cogRecordDisplay1.Record = record;
             this.Invoke(updatemethod, data);
             image.Dispose();
             Thread.Sleep(500);
             Application.DoEvents();
         }
         catch
         {
         }
     }
 }
예제 #2
0
        private void btnGetPicture_Click(object sender, EventArgs e)
        {
            Bitmap image;

            image = ProgramOperation.ALT(MainHwnd);
            if (image == null)
            {
                return;
            }
            image.Save(strFailCheck + TimeToFile() + ".png");
        }
예제 #3
0
 private void btnCheckHwnd_Click(object sender, EventArgs e)
 {
     if (ProgramOperation.CheckHwnd("冒险岛2 - 尬萌不限号", "", ref MainHwnd))
     {
         txtBoxHwnd.Text      = MainHwnd.ToString();
         btnCheckHwnd.Enabled = false;
     }
     else
     {
         btnStartGame.Enabled = true;
     }
 }
예제 #4
0
 private void btnHwndForward_Click(object sender, EventArgs e)
 {
     if (MainHwnd == IntPtr.Zero)
     {
         btnCheckHwnd.Enabled = true;
         return;
     }
     if (ProgramOperation.ForwardWindow(MainHwnd))
     {
         btnHwndForward.Enabled = false;
     }
     else
     {
         btnCheckHwnd.Enabled = true;
     }
 }
예제 #5
0
 private void btnStartGame_Click(object sender, EventArgs e)
 {
     if (txtBoxPath.Text == "")
     {
         btnChoosePath.Enabled = true;
         return;
     }
     pid = ProgramOperation.StartProgram(txtBoxPath.Text);
     if (pid != 0)
     {
         btnStartGame.Enabled = false;
     }
     else
     {
         btnChoosePath.Enabled = true;
     }
 }
예제 #6
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         ICogImage  outimage = new CogImage8Grey();
         ICogRecord record;
         ArrayList  data = new ArrayList();
         Bitmap     image;
         image = ProgramOperation.ALT(MainHwnd);
         if (image == null)
         {
             return;
         }
         Vision.Run(image, 0, out data, out outimage, out record);
         cogRecordDisplay1.Image  = outimage;
         cogRecordDisplay1.Record = record;
     }
     catch
     {
     }
 }
예제 #7
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;
        }
예제 #8
0
 private void btnFormMoveHide_Click(object sender, EventArgs e)
 {
     ProgramOperation.OutScreen(MainHwnd);
 }