F
folkwulf
Guest
Hello to all!
I have next situation:
Sample of code:
Automation.AddAutomationEventHandler(InvokePattern.InvokedEvent, uiControl, TreeScope.Element, new AutomationEventHandler(OnUIAutomationEventHandler));
Thread.Sleep(5000);
var invokePattern = uiControl.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern;
invokePattern.Invoke();
// Or here I make click.
Thread.Sleep(5000);
Automation.RemoveAutomationEventHandler(InvokePattern.InvokedEvent, uiControl, uiaEventHandler);
private static void OnUIAutomationEventHandler(object sender, AutomationEventArgs e)
{
Console.WriteLine("INVOKED!");
}
Additional information: if Application A is WPF then all work good that I am think problem is related to WinForms.
Please, help to understand what could be the problem.
Thanks in advance!
Continue reading...
I have next situation:
- Application A: WinForms application with one button;
- Application B: Console application with automation functionality;
- I set AutomationEventHandler with AutomationEvent InvokePattern.InvokedEvent and perform Automation.AddAutomationEventHandler;
- Application B do not catch invoke event of Application A when I perform InvokePattern.Invoke() or simple click on button of Application A.
Sample of code:
Automation.AddAutomationEventHandler(InvokePattern.InvokedEvent, uiControl, TreeScope.Element, new AutomationEventHandler(OnUIAutomationEventHandler));
Thread.Sleep(5000);
var invokePattern = uiControl.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern;
invokePattern.Invoke();
// Or here I make click.
Thread.Sleep(5000);
Automation.RemoveAutomationEventHandler(InvokePattern.InvokedEvent, uiControl, uiaEventHandler);
private static void OnUIAutomationEventHandler(object sender, AutomationEventArgs e)
{
Console.WriteLine("INVOKED!");
}
Additional information: if Application A is WPF then all work good that I am think problem is related to WinForms.
Please, help to understand what could be the problem.
Thanks in advance!
Continue reading...