示例#1
0
        public SaKiMenuItemViewModel CreateGoToReferencedMenuItem()
        {
            var key = "Go to Referenced";

            if (!_cache.ContainsKey(key))
            {
                _cache[key] = new SaKiCommandMenuItemViewModel
                {
                    Name        = "Go to Referenced",
                    Description = "Go to Referenced WebElement",
                    Command     = new GoToReferencedCommand(_webElementsTreeUserControl)
                };
            }
            return(_cache[key]);
        }
示例#2
0
        public SaKiMenuItemViewModel CreateCopyNameMenuItem()
        {
            var key = "Copy Name";

            if (!_cache.ContainsKey(key))
            {
                _cache[key] = new SaKiCommandMenuItemViewModel
                {
                    Name        = "Copy Name",
                    Description = "Copy name of selected WebElementInfo",
                    Command     = new CopyNameCommand(_webElementsTreeUserControl)
                };
            }
            return(_cache[key]);
        }
示例#3
0
        public SaKiMenuItemViewModel CreateActionsCommandMenuItem(string actionName)
        {
            var key = $"Action {actionName}";

            if (!_cache.ContainsKey(key))
            {
                var command = new SaKiCommandMenuItemViewModel {
                    Name = actionName
                };

                switch (actionName)
                {
                case "Delete":
                    command.Description = "Delete selected WebElement";
                    command.Command     = new DeleteWebElementCommand(_webElementsTreeUserControl);
                    break;

                case "Copy":
                    command.Description = "Copy selected WebElement";
                    command.Command     = new CopyWebElementCommand(_webElementsTreeUserControl);
                    break;

                case "Cut":
                    command.Description = "Cut selected WebElement";
                    command.Command     = new CutWebElementCommand(_webElementsTreeUserControl);
                    break;

                case "Paste":
                    command.Description = "Paste copied/cut WebElement";
                    command.Command     = new PasteWebElementCommand(_webElementsTreeUserControl);
                    break;

                case "Clone":
                    command.Description = "Clone selected WebElement with specified name";
                    command.Command     = new CloneWebElementCommand(_webElementsTreeUserControl);
                    break;

                default:
                    break;
                }

                _cache[key] = command;
            }
            return(_cache[key]);
        }
示例#4
0
        public SaKiMenuItemViewModel CreateCreateCommandMenuItem(string elementType)
        {
            var key = $"Create New for {elementType}";

            if (!_cache.ContainsKey(key))
            {
                var description = "";
                switch (elementType)
                {
                case WebElementTypes.Context:
                    description = $"Context WebElement is used to describe separate (relative to site) set of elements with own functionality. Similar to control" +
                                  $"{Environment.NewLine}E.g. Header, Menu, Popup, Dialog etc.";
                    break;

                case WebElementTypes.Control:
                    description = $"Control WebElement is used to describe separate (relative to Context) set of elements with own functionality." +
                                  $"{Environment.NewLine}E.g. Form, Form control groups, Sets of functional elements, Div, etc.";
                    break;

                case WebElementTypes.Element:
                    description = $"Element WebElement is used to describe lowest piec of web elements." +
                                  $"{Environment.NewLine}E.g. Input, Button, a etc.";
                    break;

                case WebElementTypes.DropDown:
                    description = $"DropDown WebElement is used to describe expandable lists" +
                                  $"{Environment.NewLine}E.g. DropDown, ComboBox, Select with options etc.";
                    break;

                case WebElementTypes.RadioGroup:
                    description = $"RadioGroup WebElement is used to describe set of radio inputs, where just one valued could be selected";
                    break;

                case WebElementTypes.Reference:
                    description = $"Reference WebElement is used to create reference to any existed web element";
                    break;

                case WebElementTypes.Directory:
                    description = $"Directory WebElement is used to separate set of web elements to some logig group";
                    break;

                case WebElementTypes.Frame:
                    description = $"Frame WebElement is used to describe child frame web element that contains some existed Context or Page";
                    break;

                case WebElementTypes.Page:
                    description = $"Page WebElement is used to describe separate Web Site Page";
                    break;

                default:
                    MessageBox.Show($"Unknown element type: {elementType} to provide description");
                    break;
                }

                _cache[key] = new SaKiCommandMenuItemViewModel
                {
                    Name        = elementType,
                    Description = description,
                    Command     = new CreateWebElementCommand(elementType, _webElementsTreeUserControl)
                };
            }
            return(_cache[key]);
        }