/// <summary> /// Gets a value indicating whether the main window is visible. /// </summary> /// <param name="timeout">The timeout.</param> /// <param name="retryWaitTime">The retry wait time.</param> /// <returns></returns> /// <value> /// <c>true</c> if main window is visible; otherwise, <c>false</c>. /// </value> public override bool IsMainWindowVisible(TimeSpan timeout, TimeSpan retryWaitTime) { mApp = null; mMainWindow = null; var startTime = DateTime.Now; while (DateTime.Now - startTime < timeout) { bool processFound; var index = 1; // first index is 1 do { // search process processFound = Driver.TryFind <IProcess>(new ProcessPattern() { ProcessName = mFluxProcessName, Index = index }, 1, out var flux); if (processFound) // search MainWindow { mApp = new TcAppProcess(flux, Driver); try { if (mApp.Node.TryFind <IControl>(new WPFPattern { ClrFullClassName = "Flux.App.MainWindow" }, out var window, 2)) { if (window.VisibleOnScreen) // -> found, store MainWindow and return { mMainWindow = window; return(true); } } } catch (Exception) { // empty } } index++; // -> not found, search next process } while(processFound); Thread.Sleep(retryWaitTime); // nothing found, wait and retry until timeout } mApp = null; mMainWindow = null; return(false); }
/// <summary> /// Gets a value indicating whether the dialog is visible. /// </summary> /// <param name="timeout">The timeout.</param> /// <param name="retryWaitTime">The retry wait time.</param> /// <returns> /// <c>true</c> if main window is visible; otherwise, <c>false</c>. /// </returns> public bool IsDialogVisible(TimeSpan timeout, TimeSpan retryWaitTime) { mApp = null; mWindow = null; var tts = TcAppLangDependentStrings.TechnologyTableSelection; var startTime = DateTime.Now; while (DateTime.Now - startTime < timeout) { bool processFound; var index = 1; // first index is 1 do { // search process processFound = mDriver.TryFind <IProcess>(new ProcessPattern() { ProcessName = "cut", Index = index }, 1, out var proc); if (processFound) // search dialog { mApp = new TcAppProcess(proc, mDriver); if (mApp.Node.TryFind <ITopLevelWindow>(new WindowPattern() { WndClass = "GritDialogWindow", WndCaption = tts }, out var window, 1)) { if (window.VisibleOnScreen) // -> found, store dialog window and return { mWindow = window; return(true); } } } index++; // -> not found, search next process } while(processFound); Thread.Sleep(retryWaitTime); // nothing found, wait and retry until timeout } mApp = null; mWindow = null; return(false); }
/// <summary> /// Gets a value indicating whether the main window is visible. /// </summary> /// <param name="timeout">The timeout.</param> /// <param name="retryWaitTime">The retry wait time.</param> /// <returns></returns> /// <value> /// <c>true</c> if main window is visible; otherwise, <c>false</c>. /// </value> public override bool IsMainWindowVisible(TimeSpan timeout, TimeSpan retryWaitTime) { mApp = null; mMainWindow = null; var startTime = DateTime.Now; while (DateTime.Now - startTime < timeout) { bool processFound; var index = 1; // first index is 1 do { // search process processFound = Driver.TryFind <IProcess>(new ProcessPattern() { ProcessName = "SpaceClaim", Index = index }, 1, out var proc); if (processFound) // search MainWindow { mApp = new TcAppProcess(proc, Driver); if (mApp.Node.TryFind <ITopLevelWindow>(new WinFormsPattern { WinFormsControlName = "MainForm" }, out var window, 1)) { if (window.VisibleOnScreen) // -> found, store MainWindow and return { mMainWindow = window; return(true); } } } index++; // -> not found, search next process } while(processFound); Thread.Sleep(retryWaitTime); // nothing found, wait and retry until timeout } mApp = null; mMainWindow = null; return(false); }