private bool HandleCtrlPress(Key e)
        {
            if (isHotKeysDisable)
            {
                return(false);
            }

            switch (e)
            {
            case Key.Space:
                currentCommand = KeyboardCommand.Search;
                App.ClipBoardHook.CopyFromActiveProgram();
                return(true);

            case Key.R:
                currentCommand = KeyboardCommand.OCRSentences;
                SnippingTool.Snip();
                return(true);

            case Key.D1:
                currentCommand = KeyboardCommand.OCROneLetter;
                SnippingTool.Snip();
                return(true);

            case Key.T:
                currentCommand = KeyboardCommand.TTS;
                App.ClipBoardHook.CopyFromActiveProgram();
                return(true);

            default:
                return(false);
            }
        }
Exemple #2
0
        private void snippingToolButton_Click(object sender, EventArgs e)
        {
            if (VideoSettings == null)
            {
                return;
            }
            var captureDevice = VideoSettings.CaptureDevice;
            var screenCapture = captureDevice as ScreenCaptureDevice;

            if (captureDevice == null)
            {
                return;
            }

            var selectedRegion = SnippingTool.Snip(screenCapture.DisplayRegion);

            if (!selectedRegion.IsEmpty)
            {
                this.captureRegion = selectedRegion;

                this.captureRegionTextBox.Text = captureRegion.ToString();
            }
            else
            {// error, cancelled...
            }
        }
Exemple #3
0
        public void NewScreenshot(SnippingTool.ScreenshotType type)
        {
            Image bmp = SnippingTool.Snip(type);

            if (bmp != null)
            {
                frm_main newFrmMain = new frm_main(bmp, trayIcon);
                newFrmMain.ShowDialog();
            }
        }
Exemple #4
0
        public void OnSnap(object sender, EventArgs e)
        {
            if (snippingTool?.IsSnapping ?? false)
            {
                return;
            }

            snippingTool = new SnippingTool();
            snippingTool.TakeSnap();
        }
        private void BtnPotPositionCapture_Click(object sender, EventArgs e)
        {
            MainForm form = Parent.Parent.Parent.Parent as MainForm;

            form.StatusLabel.Text = Env.ProgramName;

            // Close all open tabs
            AutoClickHandlers.SendKeyPress(HWnd, Keys.Space, 300);

            // Open inventory
            AutoClickHandlers.SendKeyPress(HWnd, Keys.V, 300);

            SnippingTool.AreaSelected += OnAreaSelected;
            SnippingTool.Snip(HWnd);
        }
            public static System.Drawing.Image Snip()
            {
                var rc = Screen.PrimaryScreen.Bounds;

                using (Bitmap bmp = new Bitmap(rc.Width, rc.Height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb))
                {
                    using (Graphics gr = Graphics.FromImage(bmp))
                        gr.CopyFromScreen(0, 0, 0, 0, bmp.Size);
                    using (var snipper = new SnippingTool(bmp))
                    {
                        if (snipper.ShowDialog() == DialogResult.OK)
                        {
                            return(snipper.Image);
                        }
                    }
                    return(null);
                }
            }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            this.Hide();
            var bmp = SnippingTool.Snip();

            if (bmp != null)
            {
                if (System.IO.File.Exists(Directory.GetCurrentDirectory() + "\\scan.jpg"))
                {
                    System.IO.File.Delete(Directory.GetCurrentDirectory() + "\\scan.jpg");
                }
                bmp.Save(Directory.GetCurrentDirectory() + "\\scan.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
                this.Show();
                thread_xulyocr = new Thread(() => threadxulyocr());
                thread_xulyocr.IsBackground = true;
                thread_xulyocr.Start();
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            App.Current.MainWindow.Hide();
            var bmp = SnippingTool.Snip();

            WindowState = WindowState.Normal;
            int indexarr = Array.IndexOf(langarrmini, currentocrlang);

            if (bmp != null)
            {
                thread7 = new Thread(() => OpenLoadingBox());
                thread7.SetApartmentState(ApartmentState.STA);
                thread7.IsBackground = true;
                thread7.Start();
                if (System.IO.File.Exists(Directory.GetCurrentDirectory() + "\\data\\Capture2Text\\kq.jpg"))
                {
                    System.IO.File.Delete(Directory.GetCurrentDirectory() + "\\data\\Capture2Text\\kq.jpg");
                }
                //System.Windows.Forms.MessageBox.Show("-i " + Directory.GetCurrentDirectory() + "\\data\\Capture2Text\\kq.jpg" + " -l " + langarr[indexarr] + " -o data\\kq.txt");
                bmp.Save(Directory.GetCurrentDirectory() + "\\data\\Capture2Text\\kq.jpg", ImageFormat.Jpeg);
                bmp.Dispose();
                var proc = new Process
                {
                    StartInfo = new ProcessStartInfo
                    {
                        FileName               = "data\\Capture2Text\\Capture2Text_CLI.exe",
                        Arguments              = "-i data\\Capture2Text\\kq.jpg" + " -l " + @"""" + langarr[indexarr] + @"""" + " -o data\\kq.txt",
                        UseShellExecute        = false,
                        RedirectStandardOutput = true,
                        CreateNoWindow         = true
                    }
                };
                proc.Start();
                proc.WaitForExit();
                string kqorc = File.ReadAllText("data\\kq.txt", Encoding.UTF8);
                thread6 = new Thread(() => OpenTextBox(kqorc, "Auto", currentlang, data["option"]["lang"]));
                thread6.IsBackground = true;
                App.Current.MainWindow.Show();
                thread6.Start();
                CloseLoadingBox(UI_Loading);
            }
        }
 private bool KeyPressed(Key e)
 {
     if (e == Key.Escape)
     {
         if (SnippingTool.IsCapturing)
         {
             SnippingTool.CancelSnipping();
         }
     }
     else if ((Keyboard.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift)) ||
              (Keyboard.Modifiers == ModifierKeys.Shift && UserPrefs.IsOmitCtrl))
     {
         return(HandleCtrlShiftPress(e));
     }
     else if (UserPrefs.IsOmitCtrl || Keyboard.Modifiers == ModifierKeys.Control)
     {
         return(HandleCtrlPress(e));
     }
     return(false);
 }
Exemple #10
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            // Find the window that contains the control


            // Minimize

            window.WindowState = WindowState.Minimized;
            height             = window.Height;
            width         = window.Width;
            window.Height = 0;
            window.Width  = 0;
            Thread.Sleep(1000);
            //  owa = (Image_Capture)this.ModelItem.GetCurrentValue();
            string _imageId = Guid.NewGuid().ToString();

            owa.ImageId = _imageId;
            Bitmap   printscreen = new Bitmap(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            Graphics graphics    = Graphics.FromImage(printscreen);

            graphics.CopyFromScreen(0, 0, 0, 0, printscreen.Size);
            SnippingTool.ImageBMP = printscreen;
            try
            {
                using (MemoryStream s = new MemoryStream())
                {
                    //save graphic variable into memory
                    printscreen.Save(s, ImageFormat.Bmp);
                    SnippingTool sn = new SnippingTool(System.Drawing.Image.FromStream(s), 0, 0, printscreen.Size.Width, printscreen.Size.Height);
                    //set the picture box with temporary stream
                    SnippingTool.UniqueId = _imageId;
                    SnippingTool.Snip();
                }
            }
            catch (Exception)
            {
            }
            //window.Height = height;
            //window.Width =width;
            //window.WindowState = WindowState.Normal;
        }
Exemple #11
0
        private void snippetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (!SnippingTool.Snip())
                {
                    return;
                }
            }
            catch
            {
                MessageBox.Show("Unable to use snipping tool. Try closing some tabs. If this continues, restart OSIRT.", "Unable to use snippet tool", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            using (Previewer imagePreviewer = new ImagePreviewer(Enums.Actions.Snippet, uiTabbedBrowserControl.CurrentTab.Browser.URL))
            {
                imagePreviewer.ShowDialog();
            }
            ImageDiskCache.RemoveItemsInCache();
        }
 private void OnOCRButtonClick(object sender, RoutedEventArgs e)
 {
     SnippingTool.Snip();
 }
Exemple #13
0
 private Bitmap UpdateScreenshot(Bitmap screenshot)
 {
     DisposeBitmap(screenshot);
     return(SnippingTool.CreateScreenshot());
 }
Exemple #14
0
 private bool OpenSnippingTool()
 {
     System.Threading.Thread.Sleep(300);
     return(SnippingTool.Snip(actSikuli.PatternPath));
 }