Exemplo n.º 1
0
        private void ClipboardBbutton_Click(object sender, System.EventArgs e)
        {
            var bitmap = Box.Image;

            if (!String.IsNullOrEmpty(Settings.Current.WaterMark))
            {
                bitmap = TextInstrument.DrawWaterMark(bitmap);
            }
            Clipboard.SetImage(bitmap);
            Close();
        }
Exemplo n.º 2
0
        private void SaveButton_Click(object sender, System.EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog {
                Filter = "PNG|*.png"
            };

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                var bitmap = Box.Image;
                if (!String.IsNullOrEmpty(Settings.Current.WaterMark))
                {
                    bitmap = TextInstrument.DrawWaterMark(bitmap);
                }
                var pngBuffer = Clipper.GetPng((Bitmap)bitmap);
                System.IO.File.WriteAllBytes(dlg.FileName, pngBuffer);
                Clipboard.SetText(dlg.FileName);
                Close();
            }
        }
Exemplo n.º 3
0
        public void Process(Bitmap bitmap)
        {
            SaveLastScreenshot(bitmap);

            bitmap = EditScreenshot(bitmap);

            if (Settings.Current.DrawWaterMark)
            {
                bitmap = (Bitmap)TextInstrument.DrawWaterMark(bitmap);
            }

            string url = UploadScreenshot(bitmap);

            if (Settings.Current.ShortenUrl)
            {
                url = ShortenUrl(url);
            }

            var success = url != null && url.StartsWith("http");

            if (success)
            {
                SetClipboard(url);

                OpenBrowser(url);

                LogScreenshotUrl(url);
            }

            SetSuccessToEnvironment(success, url);

            if (!success)
            {
                MessageBox.Show("Failed to upload, try again later.");
            }

            Clipper.Terminate();
        }