コード例 #1
0
        public static ITreeViewItem GetTreeViewItemForElementInfo(Amdocs.Ginger.Common.UIElement.ElementInfo EI)
        {
            if (EI == null)
            {
                return(null);            // can happen when grid is filtered
            }
            //TODO: make it OO style avoid the if else if
            ITreeViewItem TVI = null;

            if (EI is JavaElementInfo)
            {
                TVI = JavaElementInfoConverter.GetTreeViewItemFor(EI);
            }
            else if (EI is UIAElementInfo)
            {
                UIAElementInfo UEI = (UIAElementInfo)EI;
                if (UEI.WindowExplorer.GetType() == typeof(PBDriver))
                {
                    //TODO:  Below will work for now. But need to Implement element info
                    TVI = PBControlTreeItemBase.GetMatchingPBTreeItem(UEI);
                }
                else
                {
                    TVI = WindowsElementConverter.GetWindowsElementTreeItem(EI);
                }
            }
            else if (EI is AppiumElementInfo)
            {
                TVI = AppiumElementInfoConverter.GetTreeViewItemFor(EI);
            }
            else if (EI is HTMLElementInfo)
            {
                TVI = HTMLElementInfoConverter.GetHTMLElementTreeItem(((HTMLElementInfo)EI));
            }
            else if (EI.ElementObject is XmlNode)
            {
                TVI = AppiumElementInfoConverter.GetTreeViewItemFor(EI);
            }
            else
            {
                //TODO: err?
                return(null);
            }

            return(TVI);
        }
コード例 #2
0
        List <ITreeViewItem> ITreeViewItem.Childrens()
        {
            List <ITreeViewItem> list = new List <ITreeViewItem>();

            {
                List <ElementInfo> Childrens = base.UIAElementInfo.WindowExplorer.GetElementChildren(base.UIAElementInfo);
                foreach (ElementInfo EI in Childrens)
                {
                    ITreeViewItem TVI = null;
                    if (EI.GetType() == typeof(UIAElementInfo))
                    {
                        //TODO: move convrter to here
                        TVI = WindowsElementConverter.GetWindowsElementTreeItem(EI);
                    }
                    else
                    {
                        TVI = WindowExplorer.HTMLCommon.HTMLElementInfoConverter.GetHTMLElementTreeItem(EI);
                    }
                    list.Add(TVI);
                }
            }
            return(list);
        }