示例#1
0
        private void worldTimer_Tick(object sender, EventArgs e)
        {
            gameWorld.Update();

            gameWorldPicturebox.Invalidate();
            UIPictureBox.Invalidate();
        }
        public override List <Control> Render(IfrmCommandEditor editor, ICommandControls commandControls)
        {
            base.Render(editor, commandControls);

            UIPictureBox imageCapture = new UIPictureBox();

            imageCapture.Width  = 200;
            imageCapture.Height = 200;
            imageCapture.DataBindings.Add("EncodedImage", this, "v_ImageCapture", false, DataSourceUpdateMode.OnPropertyChanged);

            RenderedControls.Add(commandControls.CreateDefaultLabelFor("v_ImageCapture", this));
            RenderedControls.AddRange(commandControls.CreateUIHelpersFor("v_ImageCapture", this, new Control[] { imageCapture }, editor));
            RenderedControls.Add(imageCapture);

            _imageActionDropdown = (ComboBox)commandControls.CreateDropdownFor("v_ImageAction", this);
            RenderedControls.Add(commandControls.CreateDefaultLabelFor("v_ImageAction", this));
            RenderedControls.AddRange(commandControls.CreateUIHelpersFor("v_ImageAction", this, new Control[] { _imageActionDropdown }, editor));
            _imageActionDropdown.SelectionChangeCommitted += ImageAction_SelectionChangeCommitted;
            RenderedControls.Add(_imageActionDropdown);

            _imageParameterControls = new List <Control>();
            _imageParameterControls.Add(commandControls.CreateDefaultLabelFor("v_ImageActionParameterTable", this));
            _imageParameterControls.AddRange(commandControls.CreateUIHelpersFor("v_ImageActionParameterTable", this, new Control[] { _imageGridViewHelper }, editor));
            _imageParameterControls.Add(_imageGridViewHelper);
            RenderedControls.AddRange(_imageParameterControls);

            RenderedControls.AddRange(commandControls.CreateDefaultInputGroupFor("v_MatchAccuracy", this, editor));

            return(RenderedControls);
        }
示例#3
0
        private void RunImageCapture(object sender, EventArgs e)
        {
            //get input control
            CommandItemControl inputBox         = (CommandItemControl)sender;
            UIPictureBox       targetPictureBox = (UIPictureBox)inputBox.Tag;
            string             imageSource      = targetPictureBox.EncodedImage;

            if (string.IsNullOrEmpty(imageSource))
            {
                MessageBox.Show("Please capture an image before attempting to test!");
                return;
            }

            //hide all
            HideAllForms();

            try
            {
                //run image recognition
                SurfaceAutomationCommand surfaceAutomationCommand = new SurfaceAutomationCommand();
                surfaceAutomationCommand.v_ImageCapture = imageSource;
                surfaceAutomationCommand.TestMode       = true;
                surfaceAutomationCommand.RunCommand(null);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.ToString());
            }
            //show all forms
            ShowAllForms();
        }
        public override List <Control> Render(IfrmCommandEditor editor)
        {
            base.Render(editor);

            UIPictureBox imageCapture = new UIPictureBox();

            imageCapture.Width  = 200;
            imageCapture.Height = 200;
            imageCapture.DataBindings.Add("EncodedImage", this, "v_ImageCapture", false, DataSourceUpdateMode.OnPropertyChanged);

            RenderedControls.Add(CommandControls.CreateDefaultLabelFor("v_ImageCapture", this));
            RenderedControls.AddRange(CommandControls.CreateUIHelpersFor("v_ImageCapture", this, new Control[] { imageCapture }, editor));
            RenderedControls.Add(imageCapture);

            RenderedControls.AddRange(CommandControls.CreateDefaultOutputGroupFor("v_OutputUserVariableName", this, editor));

            return(RenderedControls);
        }
示例#5
0
        private void ShowImageCapture(object sender, EventArgs e)
        {
            ApplicationSettings settings = new ApplicationSettings().GetOrCreateApplicationSettings();
            var minimizePreference       = settings.ClientSettings.MinimizeToTray;

            if (minimizePreference)
            {
                settings.ClientSettings.MinimizeToTray = false;
                settings.Save(settings);
            }

            HideAllForms();

            var userAcceptance = MessageBox.Show("The image capture process will now begin and display a screenshot of the" +
                                                 " current desktop in a custom full-screen window.  You may stop the capture process at any time by pressing" +
                                                 " the 'ESC' key, or selecting 'Close' at the top left. Simply create the image by clicking once to start" +
                                                 " the rectangle and clicking again to finish. The image will be cropped to the boundary within the red rectangle." +
                                                 " Shall we proceed?", "Image Capture", MessageBoxButtons.YesNo);

            if (userAcceptance == DialogResult.Yes)
            {
                frmImageCapture imageCaptureForm = new frmImageCapture();

                if (imageCaptureForm.ShowDialog() == DialogResult.OK)
                {
                    CommandItemControl inputBox         = (CommandItemControl)sender;
                    UIPictureBox       targetPictureBox = (UIPictureBox)inputBox.Tag;
                    targetPictureBox.Image = imageCaptureForm.UserSelectedBitmap;
                    var convertedImage = Common.ImageToBase64(imageCaptureForm.UserSelectedBitmap);
                    targetPictureBox.EncodedImage = convertedImage;
                    imageCaptureForm.Close();
                }
            }

            ShowAllForms();

            if (minimizePreference)
            {
                settings.ClientSettings.MinimizeToTray = true;
                settings.Save(settings);
            }
        }
        public override List <Control> Render(frmCommandEditor editor)
        {
            base.Render(editor);


            UIPictureBox imageCapture = new UIPictureBox();

            imageCapture.Width  = 200;
            imageCapture.Height = 200;
            imageCapture.DataBindings.Add("EncodedImage", this, "v_ImageCapture", false, DataSourceUpdateMode.OnPropertyChanged);

            RenderedControls.Add(CommandControls.CreateDefaultLabelFor("v_ImageCapture", this));
            RenderedControls.AddRange(CommandControls.CreateUIHelpersFor("v_ImageCapture", this, new Control[] { imageCapture }, editor));
            RenderedControls.Add(imageCapture);

            RenderedControls.AddRange(CommandControls.CreateDefaultInputGroupFor("v_xOffsetAdjustment", this, editor));
            RenderedControls.AddRange(CommandControls.CreateDefaultInputGroupFor("v_YOffsetAdjustment", this, editor));
            RenderedControls.AddRange(CommandControls.CreateDefaultDropdownGroupFor("v_MouseClick", this, editor));
            RenderedControls.AddRange(CommandControls.CreateDefaultInputGroupFor("v_TimeoutSeconds", this, editor));


            return(RenderedControls);
        }