c# - pattern.Invoke() exception: Operation is not valid due to the current state of the object -


I'm new to C # I can be downloaded from to check this Looking for solution

code:

  using the system; using System.Collections.Generic; using System.Linq; system. Using text; System.Threading Using Tasks; Using System.Diagnostics; Using System.Threading; Using System.Windows.Automation; Namespace LogCollector {Class Program {static void Main (string [] args) {Proces sStartInfo proc = New ProcessStartInfo (); proc.UseShellExecute = true proc.WorkingDirectory = Environment.CurrentDirectory; proc.FileName = "C: \\ Robot \\ ESETLogCollector.exe"; proc.Verb = "runas"; Process.Start ( proc); System .Threading.Thread.Sleep (2000); Console.WriteLine ("Ahoj"); AutomationElement Desktop = AutomationElement.RootElement; Condition cond = New PropertyCondition (AutomationElement.NameProperty, "ESET Log Collector"); AutomationElement elc = Desktop.FindFirst (Tree Scope. Hair, conduction); Console.light line (lc.content .name); String save-path = ""; Condition Arc 1 = New Property Condition (Automation Element. Automation IPProperty, "1005"); Try {Automation Element save_as = elc.FindFirst (Treescope Shuttle, Conund 1); Console.WriteLine (save_as.Current.AutomationId); save_path = save_as.Current.Name; } Hold (System.Exception e) {Console.WriteLine ("EX: {0}", e.Message); } If (System.IO.File.Exists (save_path)) {System.IO.File.Delete (save_path); Console.WriteLine (save_path); } Condition cond2 = new property condition (AutomationElement.automatomediaproperty, "1002"); Assemble the Automation Element = LC .Finfest (Treescope children, CND 2); Console.WriteLine (collect.Current.Name); {Object-Out Object; Gather Trygraphter (InvokePattern.Pattern, OutObject Out); InvokePattern as InvokePattern Pattern = outObject; Pattern.Invoke (); } Hold (System.Exception e) {Console.WriteLine ("EX: {0}", e.Message); } Console. Readkey ();  If I still want to click the button: Operation is not valid due to the current state of the object  

I really do not know What is happening here, can someone help me with this?

Ty

Operation is probably failing because while the ESET log collector exceeds You are not running your automation application as administrator.

Describes security models and how to communicate with processes that are running at a high privilege level (ie you need a signed application with a manifest file in which a special feature Is included).

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -