Ejemplo n.º 1
0
        public void Drag()
        {
            Int32 x = Cursor.Position.X;
            Int32 y = Cursor.Position.Y;

            CloseWindows();

            MakeGrammarNotExclusive();
            DeactivateRule("post_plot");

            // Due to a problem with Dragon 15, rules we want to remain active
            // need to be explicitly re-activated when another is de-activated.
            ReactivateRule("mouse_plot");

            // If no start point has been selected, then don't do anything.
            if (_dragSet == false)
            {
                return;
            }

            // Show the arrow, wherever it was last time.
            _markArrowWindow.Show();

            var handle = Win32.WindowFromPoint(x, y);

            Win32.BringWindowToTop(handle);
            Win32.SetForegroundWindow(handle);

            Console.WriteLine($"Dragging from ({_dragAnchor.X}, {_dragAnchor.Y}) to ({x}, {y})");

            Mouse.Animate(x, y, _dragAnchor.X, _dragAnchor.Y, 50);
            Mouse.Down(MouseButtons.Left);

            Mouse.Animate(_dragAnchor.X, _dragAnchor.Y, x, y);
            Mouse.Up(MouseButtons.Left);

            CloseWindows();

            _isZoomed = false;
        }