Exemplo n.º 1
0
 public void MouseActivity(object sender, MouseEventArgs e)
 {
     if ((e.Button.ToString().CompareTo("Left") == 0) && (disableClickCapture == false))
     {
         if (currentStage == FourStepStage.FIRST_TIME_RUN)
         {
             currentStage = FourStepStage.ON_SCAN;
             if (firstTimeRunDialog != null)
             {
                 firstTimeRunDialog.Close();
             }
         }
         if (currentStage == FourStepStage.ON_SCAN)
         {
             currentStage = FourStepStage.ON_ZOOM;
             rangeWindow.Show();
         } else if (currentStage == FourStepStage.ON_ZOOM)
         {
             currentStage = FourStepStage.ON_FINAL_CLICK;
             ZoomScreenshot();
         } else if (currentStage == FourStepStage.ON_FINAL_CLICK)
         {
             disableClickCapture = true;
             actionToPerform = 1;
             zoomedCursorPoint = new Point((int)(Cursor.Position.X / zoomLevel), (int)(Cursor.Position.Y / zoomLevel));
             afterActionDelay.Start();
         }
     }
 }
Exemplo n.º 2
0
        private void afterActionDelay_Tick(object sender, EventArgs e)
        {
            afterActionDelay.Enabled = false;
            afterActionDelay.Stop();
            this.Hide();
            currentStage = FourStepStage.ON_ZOOM;

            Cursor.Position = new Point(rangeWindow.Location.X + zoomedCursorPoint.X, rangeWindow.Location.Y + zoomedCursorPoint.Y);
            if (actionToPerform == 1)
            {
                mouse_event((int)(MouseEventFlags.LEFTDOWN | MouseEventFlags.LEFTUP), Cursor.Position.X, Cursor.Position.Y, 0, 0);
                //mouse_event((int)(MouseEventFlags.LEFTDOWN), Cursor.Position.X, Cursor.Position.Y, 0, 0);
                //mouse_event((int)(MouseEventFlags.LEFTUP), Cursor.Position.X, Cursor.Position.Y, 0, 0);
            }
            else if (actionToPerform == 2)
            {
                mouse_event((int)(MouseEventFlags.LEFTDOWN | MouseEventFlags.LEFTUP), Cursor.Position.X, Cursor.Position.Y, 0, 0);
                Thread.Sleep(100);
                mouse_event((int)(MouseEventFlags.LEFTDOWN | MouseEventFlags.LEFTUP), Cursor.Position.X, Cursor.Position.Y, 0, 0);
            }
            else if (actionToPerform == 3)
            {
                mouse_event((int)(MouseEventFlags.RIGHTDOWN | MouseEventFlags.RIGHTUP), Cursor.Position.X, Cursor.Position.Y, 0, 0);
            }
            else if (actionToPerform == 4)
            {
                //Nothing to do
            }

            Thread.Sleep(200); //Needed so Windows captures the click
            rangeWindow.Show();
            disableClickCapture = false;
        }
Exemplo n.º 3
0
 public void MouseActivity(object sender, MouseEventArgs e)
 {
     if ((e.Button.ToString().CompareTo("Left") == 0) && (disableClickCapture == false))
     {
         if (currentStage == FourStepStage.FIRST_TIME_RUN)
         {
             currentStage = FourStepStage.ON_SCAN;
             if (firstTimeRunDialog != null)
             {
                 firstTimeRunDialog.Close();
             }
         }
         if (currentStage == FourStepStage.ON_SCAN)
         {
             currentStage = FourStepStage.ON_ZOOM;
             rangeWindow.Show();
         }
         else if (currentStage == FourStepStage.ON_ZOOM)
         {
             currentStage = FourStepStage.ON_FINAL_CLICK;
             ZoomScreenshot();
         }
         else if (currentStage == FourStepStage.ON_FINAL_CLICK)
         {
             disableClickCapture = true;
             actionToPerform     = 1;
             zoomedCursorPoint   = new Point((int)(Cursor.Position.X / zoomLevel), (int)(Cursor.Position.Y / zoomLevel));
             afterActionDelay.Start();
         }
     }
 }
Exemplo n.º 4
0
        private void Main_Load(object sender, EventArgs e)
        {
            this.Hide();

            currentStage  = FourStepStage.FIRST_TIME_RUN;
            primaryScreen = Screen.PrimaryScreen;
            zoomLevel     = 4.0f;

            actHook = new UserActivityHook(true, true);                      //Create an instance with global hooks
            actHook.OnMouseActivity += new MouseEventHandler(MouseActivity); //Currently there is no mouse activity
            actHook.Start();

            //this.DoubleBuffered = true;
            //this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
            //this.UpdateStyles();

            firstTimeRunDialog = new FirstTimeRun();
            firstTimeRunDialog.Show();

            rangeWindow      = new RangeWindow();
            rangeWindow.Size = new Size((int)(primaryScreen.Bounds.Width / zoomLevel), (int)(primaryScreen.Bounds.Height / zoomLevel));
            //rangeWindow.Show();

            //cursorImage = Resources.cursor;

            //Uncomment to make clickable trough
            //int initialStyle = GetWindowLong(this.Handle, -20);
            //SetWindowLong(this.Handle, -20, initialStyle | 0x80000 | 0x20);

            //TakeScreenshot(); //Uncomment to take screeshot when program starts
        }
Exemplo n.º 5
0
 private void ResetFourSteps()
 {
     currentStage     = FourStepStage.ON_ZOOM;
     primaryScreen    = Screen.PrimaryScreen;
     rangeWindow      = new RangeWindow();
     rangeWindow.Size = new Size((int)(primaryScreen.Bounds.Width / zoomLevel), (int)(primaryScreen.Bounds.Height / zoomLevel));
     rangeWindow.Show();
 }
Exemplo n.º 6
0
 private void ResetFourSteps()
 {
     currentStage = FourStepStage.ON_ZOOM;
     primaryScreen = Screen.PrimaryScreen;
     rangeWindow = new RangeWindow();
     rangeWindow.Size = new Size((int)(primaryScreen.Bounds.Width / zoomLevel), (int)(primaryScreen.Bounds.Height / zoomLevel));
     rangeWindow.Show();
 }
Exemplo n.º 7
0
        private void Main_Load(object sender, EventArgs e)
        {
            this.Hide();

            currentStage = FourStepStage.FIRST_TIME_RUN;
            primaryScreen = Screen.PrimaryScreen;
            zoomLevel = 4.0f;

            actHook = new UserActivityHook(true, true); //Create an instance with global hooks
            actHook.OnMouseActivity += new MouseEventHandler(MouseActivity); //Currently there is no mouse activity
            actHook.Start();

            //this.DoubleBuffered = true;
            //this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
            //this.UpdateStyles();

            firstTimeRunDialog = new FirstTimeRun();
            firstTimeRunDialog.Show();

            rangeWindow = new RangeWindow();
            rangeWindow.Size = new Size((int)(primaryScreen.Bounds.Width / zoomLevel), (int)(primaryScreen.Bounds.Height / zoomLevel));
            //rangeWindow.Show();

            //cursorImage = Resources.cursor;

            //Uncomment to make clickable trough
            //int initialStyle = GetWindowLong(this.Handle, -20);
            //SetWindowLong(this.Handle, -20, initialStyle | 0x80000 | 0x20);

            //TakeScreenshot(); //Uncomment to take screeshot when program starts
        }
Exemplo n.º 8
0
        private void afterActionDelay_Tick(object sender, EventArgs e)
        {
            afterActionDelay.Enabled = false;
            afterActionDelay.Stop();
            this.Hide();
            currentStage = FourStepStage.ON_ZOOM;

            Cursor.Position = new Point(rangeWindow.Location.X + zoomedCursorPoint.X, rangeWindow.Location.Y + zoomedCursorPoint.Y);
            if (actionToPerform == 1)
            {
                mouse_event((int)(MouseEventFlags.LEFTDOWN | MouseEventFlags.LEFTUP), Cursor.Position.X, Cursor.Position.Y, 0, 0);
                //mouse_event((int)(MouseEventFlags.LEFTDOWN), Cursor.Position.X, Cursor.Position.Y, 0, 0);
                //mouse_event((int)(MouseEventFlags.LEFTUP), Cursor.Position.X, Cursor.Position.Y, 0, 0);
            }
            else if (actionToPerform == 2)
            {
                mouse_event((int)(MouseEventFlags.LEFTDOWN | MouseEventFlags.LEFTUP), Cursor.Position.X, Cursor.Position.Y, 0, 0);
                Thread.Sleep(100);
                mouse_event((int)(MouseEventFlags.LEFTDOWN | MouseEventFlags.LEFTUP), Cursor.Position.X, Cursor.Position.Y, 0, 0);
            }
            else if (actionToPerform == 3)
            {
                mouse_event((int)(MouseEventFlags.RIGHTDOWN | MouseEventFlags.RIGHTUP), Cursor.Position.X, Cursor.Position.Y, 0, 0);
            }
            else if (actionToPerform == 4)
            {
                //Nothing to do
            }

            Thread.Sleep(200); //Needed so Windows captures the click
            rangeWindow.Show();
            disableClickCapture = false;
        }