/// <inheritdoc />
        public override bool WindowIsDialogInstance(Window candidateWindow)
        {
            bool windowIsDialog = false;
            IList<Window> buttons = candidateWindow.GetChildWindows(w => w.ClassName == WindowFactory.GetWindowClassForRole(AccessibleRole.PushButton, false));
            if (buttons.Count == 2 && candidateWindow.Text.StartsWith("Firefox - "))
            {
                windowIsDialog = true;
            }

            WindowFactory.DisposeWindows(buttons);
            return windowIsDialog;
        }
        /// <inheritdoc />
        public override bool WindowIsDialogInstance(Window candidateWindow)
        {
            bool windowIsDialog = candidateWindow.Text.ToLower().Contains("vbscript");
            if (windowIsDialog)
            {
                IList<Window> buttons = candidateWindow.GetChildWindows(w => w.ClassName == WindowFactory.GetWindowClassForRole(AccessibleRole.PushButton, true));
                IList<Window> staticLabel = candidateWindow.GetChildWindows(w => w.ClassName == WindowFactory.GetWindowClassForRole(AccessibleRole.Label, true) && w.ItemId == 0xFFFF);
                if (buttons.Count == 1 && buttons[0].ItemId == 2 && staticLabel.Count == 1)
                {
                    this.Kind = NativeDialogConstants.VBScriptOKOnlyDialog;
                    windowIsDialog = true;
                }
                else if (buttons.Count == 2 && staticLabel.Count == 1)
                {
                    this.Kind = NativeDialogConstants.VBScriptOKCancelDialog;
                    if (buttons[0].ItemId == 4 && buttons[1].ItemId == 2)
                    {
                        this.Kind = NativeDialogConstants.VBScriptRetryCancelDialog;
                    }
                    else if (buttons[0].ItemId == 6 && buttons[1].ItemId == 7)
                    {
                        this.Kind = NativeDialogConstants.VBScriptYesNoDialog;
                    }

                    windowIsDialog = true;
                }
                else if (buttons.Count == 3 && staticLabel.Count == 1)
                {
                    this.Kind = NativeDialogConstants.VBScriptYesNoCancelDialog;
                    if (buttons[0].ItemId == 3 && buttons[1].ItemId == 4 && buttons[2].ItemId == 5)
                    {
                        this.Kind = NativeDialogConstants.VBScriptAbortRetryIgnoreDialog;
                    }

                    windowIsDialog = true;
                }

                WindowFactory.DisposeWindows(buttons);
                WindowFactory.DisposeWindows(staticLabel);
            }

            return windowIsDialog;
        }
        /// <inheritdoc />
        public override bool WindowIsDialogInstance(Window candidateWindow)
        {
            bool windowIsDialog = false;
            Window sysCredentialWindow = this.GetSysCredentialWindow(candidateWindow);
            if (sysCredentialWindow != null)
            {
                windowIsDialog = true;
                sysCredentialWindow.Dispose();
            }

            return windowIsDialog;
        }
        private Window GetSysCredentialWindow(Window parentWindow)
        {
            Window sysCredentialWindow = null;
            IList<Window> credentialWindowList = parentWindow.GetChildWindows(w => w.ClassName == SysCredentialWindowClass);
            if (credentialWindowList.Count > 0)
            {
                sysCredentialWindow = credentialWindowList[0];
                credentialWindowList.Remove(sysCredentialWindow);
            }

            WindowFactory.DisposeWindows(credentialWindowList);
            return sysCredentialWindow;
        }
        /// <inheritdoc />
        public override bool WindowIsDialogInstance(Window candidateWindow)
        {
            bool windowIsDialog = false;
            IList<Window> childWindowList = candidateWindow.GetChildWindows(w => w.ClassName == AccessibleRole.PasswordText.ToString());
            if (childWindowList.Count > 0)
            {
                windowIsDialog = true;
            }

            WindowFactory.DisposeWindows(childWindowList);
            return windowIsDialog;
        }
Esempio n. 6
0
        /// <inheritdoc />
        public override bool IsDialogWindowFor(Window ownerWindow)
        {
            bool windowIsDialogForCandidate = false;
            IntPtr owner = X11WindowsNativeMethods.GetTransientForWindow(this.handle);
            if (owner == ownerWindow.Handle)
            {
                windowIsDialogForCandidate = true;
            }

            return windowIsDialogForCandidate;
        }
 /// <inheritdoc />
 public FFDialogManager(Window firefoxMainWindow, WindowEnumerationMethod childEnumerationMethod)
     : base(firefoxMainWindow, childEnumerationMethod)
 {
 }
Esempio n. 8
0
 /// <summary>
 /// Gets a value indicating whether this window is a dialog for the specified window.
 /// </summary>
 /// <param name="ownerWindow">The <see cref="Window"/> to test to see if this window is a dialog for.</param>
 /// <returns><see langword="true"/> if this window is a dialog for the specified window, otherwise <see langword="false"/>.</returns>
 public abstract bool IsDialogWindowFor(Window ownerWindow);
        /// <inheritdoc />
        public override bool WindowIsDialogInstance(Window candidateWindow)
        {
            bool windowIsDialog = false;
            if (!candidateWindow.Text.ToLower().Contains("vbscript"))
            {
                IList<Window> buttons = candidateWindow.GetChildWindows(w => w.ClassName == WindowFactory.GetWindowClassForRole(AccessibleRole.PushButton, true));
                IList<Window> staticLabel = candidateWindow.GetChildWindows(w => w.ClassName == WindowFactory.GetWindowClassForRole(AccessibleRole.Label, true) && w.ItemId == 0xFFFF);
                if (buttons.Count == 1 && buttons[0].ItemId == 2 && staticLabel.Count == 1)
                {
                    this.Kind = NativeDialogConstants.JavaScriptAlertDialog;
                    windowIsDialog = true;
                }
                else if (buttons.Count == 2 && buttons[0].ItemId == 1 && buttons[1].ItemId == 2 && staticLabel.Count == 1)
                {
                    this.Kind = NativeDialogConstants.JavaScriptConfirmDialog;
                    windowIsDialog = true;
                }

                WindowFactory.DisposeWindows(buttons);
                WindowFactory.DisposeWindows(staticLabel);
            }

            return windowIsDialog;
        }
        /// <inheritdoc />
        public override bool WindowIsDialogInstance(Window candidateWindow)
        {
            bool windowIsDialog = false;
            IList<Window> buttons = candidateWindow.GetChildWindows(w => w.ClassName == WindowFactory.GetWindowClassForRole(AccessibleRole.PushButton, false));
            IList<Window> staticLabel = candidateWindow.GetChildWindows(w => w.ClassName == this.messageLabelClass);
            if (buttons.Count == 1 && buttons[0].ItemId == this.okButtonId && staticLabel.Count == 1)
            {
                this.Kind = NativeDialogConstants.JavaScriptAlertDialog;
                windowIsDialog = true;
            }
            else if (buttons.Count == 2 && buttons[0].ItemId == this.okButtonId && buttons[1].ItemId == this.cancelButtonId && staticLabel.Count == 1)
            {
                this.Kind = NativeDialogConstants.JavaScriptConfirmDialog;
                windowIsDialog = true;
            }

            WindowFactory.DisposeWindows(buttons);
            WindowFactory.DisposeWindows(staticLabel);
            return windowIsDialog;
        }
 /// <inheritdoc />
 public override bool IsDialogWindowFor(Window ownerWindow)
 {
     bool windowIsDialogFor = false;
     windowIsDialogFor = (ownerWindow.Handle == this.OwnerHandle || ownerWindow.Handle == this.ParentHandle) && this.Visible;
     return windowIsDialogFor;
 }