Beispiel #1
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();
            }
        }
Beispiel #2
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);
            }
        }