Esempio n. 1
0
 private void TimedScreenShot(object sender, System.Timers.ElapsedEventArgs e)
 {
     if (_selectedWindow != IntPtr.Zero)
     {
         Dispatcher.Invoke((Action)(() => { image.Source = null; }));
         var bitmap = WindowSnap.GetWindowSnap(_selectedWindow, true).Image;
         Dispatcher.Invoke((Action)(() => { image.Source = BitmapToImageSource(bitmap); }));
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Captures the image.
        /// </summary>
        public void CaptureImage()
        {
            Bitmap image = null;

            // if the show advanced is not visible;  then always capture the current area
            if (this.SelectedProcessItem == null || this.ShowAdvanced == false)
            {
                // capture only the background
                this.uiWindow.HideWin();
                image = WindowSnap.GetCurrentBackgroundScreenShot() as Bitmap;
                this.IsApplicationVisible = true;
                this.uiWindow.ShowWin();
            }
            else
            {
                var snap = WindowSnap.GetWindowSnap(this.SelectedProcessItem.WindowHandle, true);
                image = snap.Image;
            }

            string fileName = this.SaveImage(image as Bitmap);
        }
Esempio n. 3
0
        public Bitmap CaptureFrame(bool backgroundMode = true, bool cache = true)
        {
            if (this.CurrentFrame != null && cache)
            {
                this.CurrentFrame.Dispose();
            }
            Bitmap bitmap;

            if (backgroundMode)
            {
                WindowSnap windowSnap = WindowSnap.GetWindowSnap(this.Handle, true);
                bitmap = windowSnap.Image;
            }
            else
            {
                bitmap = ForegroundCapture.CaptureWindow(this.Handle);
            }
            if (cache)
            {
                this.CurrentFrame = bitmap;
            }
            return(bitmap);
        }