Пример #1
0
        /// <summary>
        /// Handles the different types of mouse event based on
        /// what mode the module is currently in.
        /// </summary>
        void MouseEvent()
        {
            // Send an event
            Win32Services.MouseClick(SelectedMode.flags, SelectedMode.dwData);

            switch (SelectedMode.specialID)
            {
            case 1:     // Double Click
                Win32Services.MouseClick(SelectedMode.flags);
                break;

            case 2:     // Drag click
                dragging = true;
                break;

            case 3:     // Right click
                SelectedMode = MouseModes[0];
                break;

            case 4:                 // Scrolling
                scrolling      = true;
                exitThreshold *= 6; // just to stabilise the scrolling
                break;
            }
        }
Пример #2
0
 void Input(ref Win32Services.INPUT sI)
 {
     Win32Services.SendInput(1, ref sI, Marshal.SizeOf(sI));
 }
Пример #3
0
 /// <summary>
 /// Executed when the pointer is over certain UI elements,
 /// used to perform single clicks only.
 /// </summary>
 void SpecialEvent()
 {
     Win32Services.MouseClick(MouseModes[0].flags);
 }
Пример #4
0
        /// <summary>
        /// The main function of this module, handles the coordinates sent by the frame
        /// of data and activates the various mouse events depending on the current mode.
        /// </summary>
        public void HandleFrame(double x, double y)
        {
            if (!Touching)
            {
                if (progress == 0)
                {
                    anchor = new Point(x, y);
                }

                if (SumSqrDist(x, y, anchor.X, anchor.Y) > threshold)
                {
                    progress = 0;
                }
                else
                {
                    progress += eventspeed;
                }

                Win32Services.MoveCursor((int)x, (int)y);

                if (progress >= 100)
                {
                    // Allows for selection/dragging
                    if (dragging && !MouseOverControl)
                    {
                        Win32Services.MouseClick(MouseFlags.LEFTUP);
                        dragging = false;
                    }
                    else
                    {
                        // perform a single mouse click when over a control, otherwise use the mode
                        if (MouseOverControl)
                        {
                            SpecialEvent();
                        }
                        else
                        {
                            MouseEvent();
                        }
                    }

                    Touching = true;
                }
            }
            else
            {
                if (scrolling)
                {
                    Win32Services.MouseClick(SelectedMode.flags, SelectedMode.dwData);
                }

                if (SumSqrDist(x, y, anchor.X, anchor.Y) > exitThreshold)
                {
                    progress      = 0;
                    Touching      = false;
                    scrolling     = false;
                    exitThreshold = 6.0d;
                }

                Win32Services.MoveCursor((int)x, (int)y);
            }
        }
Пример #5
0
 void Input(ref Win32Services.INPUT sI)
 {
     Win32Services.SendInput(1, ref sI, Marshal.SizeOf(sI));
 }
Пример #6
0
        void Window_SourceInitialized(object sender, EventArgs e)
        {
            WindowInteropHelper helper = new WindowInteropHelper(this);

            Win32Services.SetupWindow(helper);
        }