コード例 #1
0
ファイル: FormModel.cs プロジェクト: PxAndy/Autotask
        private void ItemEdit_Click(object sender, EventArgs e)
        {
            ITaskNode node     = listViewNodes.SelectedItems[0].Tag as ITaskNode;
            var       formNode = new FormNode();

            formNode.SetNode(node);

            if (formNode.ShowDialog() == DialogResult.OK)
            {
                EditListViewItem(listViewNodes.SelectedItems[0], node);
            }
        }
コード例 #2
0
ファイル: FormModel.cs プロジェクト: PxAndy/Autotask
        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);
        }