Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I Have an add automation event that raised on new windows open from that windows i get the localized control type dialogue then i used it in my function so the problem is that it raised multiple time when ever dialogue is open and also it does not raised some time for open and save as dialogue how ever if raised but multiple times so here is what i am codding


C#
Automation.AddAutomationEventHandler(
              WindowPattern.WindowOpenedEvent,
                AutomationElement.RootElement,
                        System.Windows.Automation.TreeScope.Subtree,
                               (sender, e) =>
                               {
                                   var element = sender as AutomationElement;
                 if (element.Current.LocalizedControlType == "Dialog")
                                   {

                                   }
                               });

         System.Console.ReadKey();
         Automation.RemoveAllEventHandlers();


now what is the mistake i am doing why it is calling multiple time but not for open and save as dialogue box ?

What I have tried:

i want to raise an event in my code when ever a new windows specially dialogue box opens so here is above code i have written code is working but event raised multiple time suppose print box opens it repeats 2 times and not working for open and save as dialogues boxes if some time works works with much delay of time that i have to sit but not for other events
Posted
Comments
vishal singh vicky 25-Jul-16 3:22am    
System.Console.ReadKey(); NEED ITS ALTERNATIVE
vishal singh vicky 25-Jul-16 7:07am    
the problem multiple call resolved there
http://stackoverflow.com/questions/38562428/check-how-many-time-the-function-execute-in-x-seconds-c-sharp/38562942?noredirect=1#comment64521703_38562942

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900