views:

42

answers:

1

Hi,

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

A: 

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.
Samuel Jack