private void ConvertCompleted(ImageConverter cp) // Called on UI thread { if (cp.Converted && cp.CopyToClipboard) { using (Image bmp = Bitmap.FromFile(cp.OutputFilename)) { try { Clipboard.SetImage(bmp); } catch { _discoveryForm.LogLineHighlight("Copying image to clipboard failed"); } } } if (cp.Preview) // if preview, load in { pictureBox.ImageLocation = cp.OutputFilename; pictureBox.SizeMode = PictureBoxSizeMode.StretchImage; } OnScreenShot?.Invoke(cp.OutputFilename, cp.FinalSize); }
private void ConvertCompleted(ScreenShotImageConverter cp) // Called by the watcher when a convert had completed, in UI thread { System.Diagnostics.Debug.Assert(Application.MessageLoop); if (cp.Converted && cp.CopyToClipboard) { using (Image bmp = Bitmap.FromFile(cp.OutputFilename)) { try { Clipboard.SetImage(bmp); } catch { discoveryform.LogLineHighlight("Copying image to clipboard failed"); } } } OnScreenShot?.Invoke(cp.OutputFilename, cp.FinalSize); }