/// <summary> /// Waits for the specified text to appear at the specified location. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="text"></param> /// <param name="timeoutMS"></param> /// <returns></returns> public bool WaitForText(int x, int y, string text, int timeoutMS) { if (currentConnection == null) { throw new TNHostException("Terminal não está conectado", "Não existe conexão com terminal 3270 aberta", null); } long start = DateTime.Now.Ticks; //bool ok = false; if (Config.AlwaysRefreshWhenWaiting) { lock (this) { DisposeOfCurrentScreenObject(); this.currentScreenObject = null; } } do { if (CurrentScreenObject != null) { string screenText = CurrentScreenObject.GetText(x, y, text.Length); if (screenText == text) { if (Audit != null) { Audit.WriteLine("WaitForText('" + text + "') Found!"); } return(true); } } // if (timeoutMS == 0) { if (Audit != null) { Audit.WriteLine("WaitForText('" + text + "') Not found"); } return(false); } // System.Threading.Thread.Sleep(100); if (Config.AlwaysRefreshWhenWaiting) { lock (this) { DisposeOfCurrentScreenObject(); this.currentScreenObject = null; } } Refresh(true, 1000); }while (((DateTime.Now.Ticks - start) / 10000) < timeoutMS); // if (Audit != null) { Audit.WriteLine("WaitForText('" + text + "') Timed out"); } return(false); }
/// <summary> /// Dump current screen to the current audit output /// </summary> public void Dump() { lock (this) { if (sout != null) { CurrentScreenObject.Dump(sout); } } }