Beispiel #1
0
        public void SetNode(ITaskNode node)
        {
            if (!(node is RedirectTaskNode))
            {
                throw new ArgumentException("参数“node”必须是 RedirectTaskNode 类型。");
            }

            _node = (RedirectTaskNode)node;

            textBoxUrl.Text = _node.Url;
        }
Beispiel #2
0
        private ITaskNode CreateNode(TaskNodeMode mode)
        {
            ITaskNode node     = null;
            var       formNode = new FormNode();

            switch (mode)
            {
            case TaskNodeMode.RedirectPage:
                node = new RedirectTaskNode("");

                formNode.SetNode(node);
                if (formNode.ShowDialog() != DialogResult.OK)
                {
                    node = null;
                }

                break;

            case TaskNodeMode.RefreshPage:
                node = new RefreshTaskNode();
                break;

            case TaskNodeMode.Manual:
                node = new ManualTaskNode();
                break;

            case TaskNodeMode.ClickElement:
                node = new ClickTaskNode(new TaskElement("BUTTON"));

                formNode.SetNode(node);
                if (formNode.ShowDialog() != DialogResult.OK)
                {
                    node = null;
                }
                break;

            case TaskNodeMode.FocusElement:
                node = new FocusTaskNode(new TaskElement("INPUT", type: "text"));

                formNode.SetNode(node);
                if (formNode.ShowDialog() != DialogResult.OK)
                {
                    node = null;
                }
                break;

            case TaskNodeMode.InputElement:
                node = new InputTaskNode(new TaskElement("INPUT", type: "text"), "");

                formNode.SetNode(node);
                if (formNode.ShowDialog() != DialogResult.OK)
                {
                    node = null;
                }
                break;

            case TaskNodeMode.Wait:
                node = new WaitTaskNode();

                formNode.SetNode(node);
                if (formNode.ShowDialog() != DialogResult.OK)
                {
                    node = null;
                }
                break;
            }

            return(node);
        }