Exemplo n.º 1
0
        public List <IWinControl> GetControls(Type controltype)
        {
            try
            {
                IWinForm           form          = m_ClientChannel.GetWindow(m_WindowHandle);
                List <IWinControl> controlProxys = form.GetControls(controltype);
                if (controlProxys == null || controlProxys.Count == 0)
                {
                    return(null);
                }
                List <IWinControl> surrogateControls = new List <IWinControl>();
                foreach (IWinControl item in controlProxys)
                {
                    IWinControl surrogateControl = new SurrogateControl(item);
                    surrogateControls.Add(surrogateControl);
                }

                return(surrogateControls);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(null);
            }
        }
Exemplo n.º 2
0
        private void GetControlThreadProc(object param)
        {
            object[] actualParams = (object[])param;


            string controlId   = (string)actualParams[0];
            Type   controlType = (Type)actualParams[1];

            if (m_ClientChannel == null)
            {
                return;
            }
            try
            {
                IWinForm    form         = m_ClientChannel.GetWindow(m_WindowHandle);
                IWinControl controlproxy = form.GetControl(controlId, controlType);
                if (controlproxy == null)
                {
                    return;
                }
                m_SurrogateControl = new SurrogateControl(controlproxy);
                m_Success          = true;
            }
            catch (Exception e)
            {
                m_Success = false;
            }
            finally
            {
                m_ControlFound.Set();
            }
        }
Exemplo n.º 3
0
        public IWinControl GetControl(string controlId, Type controltype)
        {
            try
            {
                IWinForm    form         = m_ClientChannel.GetWindow(m_WindowHandle);
                IWinControl controlProxy = form.GetControl(controlId, controltype);
                if (controlProxy == null)
                {
                    return(null);
                }
                IWinControl surrogateControl = new SurrogateControl(controlProxy);

                return(surrogateControl);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(null);
            }
        }