예제 #1
0
파일: ZForm.cs 프로젝트: llenroc/CSRoot
        public List <IWinControl> GetControls(Type controltype)
        {
            List <IWinControl> controlList = null;

            try
            {
                if (m_ControlListTypes.Contains(controltype))
                {
                    controlList = (List <IWinControl>)m_ControlListTypes[controltype];
                }
                else
                {
                    IChildControlFinder selector        = new ControlIdentifierByType(controltype);
                    ChildControlCrawler controlIterator = new ChildControlCrawler();
                    bool ctrlFound = controlIterator.FindChildWindowAsync(m_WindowHandle, selector.FindChild, ENUM_TIMEOUT);
                    if (!selector.ControlFound)
                    {
                        return(null);
                    }
                    controlList = (List <IWinControl>)selector.ChildControl;
                    m_ControlListTypes.Add(controltype, controlList);
                }
                return(controlList);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
예제 #2
0
파일: ZForm.cs 프로젝트: llenroc/CSRoot
        public IWinControl GetControl(string controlId, Type controltype)
        {
            IWinControl control = null;

            try
            {
                if (m_ControlList.Contains(controltype))
                {
                    control = (IWinControl)m_ControlList[controltype];
                }
                else
                {
                    IChildControlFinder selector     = new ControlIdentifierByName(m_WindowHandle, controlId);
                    ChildControlCrawler childlearner = new ChildControlCrawler();
                    childlearner.FindChildWindowAsync(m_WindowHandle, selector.FindChild, ENUM_TIMEOUT);
                    if (!selector.ControlFound)
                    {
                        return(null);
                    }
                    control = (IWinControl)selector.ChildControl;

                    m_ControlList.Add(controlId, control);
                }
                return(control);
            }
            catch (Exception e)
            {
                return(null);
            }
        }