protected UiFormInput GetDropDownInput(string controller,
                                               MethodType type, string area
                                               , string inputName, string inputTranslate, FieldType fieldType)
        {
            //باید لیست باشد
            var uiinputmethosd = new List <UiInputMethod>();

            //خود ورودی
            var WorkgroupId = new UiInput
            {
                Name      = inputName,
                Translate = inputTranslate,
                FieldType = fieldType, UiInputMethods = uiinputmethosd
            };

            // متد اتصال ورودی
            var uiinputMethod = new UiInputMethod
            {
                ControllerName         = controller,
                MethodName             = type.ToString(),
                SubSystemName          = area,
                UiInput                = WorkgroupId,
                DefineControllerMethod = new DefineControllerMethod {
                    MethodType = type
                }
            };

            uiinputmethosd.Add(uiinputMethod);

            return(new UiFormInput
            {
                UiInput = WorkgroupId
            });
        }
Example #2
0
        private void TestBtn_Click(object sender, EventArgs e)
        {
            if (uiNode == null)
            {
                try
                {
                    //first select a control
                    SelectCtrlBtn_Click(null, null);
                    if (!uiNode.IsValid())
                    {
                        return;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
            }

            //get wait for ready level
            UiWaitForReadyLevels wfrLevel = UiWaitForReadyLevels.UI_WFR_INTERACTIVE;

            if (NoneBtn.Checked)
            {
                wfrLevel = UiWaitForReadyLevels.UI_WFR_NONE;
            }
            if (CompleteBtn.Checked)
            {
                wfrLevel = UiWaitForReadyLevels.UI_WFR_COMPLETE;
            }

            //get input method
            UiInputMethod inputMethod = UiInputMethod.UI_HARDWARE_EVENTS;

            if (CtrlAPIBtn.Checked)
            {
                inputMethod = UiInputMethod.UI_CONTROL_API;
            }
            if (Win32Msg.Checked)
            {
                inputMethod = UiInputMethod.UI_WIN32_MSG;
            }

            try
            {
                uiNode.waitForReadyLevel = wfrLevel;
                //write to control
                uiNode.WriteText(InputTextBox.Text, inputMethod);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #3
0
        private void TypeBtn_Click(object sender, EventArgs e)
        {
            if (image == null)
            {
                SelectImageMessageBox();
                return;
            }

            //get input method
            UiInputMethod inputMethod = UiInputMethod.UI_HARDWARE_EVENTS;

            if (Win32MsgBtn.Checked)
            {
                inputMethod = UiInputMethod.UI_WIN32_MSG;
            }
            if (ControlAPIBtn.Checked)
            {
                inputMethod = UiInputMethod.UI_CONTROL_API;
            }

            if (!FindImage())
            {
                MessageBox.Show("The image was not found");
            }
            else
            {
                try
                {
                    //remove clipping region
                    uiNode.clippingRegion = null;
                    //get text to type
                    string inputText = InputText.Text;
                    //type to control
                    uiNode.WriteText(inputText, inputMethod);
                }
                catch (Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show(ex.Message);
                }
            }
        }
Example #4
0
        private void ClickImage(UiRegion[] regionCollection, bool hover)
        {
            UiClickType   clickType   = UiClickType.UI_CLICK_SINGLE;
            UiMouseButton mouseBtn    = UiMouseButton.UI_BTN_LEFT;
            UiInputMethod inputMethod = UiInputMethod.UI_HARDWARE_EVENTS;

            //get input parameters
            if (DoubleBtn.Checked)
            {
                clickType = UiClickType.UI_CLICK_DOUBLE;
            }

            if (MiddleMouseBtn.Checked)
            {
                mouseBtn = UiMouseButton.UI_BTN_MIDDLE;
            }
            if (RightMouseBtn.Checked)
            {
                mouseBtn = UiMouseButton.UI_BTN_RIGHT;
            }

            if (Win32MsgBtn.Checked)
            {
                inputMethod = UiInputMethod.UI_WIN32_MSG;
            }
            if (ControlAPIBtn.Checked)
            {
                MessageBox.Show("Please select another input method for click or hover image");
                return;
            }

            try
            {
                if (regionCollection == null)
                {
                    if (!FindImage())
                    {
                        MessageBox.Show("The image was not found");
                        return;
                    }
                }
                if (hover)
                {
                    uiNode.Hover(uiNode.clippingRegion.width / 2, uiNode.clippingRegion.height / 2, inputMethod, 500);
                }
                else
                {
                    //click image
                    if (regionCollection == null)
                    {
                        uiNode.Click(uiNode.clippingRegion.width / 2, uiNode.clippingRegion.height / 2, clickType, mouseBtn, inputMethod);
                    }
                    else
                    {
                        //click all images
                        foreach (UiRegion region in regionCollection)
                        {
                            uiNode.clippingRegion = region;
                            uiNode.Click(uiNode.clippingRegion.width / 2, uiNode.clippingRegion.height / 2, clickType, mouseBtn, inputMethod);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #5
0
        private void TestBtn_Click(object sender, EventArgs e)
        {
            if (uiNode == null)
            {
                try
                {
                    //first select a control
                    SelectCtrlBtn_Click(null, null);
                    if (!uiNode.IsValid())
                    {
                        return;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
            }

            //get wait for ready level
            UiWaitForReadyLevels wfrLevel = UiWaitForReadyLevels.UI_WFR_INTERACTIVE;

            if (NoneBtn.Checked)
            {
                wfrLevel = UiWaitForReadyLevels.UI_WFR_NONE;
            }
            if (CompleteBtn.Checked)
            {
                wfrLevel = UiWaitForReadyLevels.UI_WFR_COMPLETE;
            }

            //get input method
            UiInputMethod inputMethod = UiInputMethod.UI_HARDWARE_EVENTS;

            if (CtrlAPIBtn.Checked)
            {
                inputMethod = UiInputMethod.UI_CONTROL_API;
            }
            if (Win32Msg.Checked)
            {
                inputMethod = UiInputMethod.UI_WIN32_MSG;
            }
            try
            {
                //get control position
                UiRegion position = (UiRegion)uiNode.Get("position");

                //set offsets to the center of the control
                int offsetX = position.width / 2;
                int offsetY = position.height / 2;

                //set wait for ready level
                uiNode.waitForReadyLevel = wfrLevel;

                if (HoverOnlyBtn.Checked)
                {
                    //hover control
                    uiNode.Hover(offsetX, offsetY, inputMethod, 500);
                }
                else
                {
                    //click control
                    //get mouse button
                    UiMouseButton mouseBtn = UiMouseButton.UI_BTN_LEFT;
                    if (RightMouseBtn.Checked)
                    {
                        mouseBtn = UiMouseButton.UI_BTN_RIGHT;
                    }
                    if (MiddleMouseBtn.Checked)
                    {
                        mouseBtn = UiMouseButton.UI_BTN_MIDDLE;
                    }

                    //get click type
                    UiClickType clickType = UiClickType.UI_CLICK_SINGLE;
                    if (DoubleButton.Checked)
                    {
                        clickType = UiClickType.UI_CLICK_DOUBLE;
                    }

                    uiNode.Click(offsetX, offsetY, clickType, mouseBtn, inputMethod);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }