internal static IUiElement ConvertToProxiedElement <T>(T element) { Type[] supportedAdditionalInterfaces = UiaHelper.GetSupportedInterfaces(element); UiElement proxiedElement = null; try { if (null != supportedAdditionalInterfaces && 0 < supportedAdditionalInterfaces.Length) { proxiedElement = (UiElement)_generator.CreateClassProxy( typeof(UiElement), supportedAdditionalInterfaces, new MethodSelectorAspect(), new ErrorHandlingAspect()); } else { proxiedElement = (UiElement)_generator.CreateClassProxy( typeof(UiElement), new MethodSelectorAspect(), new ErrorHandlingAspect()); } } catch (Exception) { // Console.WriteLine(eConvertation.Message); } return(proxiedElement); }