Exemple #1
0
 private void EndCapture(CaptureForm cform)
 {
     try
     {
         Console.WriteLine("Mainform EndCapture Start---");
         if (cform.DialogResult == DialogResult.OK)
         {
             using (Bitmap bitmap = cform.ClipBitmap)
             {
                 if (bitmap != null)
                 {
                     this.scrapBook.AddScrap(bitmap, cform.ClipStart.X, cform.ClipStart.Y, cform.ClipSize.Width, cform.ClipSize.Height);
                 }
             }
         }
         cform.Hide();
         Cursor.Clip = Rectangle.Empty;
         Console.WriteLine("Mainform EndCapture End---");
     }
     catch (Exception exception)
     {
         Console.WriteLine("MainForm EndCapture Exception:" + exception.Message);
     }
     finally
     {
         this.IsCapture = false;
         if (this.frmClickCapture != null)
         {
             this.frmClickCapture.Restart();
         }
     }
 }
Exemple #2
0
        private void CaptureWithFeedback()
        {
            // The following, to be precise the HideApp, causes the app to close as described in BUG-1620
            // Added check for metro (Modern UI) apps, which might be maximized and cover the screen.

            //foreach(WindowDetails app in WindowDetails.GetMetroApps()) {
            //	if (app.Maximised) {
            //		app.HideApp();
            //	}
            //}

            using (CaptureForm captureForm = new CaptureForm(_capture, _windows)) {
                // Make sure the form is hidden after showing, even if an exception occurs, so all errors will be shown
                DialogResult result;
                try {
                    result = captureForm.ShowDialog(MainForm.Instance);
                } finally {
                    captureForm.Hide();
                }
                if (result == DialogResult.OK)
                {
                    _selectedCaptureWindow = captureForm.SelectedCaptureWindow;
                    _captureRect           = captureForm.CaptureRectangle;
                    // Get title
                    if (_selectedCaptureWindow != null)
                    {
                        _capture.CaptureDetails.Title = _selectedCaptureWindow.Text;
                    }

                    if (_captureRect.Height > 0 && _captureRect.Width > 0)
                    {
                        // Take the captureRect, this already is specified as bitmap coordinates
                        _capture.Crop(_captureRect);

                        // save for re-capturing later and show recapture context menu option
                        // Important here is that the location needs to be offsetted back to screen coordinates!
                        Rectangle tmpRectangle = _captureRect;
                        tmpRectangle.Offset(_capture.ScreenBounds.Location.X, _capture.ScreenBounds.Location.Y);
                        CoreConfig.LastCapturedRegion = tmpRectangle;
                        HandleCapture();
                    }
                }
            }
        }
 private void OnTemplate(DPFP.Template template)
 {
     Template = template;
     if (Template != null)
     {
         MessageBox.Show("The fingerprint template is ready for fingerprint verification.", "Fingerprint Enrollment");
         Save.Enabled = true;
     }
     else
     {
         MessageBox.Show("The fingerprint template is not valid. Repeat fingerprint enrollment.", "Fingerprint Enrollment");
     }
     if (capture.getPrintImage() != null)
     {
         Bitmap bmp = capture.getPrintImage();
         pictureBox6.Image = bmp;
     }
     else
     {
     }
     capture.Hide();
 }
Exemple #4
0
		private void CaptureWithFeedback() {
			// The following, to be precise the HideApp, causes the app to close as described in BUG-1620 
			// Added check for metro (Modern UI) apps, which might be maximized and cover the screen.
			
			//foreach(WindowDetails app in WindowDetails.GetMetroApps()) {
			//	if (app.Maximised) {
			//		app.HideApp();
			//	}
			//}

			using (CaptureForm captureForm = new CaptureForm(_capture, _windows)) {
				// Make sure the form is hidden after showing, even if an exception occurs, so all errors will be shown
				DialogResult result = DialogResult.Cancel;
				try {
					result = captureForm.ShowDialog(MainForm.Instance);
				} finally {
					captureForm.Hide();
				}
				if (result == DialogResult.OK) {
					_selectedCaptureWindow = captureForm.SelectedCaptureWindow;
					_captureRect = captureForm.CaptureRectangle;
					// Get title
					if (_selectedCaptureWindow != null) {
						_capture.CaptureDetails.Title = _selectedCaptureWindow.Text;
					}

					if (_captureRect.Height > 0 && _captureRect.Width > 0) {
						// Take the captureRect, this already is specified as bitmap coordinates
						_capture.Crop(_captureRect);

						// save for re-capturing later and show recapture context menu option
						// Important here is that the location needs to be offsetted back to screen coordinates!
						Rectangle tmpRectangle = _captureRect;
						tmpRectangle.Offset(_capture.ScreenBounds.Location.X, _capture.ScreenBounds.Location.Y);
						conf.LastCapturedRegion = tmpRectangle;
						HandleCapture();
					}
				}
			}
		}