public bool Exists() { if (window == null) { return(false); } return(window.Exists()); }
/// <summary> /// Determines if a dialog still exists by checking the the existance of the /// window.Hwnd and checking if the window is visible. /// </summary> /// <param name="dialog">The dialog.</param> /// <returns><c>true</c> if exists and visible, otherwise <c>false</c></returns> public bool Exists(Window dialog) { return(dialog.Exists() && dialog.Visible); // bool exists = dialog.Exists(); // Logger.LogAction("Exists: exists == " + exists.ToString()); // // bool visible = dialog.Visible; // Logger.LogAction("Exists: visible == " + visible.ToString()); // // return exists && visible; }
public override bool HandleDialog(Window window) { if (CanHandleDialog(window)) { this.window = window; while (window.Exists()) { Thread.Sleep(200); } return true; } return false; }
public override bool HandleDialog(Window window) { if (CanHandleDialog(window)) { this.window = window; while (window.Exists()) { Thread.Sleep(200); } return(true); } return(false); }
private bool HandledDownloadProgressDialog(Window window) { if (IsDownloadProgressDialog(window)) { DownloadProgressDialog = window; var openOrRun = new WinButton(4377, new Hwnd(window.Hwnd)); if (openOrRun.Enabled) { var close = new WinButton(2, new Hwnd(window.Hwnd)); close.Click(); var actionUntilTimeOut = new TryFuncUntilTimeOut(TimeSpan.FromSeconds(5)); actionUntilTimeOut.Try(() => window.Exists()); // TODO: What to do if the window doesn't close after timeout? } return(true); } return(false); }
public bool Exists() { return(_window != null && _window.Exists()); }
/// <summary> /// Determines if a dialog still exists by checking the the existance of the /// window.Hwnd and checking if the window is visible. /// </summary> /// <param name="dialog">The dialog.</param> /// <returns><c>true</c> if exists and visible, otherwise <c>false</c></returns> public bool Exists(Window dialog) { return(dialog.Exists() && dialog.Visible); }
/// <summary> /// Handles the dialogs to download (and save) a file /// Mainly used internally by WatiN. /// </summary> /// <param name="window">The window.</param> /// <returns></returns> public override bool HandleDialog(Window window) { // This if handles the File download dialog if (!HasHandledFileDownloadDialog && IsFileDownloadDialog(window)) { window.ToFront(); window.SetActivate(); DownloadProgressDialog = new Window(window.ParentHwnd); WinButton btn = GetButtonToPress(window); btn.Click(); hasHandledFileDownloadDialog = !Exists(window); if (HasHandledFileDownloadDialog) { Logger.LogAction("Download started at " + DateTime.Now.ToLongTimeString()); Logger.LogAction("Clicked " + _optionEnum.ToString()); } return(true); } // This if handles the download progress dialog if (IsDownloadProgressDialog(window)) { DownloadProgressDialog = window; WinButton openOrRun = new WinButton(4377, new Hwnd(window.Hwnd)); if (openOrRun.Enabled) { WinButton close = new WinButton(2, new Hwnd(window.Hwnd)); close.Click(); SimpleTimer timer = new SimpleTimer(5); while (!timer.Elapsed && window.Exists()) { Thread.Sleep(200); } } return(true); } // This if handles the File save as dialog if (IsFileSaveDialog(window)) { Logger.LogAction("Saving Download file as " + saveAsFilename); DownloadProgressDialog = new Window(window.ParentHwnd); HandleFileSaveDialog(window); return(true); } // Window is not a dialog this handler can handle. return(false); }
/// <summary> /// Handles the dialogs to download (and save) a file /// Mainly used internally by WatiN. /// </summary> /// <param name="window">The window.</param> /// <returns></returns> public override bool HandleDialog(Window window) { // This if handles the File download dialog if (!HasHandledFileDownloadDialog && IsFileDownloadDialog(window)) { window.ToFront(); window.SetActivate(); DownloadProgressDialog = new Window(window.ParentHwnd); WinButton btn = GetButtonToPress(window); btn.Click(); hasHandledFileDownloadDialog = !Exists(window); if (HasHandledFileDownloadDialog) { Logger.LogAction("Download started at " + DateTime.Now.ToLongTimeString()); Logger.LogAction("Clicked " + _optionEnum.ToString()); } return true; } // This if handles the download progress dialog if (IsDownloadProgressDialog(window)) { DownloadProgressDialog = window; WinButton openOrRun= new WinButton(4377, new Hwnd(window.Hwnd)); if (openOrRun.Enabled) { WinButton close = new WinButton(2, new Hwnd(window.Hwnd)); close.Click(); SimpleTimer timer = new SimpleTimer(5); while (!timer.Elapsed && window.Exists()) { Thread.Sleep(200); } } return true; } // This if handles the File save as dialog if (IsFileSaveDialog(window)) { Logger.LogAction("Saving Download file as " + saveAsFilename); DownloadProgressDialog = new Window(window.ParentHwnd); HandleFileSaveDialog(window); return true; } // Window is not a dialog this handler can handle. return false; }
/// <summary> /// Determines if a dialog still exists by checking the the existance of the /// window.Hwnd and checking if the window is visible. /// </summary> /// <param name="dialog">The dialog.</param> /// <returns><c>true</c> if exists and visible, otherwise <c>false</c></returns> public bool Exists(Window dialog) { return dialog.Exists() && dialog.Visible; // bool exists = dialog.Exists(); // Logger.LogAction("Exists: exists == " + exists.ToString()); // // bool visible = dialog.Visible; // Logger.LogAction("Exists: visible == " + visible.ToString()); // // return exists && visible; }