コード例 #1
0
        private void SnippetDialog_MouseUp(object sender, MouseEventArgs e)
        {
            _drawing = false;
            Hide();

            //ensures border is not captured
            _selectedArea.Inflate(-1, -1);

            SnippedImage = ScreenshotProvider.TakeScreenshot(_selectedArea);
            DialogResult = DialogResult.OK;
        }
コード例 #2
0
 public void TakeScreenshot()
 {
     if (scenarioContext.ScenarioExecutionStatus != ScenarioExecutionStatus.OK &&
         AqualityServices.IsApplicationStarted)
     {
         var pathToScreenshot = screenshotProvider.TakeScreenshot();
         TestContext.AddTestAttachment(pathToScreenshot);
         AllureLifecycle.Instance.AddAttachment(pathToScreenshot, "Screenshot");
         AqualityTrackingLifecycle.Instance.AddAttachment(pathToScreenshot);
     }
 }
コード例 #3
0
        private void CaptureActiveWindow()
        {
            IntPtr          winHandle = NativeMethods.GetForegroundWindow();
            NativeRectangle winRectangle;

            NativeMethods.GetWindowRect(winHandle, out winRectangle);
            Rectangle area = winRectangle.ToRectangle();

            Bitmap screenshot = ScreenshotProvider.TakeScreenshot(area);

            ProcessScreenshot(screenshot);
        }
コード例 #4
0
        private void CaptureArea()
        {
            var screenshot = ScreenshotProvider.TakeScreenshot(SystemInformation.VirtualScreen);
            var dialog     = new SelectAreaDialog(screenshot);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                Bitmap croppedScreenshot = screenshot.Clone(
                    dialog.SelectedArea,
                    screenshot.PixelFormat);
                ProcessScreenshot(croppedScreenshot);
            }
            dialog.Dispose();
        }
コード例 #5
0
        private void CaptureFullscreen()
        {
            Bitmap screenshot = ScreenshotProvider.TakeScreenshot(SystemInformation.VirtualScreen);

            ProcessScreenshot(screenshot);
        }