Beispiel #1
0
        public void Click()
        {
            int x, y, width, height;

            IAcc.accLocation(out x, out y, out width, out height, 0);
            SUIMouse.MouseClick(x, y);
        }
Beispiel #2
0
 public void ClickSelect(int index)
 {
     if (this.SelectedIndex != index)
     {
         if (IsDropDown)
         {
             SUIMouse.MouseClick(this, this.Width - this.X - 5, (this.Height - this.Y) / 2);
         }
         else
         {
             this.Focus();
         }
         int offset = index - this.SelectedIndex;
         if (offset > 0)
         {
             for (int i = 0; i < offset; i++)
             {
                 SUIKeyboard.Type(SUI.Base.Win.SUIKeyboard.VK.DOWN);
             }
         }
         else
         {
             offset = Math.Abs(offset);
             for (int j = 0; j < offset; j++)
             {
                 SUIKeyboard.Type(SUI.Base.Win.SUIKeyboard.VK.UP);
             }
         }
         SUISleeper.Sleep(500);
         if (IsDropDown)
         {
             SUIKeyboard.Type(SUI.Base.Win.SUIKeyboard.VK.RETURN);
         }
     }
 }
        public void Click()
        {
            RECT rect = Rect;

            SUIMouse.MouseClick(ListView, (int)((Rect.left + Rect.right) / 2), (int)((Rect.top + Rect.bottom) / 2));

            //some listview require must click on the Text,and in general,text is left align,so add 30 offset as a tempory solution at present.
            SUIMouse.MouseClick(ListView, (int)(Rect.left + 30), (int)((Rect.top + Rect.bottom) / 2));
        }
Beispiel #4
0
        public void ClickItem(int index)
        {
            if (index < 0 || index >= Count)
            {
                throw new SUIException("Index is out of range!");
            }

            RECT rect = GetItemRECT(index);

            SUIMouse.MouseClick(this, rect.left + 5, rect.top + 5);
        }
Beispiel #5
0
        public void TypeText(string str)
        {
            SUIMouse.MouseClick(this, (int)((Width - X) / 2), (int)((Height - Y) / 2));

            //Clear exsting text.
            SUIKeyboard.Press(SUIKeyboard.VK.CONTROL);
            SUIKeyboard.Type(SUIKeyboard.VK.HOME);
            SUIKeyboard.Release(SUIKeyboard.VK.CONTROL);

            int textLeng = Text.Length;

            for (int i = 0; i < textLeng; i++)
            {
                SUIKeyboard.Type(SUIKeyboard.VK.DELETE);
            }

            SUIKeyboard.Type(str);
        }
Beispiel #6
0
        //Sometimes, it needs a few seconds to initialize context menu and show it.
        //So I add a timeout parameter for this operation.
        public static SUIPopupMenu MouseRightClick(SUIWindow window, string strWindowsText, int x, int y, int timeout)
        {
            SUIMouse.MouseRightClick(window, x, y);

            SUIWindow win = null;

            while (win == null && timeout > 0)
            {
                SUISleeper.Sleep(200);
                win = SUIWindow.DesktopWindow.FindChildWindow("#32768", strWindowsText);
                timeout--;
            }

            if (win == null)
            {
                throw new SUIException("Fail to find context menus!");
            }

            return(new SUIPopupMenu(win));
        }
Beispiel #7
0
        //Sometimes, it needs a few seconds to initialize context menu and show it.
        //So I add a timeout parameter for this operation.
        public static SUIMsoCommandBarPopup MouseRightClick(SUIWindow window, string strWindowsText, int x, int y, int timeout)
        {
            SUIMouse.MouseRightClick(window, x, y);

            SUIWindow win = null;

            while (win == null && timeout > 0)
            {
                SUISleeper.Sleep(200);
                win = SUIWindow.DesktopWindow.FindChildWindow(WindowClass, strWindowsText);
                timeout--;
            }

            if (win == null)
            {
                return(null);
            }

            return(new SUIMsoCommandBarPopup(win));
        }
Beispiel #8
0
        public void SelectText(string text, int index)
        {
            Graphics g    = Graphics.FromHwnd(WindowHandle);
            IntPtr   hdc  = g.GetHdc();
            Size     size = new Size();

            SUIWinAPIs.GetTextExtentPoint32(hdc, text, text.Length, out size);
            g.ReleaseHdc();
            Point p = SUIAccessibility.GetPositionFromTextIndex(this.WindowHandle, text, index);

            if (p.X < 0 || p.Y < 0)
            {
                SUISleeper.Sleep(2000);
                p = SUIAccessibility.GetPositionFromTextIndex(this.WindowHandle, text, index);
            }
            if (p.X > 0 && p.Y > 0)
            {
                SUIMouse.MouseClick(this, p.X + size.Width / 2, p.Y + size.Height / 2);
            }
            else
            {
                throw new Exception("Can not locate expected string " + text + ".");
            }
        }
Beispiel #9
0
 public void Click()
 {
     SUIMouse.MouseClick(this, (Width - X) / 2, (Height - Y) / 2);
 }
Beispiel #10
0
 public void RClick()
 {
     SUIMouse.MouseRightClick(treeView, (int)((Rectangle.X + Rectangle.Width) / 2), (int)((Rectangle.Y + Rectangle.Height) / 2));
 }
Beispiel #11
0
 public void MouseMoveTo()
 {
     SUIMouse.MouseMove(new SUIWindow(toolbar), (int)((Rectangle.X + Rectangle.Width) / 2), (int)((Rectangle.Y + Rectangle.Height) / 2));
     SUISleeper.Sleep(1000);
 }
Beispiel #12
0
 public void ClickToSelectNode(SUITreeViewNode node)
 {
     SelectNode(node);
     SUIMouse.MouseClick(this, node.Rectangle.X + 5, node.Rectangle.Y + 5);
 }
Beispiel #13
0
        // minimize window

        public void DoubleClick(int x, int y)
        {
            SUIMouse.MouseDoubleClick(this, x, y);
        }
Beispiel #14
0
 public void ClickWindow(int x, int y)
 {
     SUIMouse.MouseClick(this, x, y);
 }
Beispiel #15
0
 public void ClickWindow(int x, int y, int nFlags)
 {
     this.Focus();
     SUISleeper.Sleep(2000);
     SUIMouse.MouseClick(this, x, y, nFlags);
 }
Beispiel #16
0
        public void ClickItem(int index)
        {
            RECT itemRect = GetItemRect(index);

            SUIMouse.MouseClick(this, (int)((itemRect.left + itemRect.right) / 2), (int)((itemRect.top + itemRect.bottom) / 2));
        }
Beispiel #17
0
 public void SelectTab(int index)
 {
     //IAcc.accSelect(3,index +1);
     //return SelectedTab;
     SUIMouse.MouseClick(TabItems[index].Rect.X + 5, TabItems[index].Rect.Y + 5);
 }
Beispiel #18
0
 public void Click()
 {
     Focus();
     SUISleeper.Sleep(1000);
     SUIMouse.MouseClick(this, (Width - X) / 2, (Height - Y) / 2);
 }