White UI 自动化库广泛使用 Castle Project' s DynamicProxy 2. 据我了解,DynamicProxy 用于“包装”MS UI Automation 对象,并用于检索其父窗口内的对象。
我需要了解 DynamicProxy 是否是必需的,是否可以用更快的东西替换它,即静态构建的类而不是在运行时生成的代理类,IMO 是不必要的减速。
DynamicProxy在White库中到底是做什么的,是否可以被替代?任何提示或指示表示赞赏。
最佳答案
我决定不使用 White(而是直接使用 MS UI Automation),但我还在我的代码中使用了 CaSTLe Dynamic Proxy。这是定位它的使用位置的一个不错的开始:
C:\Users\xxxx\Desktop\petmongrels-white-54723f8>findstr /s /c:"ProxyCreator" /c:"CreateClassProxy" /c:"IInterceptor" *.cs
Components\Core\Source\CustomCommands\CustomCommandInterceptor.cs: public class CustomCommandInterceptor : IInterceptor
Components\Core\Source\Interceptors\CoreInterceptor.cs: public class CoreInterceptor : IInterceptor
Components\Core\Source\UIItems\UIItemContainer.cs: var interceptors = (IInterceptor[]) interceptorField.GetValue(customUIItem);
Components\Repository\Source\Interceptors\ScreenObjectInterceptor.cs: public class ScreenObjectInterceptor : IInterceptor
Components\Repository\Source\Interceptors\UIItemInterceptor.cs: public class UIItemInterceptor : IInterceptor
Components\Repository\Source\Interceptors\WindowInterceptor.cs: public class WindowInterceptor : IInterceptor
Components\Repository\Source\Services\ServiceInterceptor.cs: public class ServiceInterceptor : IInterceptor
您可以在以下位置获取源代码:https://github.com/petmongrels/white
(我的有点过时了)
关于c# - White UI Automation库如何使用CaSTLe DynamicProxy?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11828965/