示例#1
0
        private bool UploadPicture(string imgpath)
        {
            try
            {
                string result = PrntscrUploader.Upload(imgpath);
                Match  match  = Regex.Match(result, "data\":\"(.*?)\"");
                string uri    = match.Groups[1].Value;

                result =
                    new StreamReader(WebRequest.CreateHttp(uri.Replace(@"\", "")).GetResponse().GetResponseStream())
                    .ReadToEnd();
                match = Regex.Match(result, "<meta name=\"twitter:image:src\" content=\"(.*?)\"");
                uri   = match.Groups[1].Value;

                Clipboard.SetText(uri);
                notifyIcon1.ShowBalloonTip(1000, "Upload Completed",
                                           "Upload completed!\nLink got copied into your clipboard\n" + uri, ToolTipIcon.Info);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#2
0
        private void UploadPicture(Bitmap image)
        {
            try
            {
                string imageLink = new PrntscrUploader().Upload(image);

                Clipboard.SetText(imageLink);
                notifyIcon1.ShowBalloonTip(1000, "Upload Completed",
                                           "Upload completed!\nLink got copied into your clipboard\n" + imageLink, ToolTipIcon.Info);
            }
            catch (Exception)
            {
            }
        }