public void CreateImageFromBitmap(System.Windows.Media.Imaging.BitmapSource bitmap) { var imageWindow = new Utils.CapturedImage(); this.imageWindows.Add(imageWindow); imageWindow.Owner = this; imageWindow.SetImage(bitmap); imageWindow.SetName(this.GenerateNewImageName()); imageWindow.Show(); }
private void CaptureFromDiskButton_Click(object sender, RoutedEventArgs e) { using (var screenshot = new Utils.Movable <System.Drawing.Bitmap>(Utils.ScreenShooting.LoadImage())) { if (screenshot.Get() != null) { var imageWindow = new Utils.CapturedImage(); this.imageWindows.Add(imageWindow); imageWindow.Owner = this; imageWindow.SetImage(screenshot.Release()); imageWindow.SetName(this.GenerateNewImageName()); imageWindow.Show(); } } }
private void CaptureFromClipboard() { try { using (var screenshot = new Utils.Movable <System.Drawing.Bitmap>(Utils.ScreenShooting.CaptureImageFromClipboard())) { var imageWindow = new Utils.CapturedImage(); this.imageWindows.Add(imageWindow); imageWindow.Owner = this; imageWindow.SetImage(screenshot.Release()); imageWindow.SetName(this.GenerateNewImageName()); imageWindow.Show(); } } catch (System.NullReferenceException) { MessageBox.Show("There is no valid image in the Clipboard", "Failure", MessageBoxButton.OK); } }