Ejemplo n.º 1
0
        private async void UploadScreenshot_Click(object sender, EventArgs e)
        {
            btnUpload.Text   = L18n.Get("OtherHelper", "Text_cancel");
            btnUpload.Click -= UploadScreenshot_Click;
            btnUpload.Click += UploadScreenshotCanceled;
            txbLink.Text     = "";
            txbLink.Enabled  = false;
            try
            {
                var filename = Path.GetFileName(label.Text);
                txbLink.Text = await Screenshot.UploadScreenshot(label.Text);

                MediaHistoryManager.AddLinkToEntry(filename, txbLink.Text, MediaHistoryManager.MediaType.Screenshot);
                label.Text        = L18n.Get("OtherHelper", "Text_uploaded");
                label.ForeColor   = Color.Green;
                txbLink.Enabled   = true;
                btnUpload.Enabled = false;
            }
            catch (OperationCanceledException) { }
            finally
            {
                btnUpload.Click -= UploadScreenshotCanceled;
                btnUpload.Click += UploadScreenshot_Click;
                btnUpload.Text   = L18n.Get("OtherHelper", "Text_upload");
            }
        }
Ejemplo n.º 2
0
 public void UploadVideoCompleted(string id, string filename)
 {
     if (InvokeRequired)
     {
         this.Invoke(new UploadVideoCompletedDelegate(UploadVideoCompleted), new object[] { id, filename });
         return;
     }
     try
     {
         wrapper.Controls.Remove(bar);
         wrapper.Controls.Remove(txbLink);
     }
     catch (Exception) { }
     label.Text      = L18n.Get("OtherHelper", "Text_uploaded");
     label.ForeColor = Color.Green;
     txbLink.Text    = $@"https://youtu.be/{id}";
     MediaHistoryManager.AddLinkToEntry(filename, txbLink.Text, MediaHistoryManager.MediaType.Video);
     txbLink.Enabled = true;
     wrapper.Controls.Add(txbLink, 0, 2);
     btnUpload.Enabled = false;
 }