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); } }
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); } }