Пример #1
0
 public void CopyFileNameWithExtension()
 {
     if (HistoryItem != null && IsFilePathValid)
     {
         ZAppHelper.CopyTextSafely(Path.GetFileName(HistoryItem.Filepath));
     }
 }
Пример #2
0
 public void CopyShortenedURL()
 {
     if (HistoryItem != null && IsShortenedURLExist)
     {
         ZAppHelper.CopyTextSafely(HistoryItem.ShortenedURL);
     }
 }
Пример #3
0
 public void CopyFilePath()
 {
     if (HistoryItem != null && IsFilePathValid)
     {
         ZAppHelper.CopyTextSafely(HistoryItem.Filepath);
     }
 }
Пример #4
0
 public void CopyForumLink()
 {
     if (HistoryItem != null && IsURLExist)
     {
         ZAppHelper.CopyTextSafely(string.Format("[url]{0}[/url]", HistoryItem.URL));
     }
 }
Пример #5
0
 public void CopyForumImage()
 {
     if (HistoryItem != null && IsImageURL)
     {
         ZAppHelper.CopyTextSafely(string.Format("[img]{0}[/img]", HistoryItem.URL));
     }
 }
Пример #6
0
 public void CopyHTMLImage()
 {
     if (HistoryItem != null && IsImageURL)
     {
         ZAppHelper.CopyTextSafely(string.Format("<img src=\"{0}\"/>", HistoryItem.URL));
     }
 }
Пример #7
0
 public void CopyHTMLLinkedImage()
 {
     if (HistoryItem != null && IsImageURL && IsThumbnailURLExist)
     {
         ZAppHelper.CopyTextSafely(string.Format("<a href=\"{0}\"><img src=\"{1}\"/></a>", HistoryItem.URL, HistoryItem.ThumbnailURL));
     }
 }
Пример #8
0
 public void CopyHTMLLink()
 {
     if (HistoryItem != null && IsURLExist)
     {
         ZAppHelper.CopyTextSafely(string.Format("<a href=\"{0}\">{0}</a>", HistoryItem.URL));
     }
 }
Пример #9
0
 public void CopyDeletionURL()
 {
     if (HistoryItem != null && IsDeletionURLExist)
     {
         ZAppHelper.CopyTextSafely(HistoryItem.DeletionURL);
     }
 }
Пример #10
0
 public void CopyThumbnailURL()
 {
     if (HistoryItem != null && IsThumbnailURLExist)
     {
         ZAppHelper.CopyTextSafely(HistoryItem.ThumbnailURL);
     }
 }
Пример #11
0
 public void CopyForumLinkedImage()
 {
     if (HistoryItem != null && IsImageURL && IsThumbnailURLExist)
     {
         ZAppHelper.CopyTextSafely(string.Format("[url={0}][img]{1}[/img][/url]", HistoryItem.URL, HistoryItem.ThumbnailURL));
     }
 }
Пример #12
0
        private void CopyErrors()
        {
            string errors = GetErrors();

            if (!string.IsNullOrEmpty(errors))
            {
                ZAppHelper.CopyTextSafely(errors);
            }
        }
Пример #13
0
        private void CopyDeletionURL()
        {
            UploadResult result = GetCurrentUploadResult();

            if (result != null && !string.IsNullOrEmpty(result.DeletionURL))
            {
                ZAppHelper.CopyTextSafely(result.DeletionURL);
            }
        }
 private void PropertyListView_Click_Value(object sender, EventArgs e)
 {
     if (this.SelectedItems.Count > 0)
     {
         string text = this.SelectedItems[0].SubItems[1].Text;
         if (!string.IsNullOrEmpty(text))
         {
             ZAppHelper.CopyTextSafely(text);
         }
     }
 }
Пример #15
0
        private void CopyURL()
        {
            if (lvUploads.SelectedItems.Count > 0)
            {
                string[] array = lvUploads.SelectedItems.Cast <ListViewItem>().Select(x => x.Tag as UploadResult).
                                 Where(x => x != null && !string.IsNullOrEmpty(x.URL)).Select(x => x.URL).ToArray();

                if (array != null && array.Length > 0)
                {
                    string urls = string.Join("\r\n", array);

                    if (!string.IsNullOrEmpty(urls))
                    {
                        ZAppHelper.CopyTextSafely(urls);
                    }
                }
            }
        }
Пример #16
0
        public void CopyURL()
        {
            if (HistoryItem != null && IsURLExist)
            {
                string[] array = lv.SelectedItems.Cast <ListViewItem>().Select(x => x.Tag as HistoryItem).
                                 Where(x => x != null && !string.IsNullOrEmpty(x.URL)).Select(x => x.URL).ToArray();

                if (array != null && array.Length > 0)
                {
                    string urls = string.Join("\r\n", array);

                    if (!string.IsNullOrEmpty(urls))
                    {
                        ZAppHelper.CopyTextSafely(urls);
                    }
                }
            }
        }
        private static void task_UploadCompleted(UploadInfo info)
        {
            try
            {
                if (ListViewControl != null && info != null && info.Result != null)
                {
                    ListViewItem lvi = ListViewControl.Items[info.ID];
                    lvi.Tag = info.Result;

                    if (info.Result.IsError)
                    {
                        string errors = string.Join("\r\n\r\n", info.Result.Errors.ToArray());

                        Program.MyLogger.WriteLine("Upload failed. ID: {0}, Filename: {1}, Errors:\r\n{2}", info.ID, info.FileName, errors);

                        lvi.SubItems[1].Text = "Error";
                        lvi.SubItems[8].Text = string.Empty;
                        lvi.ImageIndex       = 1;

                        if (Program.Settings.AutoPlaySound)
                        {
                            SystemSounds.Asterisk.Play();
                        }
                    }
                    else
                    {
                        Program.MyLogger.WriteLine("Upload completed. ID: {0}, Filename: {1}, URL: {2}, Duration: {3}ms", info.ID, info.FileName,
                                                   info.Result.URL, (int)info.UploadDuration.TotalMilliseconds);

                        lvi.SubItems[1].Text = info.Status;
                        lvi.ImageIndex       = 2;

                        if (!string.IsNullOrEmpty(info.Result.URL))
                        {
                            string url = string.IsNullOrEmpty(info.Result.ShortenedURL) ? info.Result.URL : info.Result.ShortenedURL;

                            lvi.SubItems[8].Text = url;

                            if (Program.Settings.ClipboardAutoCopy)
                            {
                                ZAppHelper.CopyTextSafely(url);
                            }

                            if (Program.Settings.SaveHistory)
                            {
                                HistoryManager.AddHistoryItemAsync(Program.HistoryFilePath, info.GetHistoryItem());
                            }

                            if (Program.mainForm.niTray.Visible)
                            {
                                Program.mainForm.niTray.Tag = url;
                                Program.mainForm.niTray.ShowBalloonTip(5000, "ZUploader - Upload completed", url, ToolTipIcon.Info);
                            }
                        }

                        if (Program.Settings.AutoPlaySound)
                        {
                            SystemSounds.Exclamation.Play();
                        }
                    }

                    lvi.EnsureVisible();
                }
            }
            finally
            {
                StartTasks();
                UpdateTrayIcon();
            }
        }
Пример #18
0
        private static void task_UploadCompleted(WorkerTask task)
        {
            try
            {
                if (ListViewControl != null && task != null && task.Result != null)
                {
                    ListViewItem lvi = ListViewControl.Items[task.Id];
                    lvi.Tag = task.Result;

                    if (task.Result.IsError)
                    {
                        string errors = string.Join("\r\n\r\n", task.Result.Errors.ToArray());

                        DebugHelper.WriteLine("Upload failed. ID: {0}, Filename: {1}, Errors:\r\n{2}", task.Id, task.Info.FileName, errors);

                        lvi.SubItems[1].Text = "Error";
                        lvi.SubItems[8].Text = string.Empty;
                        lvi.ImageIndex       = 1;

                        if (Engine.ConfigOptions.CompleteSound)
                        {
                            SystemSounds.Asterisk.Play();
                        }
                    }
                    else
                    {
                        DebugHelper.WriteLine("Upload completed. ID: {0}, Filename: {1}, URL: {2}, Duration: {3}ms", task.Id, task.Info.FileName,
                                              task.Result.URL, (int)task.UploadDuration);

                        lvi.SubItems[1].Text = task.Status.GetDescription();
                        lvi.ImageIndex       = 2;

                        if (!string.IsNullOrEmpty(task.Result.URL))
                        {
                            string url = string.IsNullOrEmpty(task.Result.ShortenedURL) ? task.Result.URL : task.Result.ShortenedURL;

                            lvi.SubItems[8].Text = url;

                            if (Engine.ConfigWorkflow.ClipboardOverwrite)
                            {
                                ZAppHelper.CopyTextSafely(url);
                            }

                            if (Engine.ConfigOptions.HistorySave)
                            {
                                HistoryManager.AddHistoryItemAsync(Engine.HistoryPath, task.GenerateHistoryItem());
                            }
                        }

                        if (Engine.ConfigOptions.CompleteSound)
                        {
                            SystemSounds.Exclamation.Play();
                        }
                    }

                    lvi.EnsureVisible();
                }
            }
            finally
            {
                StartTasks();
                //  UpdateTrayIcon();
            }
        }