Exemplo n.º 1
0
        private void listViewLinks_ItemActivate(object sender, EventArgs e)
        {
            var toDelete = new Imgur.ImageInfo();

            toDelete.link       = new Uri(listViewLinks.SelectedItems[0].SubItems[0].Text);
            toDelete.deletehash = listViewLinks.SelectedItems[0].SubItems[1].Text;
            Imgur.deleteImage(toDelete);
            listViewLinks.SelectedItems[0].Remove();
            Notification.DisplayBubbleMessage(3, "Image Deletion", "You have deleted the image located at " + toDelete.link);
            GC.Collect();
        }
Exemplo n.º 2
0
        private void _UploadImage()
        {
            try
            {
                this.InvokeIfRequired(() =>
                {
                    while (this.Handle == null)
                    {
                        Application.DoEvents();
                    }
                    this.Hide();
                });

                Imgur.ImageInfo PictureLink = new Imgur.ImageInfo();
                PictureLink.success = false;

                bool bShouldRetry = Properties.Settings.Default.ShouldRetryUpload;
                int  numTries     = Properties.Settings.Default.ShouldRetryUpload ? Properties.Settings.Default.NumRetries + 1 : 1;

                for (int i = 1; i <= numTries && !PictureLink.success; i++)
                {
                    PictureLink = Imgur.toImgur(curImg);
                }

                if (PictureLink.success)
                {
                    bool shouldClipboard = Properties.Settings.Default.ClipboardOnUpload;
                    Notification.DisplayBubbleMessage(3, "Imgur Upload Completed", "Your image is live at " + PictureLink.link + "!" + (shouldClipboard ? " This link has been copied to your clipboard." : ""));
                    if (shouldClipboard)
                    {
                        Clipboard.SetText(PictureLink.link.ToString());
                    }
                    GC.Collect();
                    Globals.getMainForm().addImgurItem(PictureLink.link, PictureLink.deletehash);
                    curImg.Dispose();
                }
                else
                {
                    Globals.ErrorLog("Imgur.toImgur() failed : " + PictureLink.ex.Message, true);
                }

                this.Invoke((MethodInvoker) delegate
                {
                    this.Close();
                });
            }
            catch (Exception ex)
            {
                Globals.ErrorLog("_UploadImage() Failed: " + ex.Message, false);
            }
        }
Exemplo n.º 3
0
 private void listViewLinks_ItemActivate(object sender, EventArgs e)
 {
     var toDelete = new Imgur.ImageInfo();
     toDelete.link = new Uri(listViewLinks.SelectedItems[0].SubItems[0].Text);
     toDelete.deletehash = listViewLinks.SelectedItems[0].SubItems[1].Text;
     Imgur.deleteImage(toDelete);
     listViewLinks.SelectedItems[0].Remove();
     Main.DisplayBubbleMessage(3, "Image Deletion", "You have deleted the image located at " + toDelete.link);
     GC.Collect();
 }