hi
i have to applications A and B.
A is a simple winform application with only a single button on it.
B is my automation application.
i'm hooking up to the InvokePattern.InvokeEvent like this:
public AutomationElement AElement { get { return aElement; } set { aElement = value; AutomationPattern[] patterns = AElement.GetSupportedPatterns(); if (patterns != null && patterns.FirstOrDefault(p => p == InvokePatternIdentifiers.Pattern) != null) { Automation.AddAutomationEventHandler(InvokePattern.InvokedEvent, AElement, TreeScope.Element, new AutomationEventHandler(AutomationInvokeHandler)); } } }
private void AutomationInvokeHandler(object sender, AutomationEventArgs e) { Trace.WriteLine("button invoked!); }
I can't get it to call the handler.
I'v tried clicking the button and tried to invoke it from my automation application. Nothing will call the handler.
Does somebody have an idear on what is going wrong. It's a pretty simple setup so im amazed that it doens't work.