private async void Window_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            StartPosition = true;
            MarkStart     = false;
            Hide_window();
            await Task.Delay(50);//

            endV   = MouseHook.getEndValue();
            startV = MouseHook.getStartValue();
            this.Hide();
            _snippingTool = new SnippingTool();
            _snippingTool.snippingTool(startV, endV);
        }
        bool FirstStart = true; //pierwsze wykonanie
        public void MouseHookOn()
        {
            if (Keyboard.IsKeyDown(Key.LeftCtrl) && Keyboard.IsKeyDown(Key.Q) && Properties.Settings.Default.SnippCheck == true && SnippCondition == true)
            {
                SnippCondition                   = false;
                snippingtoolwindow.Topmost       = true;
                snippingtoolwindow.ShowInTaskbar = false;
                snippingtoolwindow.Width         = System.Windows.SystemParameters.VirtualScreenWidth;
                snippingtoolwindow.Height        = System.Windows.SystemParameters.VirtualScreenHeight;
                //setting position of window
                //var desktopWorkingArea = System.Windows.SystemParameters.WorkArea;

                POINT startV;
                POINT endV;
                startV.x      = 0;
                startV.y      = 0;
                endV.x        = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
                endV.y        = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;
                _screenFreeze = new ScreenFreeze();
                Mainbitmap    = _screenFreeze.GetScreen(startV, endV);
                System.Drawing.Rectangle r = new System.Drawing.Rectangle(0, 0, Mainbitmap.Width, Mainbitmap.Height);
                //Make screen darker
                int alpha = 128;
                using (Graphics g = Graphics.FromImage(Mainbitmap))
                {
                    using (Brush cloud_brush = new SolidBrush(Color.FromArgb(alpha, Color.Black)))
                    {
                        g.FillRectangle(cloud_brush, r);
                    }
                }

                snippingtoolwindow.wholescreenimage.ImageSource = imageoperation.ImageSourceFromBitmap(Mainbitmap);  // converting bitmap to Media.Source
                snippingtoolwindow.WindowStartupLocation        = System.Windows.WindowStartupLocation.CenterOwner;
                if (FirstStart == true)
                {
                    snippingtoolwindow.Show();
                    snippingtoolwindow.Top  = System.Windows.SystemParameters.VirtualScreenTop;
                    snippingtoolwindow.Left = System.Windows.SystemParameters.VirtualScreenLeft;
                    FirstStart = false;
                }
                else
                {
                    snippingtoolwindow.Top  = System.Windows.SystemParameters.VirtualScreenTop;
                    snippingtoolwindow.Left = System.Windows.SystemParameters.VirtualScreenLeft;
                    snippingtoolwindow.Show();
                }

                MouseHook.Start();
            }
        }
Ejemplo n.º 3
0
        public async void CloudNotificationClipboardAlert()
        {
            MouseHook.Start();
            CloudNotification cn = new CloudNotification();

            cn.Topmost       = true;
            cn.ShowInTaskbar = false;
            await Task.Delay(20);

            cn.Show();
            await Task.Delay(2200);

            cn.Close();
            MouseHook.stop();
        }
 private void Window_MouseMove(object sender, MouseEventArgs e)
 {
     if (MarkStart == true)
     {
         if (StartPosition == true)
         {
             sourceX = Convert.ToInt32(System.Windows.SystemParameters.VirtualScreenLeft);
             sourceY = Convert.ToInt32(System.Windows.SystemParameters.VirtualScreenTop);
             this.MarkingSquare.Visibility = System.Windows.Visibility.Visible;
             startV = MouseHook.getStartValue();
             this.MarkingSquare.Margin = new Thickness(-sourceX + startV.x, -sourceY + startV.y, 0, 0);
         }
         StartPosition = false;
         Marking();
     }
 }
        public void Marking()
        {
            endV    = MouseHook.getMousePosition();
            startV  = MouseHook.getStartValue();
            sourceX = Convert.ToInt32(System.Windows.SystemParameters.VirtualScreenLeft);
            sourceY = Convert.ToInt32(System.Windows.SystemParameters.VirtualScreenTop);

            if (startV.x > endV.x && startV.y < endV.y)
            {
                this.MarkingSquare.Margin = new Thickness(-sourceX + endV.x, -sourceY + startV.y, 0, 0);
                this.MarkingSquare.Width  = startV.x - endV.x;
                this.MarkingSquare.Height = endV.y - startV.y;
                return;
            }
            else if (startV.x < endV.x && startV.y > endV.y)
            {
                this.MarkingSquare.Width  = endV.x - startV.x;
                this.MarkingSquare.Height = startV.y - endV.y;
                this.MarkingSquare.Margin = new Thickness(-sourceX + startV.x, -sourceY + endV.y, 0, 0);
                return;
            }
            else if (startV.x > endV.x && startV.y > endV.y)
            {
                this.MarkingSquare.Margin = new Thickness(-sourceX + endV.x, -sourceY + endV.y, 0, 0);
                this.MarkingSquare.Width  = startV.x - endV.x;
                this.MarkingSquare.Height = startV.y - endV.y;
                return;
            }
            else if (startV.x == endV.x || startV.y == endV.y)
            {
                this.MarkingSquare.Width = 0;
                return;
            }
            else
            {
                this.MarkingSquare.Width  = endV.x - startV.x;
                this.MarkingSquare.Height = endV.y - startV.y;
                return;
            }
        }
Ejemplo n.º 6
0
 public void snippingTool(POINT startV, POINT endV)
 {
     MouseHook.stop();
     _screenSave = new ScreenshotSave();
     _screenSave.CaptureMyScreen(startV, endV);
 }