Is there a simple way to check if my OK button was pressed? Most of the times it is working perfectly, but 1 in 100 it fails:
AutomationElement rl = SomeMethod();
if (rl.Current.Name == "OK" && rl.Current.ControlType == ControlType.Button)
{
InvokePattern click = (InvokePattern)rl.GetCurrentPattern(InvokePattern.Pattern);
click.Invoke();
}
I wonder why.