在Win32Tree上查找子级时,System.Windows.Automation的FindFirst()和FindAll()调用出现性能问题.是否有任何方法可以优化这些调用. [英] Performance issue on FindFirst() and FindAll() calls of System.Windows.Automation ,while finding the child from on Win32Tree .Is there any way to optimize the calls.?

查看:43
本文介绍了在Win32Tree上查找子级时,System.Windows.Automation的FindFirst()和FindAll()调用出现性能问题.是否有任何方法可以优化这些调用.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用System.Windows.Automation中的某些功能以及TestStack/White.
在FindFirst()调用中,我们面临以下性能问题.

We are using some feature from System.Windows.Automation with TestStack/White .
We are facing below performance issue on FindFirst() call.

我正在使用以下代码来获取树节点
AutomationElement parentNode = win32TreeNode.AutomationElement.GetUpdatedCache(CacheRequest.Current); AutomationElement childNode = null;
childNode = parentNode.FindFirst(TreeScope.Children,new PropertyCondition(AutomationElement.NameProperty,childNodeId));

I am using the below code to fetch the tree node
AutomationElement parentNode = win32TreeNode.AutomationElement.GetUpdatedCache(CacheRequest.Current);AutomationElement childNode = null;
childNode = parentNode.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, childNodeId));

此代码需要花费更多时间来获取节点.由于节点是从应用程序动态创建的,因此我们需要反复调用此代码(重试)以获取更新的值.
有什么建议可以加快这个过程.
另外,如果我们需要第二次获取更新的值,是否需要再次调用FindFirst()?或者还有其他方法可以获取更新的节点吗?

This code taking more time to fetch the node .Since the node is created dynamically from application we need to call this code again and again(re-try) to get updated value.
Is there any suggestion to speed up this process.
Also if we need to get the updated value second time whether we need to call FindFirst() again ?Or is there any other way we can get the updated node?
Please provide sample snippet if possible.

推荐答案

我们正在使用System.Windows.Automation中的某些功能以及TestStack/White.
在FindFirst()调用中,我们面临以下性能问题.

We are using some feature from System.Windows.Automation with TestStack/White .
We are facing below performance issue on FindFirst() call.

我正在使用以下代码来获取树节点
AutomationElement parentNode = win32TreeNode.AutomationElement.GetUpdatedCache(CacheRequest.Current); AutomationElement childNode = null;
childNode = parentNode.FindFirst(TreeScope.Children,new PropertyCondition(AutomationElement.NameProperty,childNodeId));

I am using the below code to fetch the tree node
AutomationElement parentNode = win32TreeNode.AutomationElement.GetUpdatedCache(CacheRequest.Current);AutomationElement childNode = null;
childNode = parentNode.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, childNodeId));

此代码需要花费更多时间来获取节点.由于节点是从应用程序动态创建的,因此我们需要反复调用此代码(重试)以获取更新的值.
有什么建议可以加快这个过程.
另外,如果我们需要第二次获取更新的值,是否需要再次调用FindFirst()?或者还有其他方法可以获取更新的节点吗?
请提供示例代码.

This code taking more time to fetch the node .Since the node is created dynamically from application we need to call this code again and again(re-try) to get updated value.
Is there any suggestion to speed up this process.
Also if we need to get the updated value second time whether we need to call FindFirst() again ?Or is there any other way we can get the updated node?
Please provide sample snippet if possible.


这篇关于在Win32Tree上查找子级时,System.Windows.Automation的FindFirst()和FindAll()调用出现性能问题.是否有任何方法可以优化这些调用.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆