且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

由于某些机器上的UI自动化导致WPF应用程序性能不佳

更新时间:2023-08-22 10:07:16

嗨约翰,

我们已经意识到这个问题,我们将在下一个版本中修复此问题(最有可能在.NET 4.0 sp1中)。在此期间,您可以尝试以下解决方法之一

We already aware of this issue and we will be fixing this one in the next release ( most likely in .NET 4.0 sp1). In the meantime you could try one of the below workarounds

 

1.仅当有任何自动化客户端(如屏幕阅读器,平板电脑中的tabtip等)并且在机器中运行时,才会触发自动化代码。因此,摆脱这种情况的一种方法是关闭任何这些自动化客户端应用程序。

1. Automation code will be triggered only if there are any automation clients ( like screen reader, tabtip in tablet pcs, etc) running in the machine. So one way to get out of this situation is to close any of those automation client apps.

2.如果一个不可行,那么替代方案是,   UIElementHelper .InvalidateAutomationAncestors 只有当应用程序的自动化树稀疏时才会花费更长的时间(如果使用自定义窗口禁用了建筑自动化树,则会发生这种情况;
自动化对等)并且可视化树密集。所以另一种解决方案是禁用任何自定义自动化代码,并允许WPF构建完整的自动化树。这也应该加速UIElementHelper.InvalidateAutomationAncestors。

2. If one is not feasible then an alternative is,  UIElementHelper.InvalidateAutomationAncestors  will take longer time only if automation tree for the app is sparse ( happens if had disabled building automation tree using custom window automation peer) and visual tree is dense. So another solution is disable any custom automation code and allow WPF to build complete automation tree. This should speed up UIElementHelper.InvalidateAutomationAncestors as well.

让我知道这是如何工作的。

Let me know how this works.

谢谢,

Rath