Example #1
0
        public static bool CanBeCut(WebElementInfoViewModel el)
        {
            if (el == null)
            {
                return(false);
            }
            if (WebElementsViewModelsHelper.IsAnyParentReference(el))
            {
                return(false);
            }
            if (el.Parent == null)
            {
                return(true);
            }
            if (el.Parent.ElementType == WebElementTypes.DropDown || el.Parent.ElementType == WebElementTypes.RadioGroup)
            {
                return(false);
            }
            if (el.Parent.ElementType == WebElementTypes.Control ||
                el.Parent.ElementType == WebElementTypes.Context ||
                el.Parent.ElementType == WebElementTypes.Page ||
                el.Parent.ElementType == WebElementTypes.Directory)
            {
                return(true);
            }

            return(false);
        }
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value is WebElementInfoViewModel we)
     {
         return(WebElementsViewModelsHelper.IsAnyParentReference(we));
     }
     return(false);
 }
Example #3
0
        public List <SaKiMenuItemViewModel> CreateMenuItemsForWebElement()
        {
            var elementInfo = _webElementsTreeUserControl.SelectedWebElement;

            var et  = elementInfo?.ElementType ?? "Root";
            var p   = elementInfo?.Parent?.ElementType ?? "Root";
            var key = $"Menu Items for {et} {p}";

            var isAnyParentRef = WebElementsViewModelsHelper.IsAnyParentReference(elementInfo);

            if (isAnyParentRef)
            {
                key = "Reference";
            }

            if (elementInfo != null && elementInfo.ElementType == WebElementTypes.Reference)
            {
                key = $"Menu Items for {et} {p} ref";
            }

            if (!_menusCache.ContainsKey(key))
            {
                var items = new List <SaKiMenuItemViewModel>();

                if (isAnyParentRef)
                {
                    items.Add(CreateCopyNameMenuItem());
                    items.Add(CreateGoToReferencedMenuItem());
                }
                else
                {
                    if (elementInfo != null)
                    {
                        items.Add(CreateCopyNameMenuItem());

                        if (elementInfo.ElementType == WebElementTypes.Reference)
                        {
                            items.Add(CreateGoToReferencedMenuItem());
                        }

                        items.Add(CreateEditMenuItem());
                    }

                    if (WebElementCommandsHelper.CanElementHasCustomChildren(elementInfo))
                    {
                        items.Add(CreateCreateMenuItemGroup(et));
                    }

                    items.Add(CreateActionsMenuItemGroup(et, p));
                }

                _menusCache[key] = items;
            }
            return(_menusCache[key]);
        }
Example #4
0
        public override bool CanExecute(object parameter)
        {
            var result = CutOrCopied != null &&
                         Selected != CutOrCopied &&
                         !WebElementsViewModelsHelper.IsAnyParentReference(Selected) &&
                         WebElementCommandsHelper.CanElementHasCustomChildren(Selected) &&
                         !(Cut != null && Selected.IsDescendantdFor(Cut as CombinedWebElementInfoViewModel)) &&
                         ((Selected as CombinedWebElementInfoViewModel)?.Elements
                          ?? _webElementsTreeUserControl.WebElements.Cast <WebElementInfoViewModel>())
                         ?.FirstOrDefault(e => e.Name == CutOrCopied.Name) == null;

            return(result);
        }
Example #5
0
        public static bool CanBeCloned(WebElementInfoViewModel el)
        {
            if (el == null)
            {
                return(false);
            }
            if (WebElementsViewModelsHelper.IsAnyParentReference(el))
            {
                return(false);
            }
            if (el.Parent == null)
            {
                return(false);
            }
            if (el.Parent.ElementType == WebElementTypes.DropDown || el.Parent.ElementType == WebElementTypes.RadioGroup)
            {
                return(false);
            }

            return(true);
        }
 public override bool CanExecute(object parameter)
 {
     return(Selected != null && !WebElementsViewModelsHelper.IsAnyParentReference(Selected));
 }
 public override bool CanExecute(object parameter)
 {
     return((Selected?.ElementType == WebElementTypes.Reference) ||
            WebElementsViewModelsHelper.IsAnyParentReference(Selected));
 }