private HwndObject getMainContainer() { List <HwndObject> list = axiUm.GetChildren(); if (list.Count != 3) { Console.ForegroundColor = Colors.Error; foreach (HwndObject o in list) { Console.WriteLine(Stuff.GetHwndInfoString(o)); } throw new Exception("Axium changed its top level children count"); } else { var mainContainer = list[1]; if (!mainContainer.ClassName.Equals("MDIClient")) { Console.ForegroundColor = Colors.Message; foreach (HwndObject o in list) { Console.WriteLine(Stuff.GetHwndInfoString(o)); } Console.WriteLine("It is unclear if this window is the one you want"); } return(mainContainer); } }
private void RunReport(string reportName, string path, Action findReport, Action reportParameters, int numRetries = 3) { if (!EnoughRetries(numRetries)) { return; } CloseInfoManager(); if (GetInfoManager() == null) { Stuff.WriteConsoleError("Unable to open info manager...Giving Up"); return; } Thread.Sleep(1000); findReport.Invoke(); Input.PressKey(Input.KEY_TAB); Thread.Sleep(500); Input.PressKey(Input.KEY_ENTER); Thread.Sleep(5000); Console.ForegroundColor = Colors.Message; Console.WriteLine("Loading " + reportName + ", will save to " + path); HwndObject parameters = null; HwndObject report = null; if (!InitializeReport(out parameters, out report, reportName)) { Console.ForegroundColor = Colors.Error; Console.WriteLine("Trying again..."); RunReport(reportName, path, findReport, reportParameters, numRetries - 1); return; } Thread.Sleep(5000); reportParameters.Invoke(); Console.ForegroundColor = Colors.Message; Console.WriteLine("Requesting Report"); Stopwatch watch = Stopwatch.StartNew(); while (report.GetChildren()[0].GetChildren().Count == 0) { Console.WriteLine("Waiting... (" + watch.ElapsedMilliseconds + ")"); Thread.Sleep(3000); } watch.Stop(); Console.ForegroundColor = Colors.Success; Console.WriteLine("Report Generated"); SaveReport(path); Console.ForegroundColor = Colors.Message; Console.WriteLine("Report Processed"); report.CloseWindow(); }