使用 Silverlight 控件的 UI 自动化记录屏幕交互

发布于 2024-09-26 07:15:16 字数 408 浏览 2 评论 0原文

我正在尝试使用 UI 自动化来记录我的 Silverlight 应用程序中的屏幕交互。我有用于我的控制设置的自动化对等体,但无法弄清楚如何跟踪这些控制。

对于我的 WPF 应用程序,我将获取 AutomationElement.RootElement,然后导航到我的应用程序并在我感兴趣的控件上设置自动化事件处理程序。

我如何对 Silverlight 应用程序执行相同操作?我希望屏幕录像机在我的应用程序运行时自动启动。屏幕录像机必须位于我的应用程序中。但是 System.Windows.Automation silverlight 命名空间没有 AutomationElement 类。那么我该如何在 Silverlight 中做到这一点呢?

谢谢
希瓦普拉萨德

I am trying to use UI Automation to record screen interactions in my Silverlight app. I have the Automation Peers for my control setup but am not able to figure out how to track these controls.

For my WPF app I would get hold of AutomationElement.RootElement and then navigate down to my App and setup Automation event Handlers on the controls I am interested in.

How would I do the same for Silverlight app? I want the screen recorder to start automatically whenever my app runs. The screen recorder has to sit within my App. But the System.Windows.Automation silverlight namespace doesn't have a AutomationElement class. So how would I do this in Silverlight?

Thanks
Shivaprasad

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一指流沙 2024-10-03 07:15:16

正如您所观察到的,Silverlight 中不存在 AutomationElement 类:UIAutomation API 仅在完整的 .Net 框架中可用。 Silverlight 仅支持作为 UI 自动化提供程序 - 也就是说,Silverlight 应用程序可以由 UI 自动化控制,但它们无法控制其他应用程序。

因此,我认为您无法在 Silverlight 应用程序中创建屏幕录像机 - 除非您准备诉诸一些令人讨厌的黑客手段。

此类黑客攻击可能包括:

  • 使用 Silverlight COM 自动化 调用新的 UIAutomation COM API。除了 Silverlight 之外,用户还需要在其计算机上安装 COM API。
  • 在 .Net 中创建一个“服务器”应用程序,您可以在执行实际 UIAutomation 工作的目标计算机上运行该应用程序,然后使用 WCF 从 Silverlight 应用程序与其进行通信。

As you observed, the AutomationElement class doesn't exist in Silverlight: the UIAutomation API is available only in the full .Net framework. Silverlight is only supported as an UI Automation provider - that is, Silverlight applications can be controlled by UI Automation, but they are not able to control other applications.

For this reason, I don't think you're going to be able to create your screen recorder within the Silverlight application - unless you are prepared to resort to some nasty hacks.

Such hacks might include:

  • Using Silverlight COM Automation to call the new UIAutomation COM API. Users would be required to have the COM API installed on their machines in addition to Silverlight.
  • Create a "server" application in .Net that you can run on the target machine that does the actual UIAutomation work, then communicate with this from your Silverlight application using WCF.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文