Exemple #1
0
        public void TryPasteImage()
        {
            form.InvokeSafe(() => {
                if (Clipboard.ContainsImage())
                {
                    Image img = Clipboard.GetImage();
                    if (img == null)
                    {
                        return;
                    }

                    try{
                        Directory.CreateDirectory(Program.TemporaryPath);

                        ClipboardImagePath = Path.Combine(Program.TemporaryPath, "TD-Img-" + DateTime.Now.Ticks + ".png");
                        img.Save(ClipboardImagePath, ImageFormat.Png);

                        form.OnImagePasted();
                    }catch (Exception e) {
                        Program.Reporter.HandleException("Clipboard Image Error", "Could not paste image from clipboard.", true, e);
                    }
                }
            });
        }