示例#1
0
        private void HandleMouseMovements()
        {
            if (!_capturing)
            {
                return;
            }

            try
            {
                Point p = MouseOp.GetMousePos();

                if (_html == null)
                {
                    _html = new HTMLTestPlugin();
                    _ts   = _html.CreateTestSession() as HTMLTestSession;
                }

                IntPtr curHandle = Win32API.WindowFromPoint(p.X, p.Y);
                if (curHandle != _lastHandle)
                {
                    _lastHandle  = curHandle;
                    _isSupported = _html.IsSupportedApp(curHandle);
                    if (_isSupported)
                    {
                        _ts.Browser.Find(curHandle);
                        //_ts.Event.OnMouseOver += new TestObjectEventHandler(Event_OnMouseOver);
                    }
                }

                if (_isSupported)
                {
                    TestObject obj = _ts.Objects.ObjectPool.GetObjectByPoint(p.X, p.Y, true);

                    if (!obj.Equals(_lastObj))
                    {
                        Thread t = new Thread(new ParameterizedThreadStart(SetText));
                        t.Start(obj);
                        _lastObj = obj;
                    }
                    else
                    {
                        IVisible v = obj as IVisible;
                        v.HighLight();
                    }
                }
            }
            catch
            {
            }
        }
示例#2
0
 void Event_OnMouseOver(TestObject sender, TestEventArgs e)
 {
     if (_isSupported)
     {
         if (!sender.Equals(_lastObj))
         {
             Thread t = new Thread(new ParameterizedThreadStart(SetText));
             t.Start(sender);
             _lastObj = sender;
         }
         else
         {
             IVisible v = sender as IVisible;
             v.HighLight(1000);
         }
     }
 }