Exemplo n.º 1
0
        /// <summary>
        /// Select the first row by text in the given column.
        /// </summary>
        public DataGridRow Select(int columnIndex, string textToFind)
        {
            var gridRow = this.GetRowByValue(columnIndex, textToFind);

            if (WindowsVersion.IsWindows7())
            {
                gridRow.Cells[0].Click();
            }
            else
            {
                gridRow.Select();
            }

            return(gridRow);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Select a row by index.
        /// </summary>
        public DataGridRow Select(int rowIndex)
        {
            var gridRow = this.GetRowByIndex(rowIndex);

            if (WindowsVersion.IsWindows7())
            {
                gridRow.Cells[0].Click();
            }
            else
            {
                gridRow.Select();
            }

            return(gridRow);
        }
Exemplo n.º 3
0
        public void Close()
        {
            this.WaitUntilResponsive();
            if (!WindowsVersion.IsWindows7())
            {
                var closeButton = this.TitleBar?.CloseButton;
                if (closeButton != null)
                {
                    closeButton.Invoke();
                    return;
                }
            }

            this.AutomationElement.WindowPattern().Close();
        }
Exemplo n.º 4
0
        private static void SendInput(int x, int y, uint data, MouseEventFlags flags)
        {
            // Demand the correct permissions
            var permissions = new PermissionSet(PermissionState.Unrestricted);

            permissions.Demand();

            // Check if we are trying to do an absolute move
            if (flags.HasFlag(MouseEventFlags.MOUSEEVENTF_ABSOLUTE))
            {
                // Absolute position requires normalized coordinates
                NormalizeCoordinates(ref x, ref y);
                flags |= MouseEventFlags.MOUSEEVENTF_VIRTUALDESK;
            }

            // Build the input object
            var input = new INPUT
            {
                type = InputType.INPUT_MOUSE,
                u    = new INPUTUNION
                {
                    mi = new MOUSEINPUT
                    {
                        dx          = x,
                        dy          = y,
                        mouseData   = data,
                        dwExtraInfo = User32.GetMessageExtraInfo(),
                        time        = 0,
                        dwFlags     = flags,
                    },
                },
            };

            // Send the command
            if (User32.SendInput(1, new[] { input }, INPUT.Size) == 0)
            {
                throw new Win32Exception();
            }

            if (WindowsVersion.IsWindows10())
            {
                Wait.For(TimeSpan.FromMilliseconds(10));
            }
        }
Exemplo n.º 5
0
        public void Close()
        {
            this.WaitUntilResponsive();
            if (!WindowsVersion.IsWindows7())
            {
                var closeButton = this.TitleBar?.CloseButton;
                if (closeButton != null)
                {
                    closeButton.Invoke();
                    return;
                }
            }

            var windowPattern = this.Patterns.Window.PatternOrDefault;

            if (windowPattern != null)
            {
                windowPattern.Close();
                return;
            }

            throw new MethodNotSupportedException("Close is not supported");
        }