Пример #1
0
        protected override void ExecuteCommand()
        {
            var validator = WebElementCommandsHelper.GetCreateUpdateWebElementValidator(
                _webElementsTreeUserControl,
                Selected.Name);

            var editDialog = new WebElementCreateEditDialog(validator, Selected);

            editDialog.WebElements = _webElementsTreeUserControl.WebElements;
            if (editDialog.ShowDialog() != true)
            {
                return;
            }

            if (Selected.ElementType != WebElementTypes.Reference)
            {
                return;
            }

            var selected = Selected;

            _webElementsTreeUserControl.SelectedWebElement = null;
            _webElementsTreeUserControl.UpdateLayout();
            _webElementsTreeUserControl.SelectedWebElement = selected;
        }
        private WebElementInfoViewModel CreateWebElementInfo(CombinedWebElementInfoViewModel parent = null, WebElementInfoViewModel template = null)
        {
            var validator = WebElementCommandsHelper.GetCreateUpdateWebElementValidator(_webElementsTreeUserControl, null);

            //TODO: add ctor override to accept WebElementInfoViewModel with default data
            var dialog = new WebElementCreateEditDialog(validator,
                                                        parent ?? Selected as CombinedWebElementInfoViewModel,
                                                        _elementType,
                                                        template);

            dialog.WebElements = _webElementsTreeUserControl.WebElements;
            if (dialog.ShowDialog() != true)
            {
                return(null);
            }

            var createdWebElement = WebElementsViewModelsHelper.CreateModelFromWebElementType(_elementType);

            WebElementsViewModelsHelper.FillModelWithBaseInfo(
                createdWebElement,
                dialog.WebElement);

            return(createdWebElement);
        }