Ejemplo n.º 1
0
        private void buttonClickRightOnImage_Click(object sender, EventArgs e)
        {
            AutoIT au3  = new AutoIT();
            IntPtr hWnd = IntPtr.Zero;

            // Find define handle of project
            hWnd = AutoControl.FindWindowHandle(null, textBoxTestID.Text);

            if (hWnd == IntPtr.Zero)
            {
                MessageBox.Show("Không tìm thấy nhân vật này đang được chạy.");
                return;
            }

            var imagePath = textBoxTestPath.Text;

            var screen = CaptureHelper.CaptureWindow(hWnd);

            screen.Save("test.png");
            Bitmap iBtn = ImageScanOpenCV.GetImage(imagePath);
            var    pBtn = ImageScanOpenCV.FindOutPoint((Bitmap)screen, iBtn);

            if (pBtn != null)
            {
                au3.clickRight(textBoxTestID.Text, 1, pBtn.Value.X + int.Parse(numericUpDownTestX.Value.ToString()), pBtn.Value.Y + int.Parse(numericUpDownTestY.Value.ToString()));
                Thread.Sleep(Constant.TimeShort);
            }
        }
Ejemplo n.º 2
0
        public void WindowExistsUnitTest()
        {
            //Arrange
            string windowTitle      = "Generic Window Title";
            bool   expectedResponse = true;
            AutoIT a = new AutoIT();

            //Act
            bool response = a.CheckIfWindowExists(windowTitle);

            //Assert
            Assert.AreNotEqual(expectedResponse, response, String.Format("Test failed because a window exist with the title {0} somewhere.", windowTitle));
        }
Ejemplo n.º 3
0
        private void buttonClickRightOnPoint_Click(object sender, EventArgs e)
        {
            AutoIT au3  = new AutoIT();
            IntPtr hWnd = IntPtr.Zero;

            // Find define handle of project
            hWnd = AutoControl.FindWindowHandle(null, textBoxTestID.Text);

            if (hWnd == IntPtr.Zero)
            {
                MessageBox.Show("Không tìm thấy nhân vật này đang được chạy.");
                return;
            }

            au3.clickRight(textBoxTestID.Text, 1, int.Parse(numericUpDownTestX.Value.ToString()), int.Parse(numericUpDownTestY.Value.ToString()));
            Thread.Sleep(Constant.TimeShort);
        }