mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Clicking on task panel title will open URL or file path
This commit is contained in:
parent
092b93efc8
commit
86e20a74e4
3 changed files with 38 additions and 6 deletions
1
ShareX/Controls/TaskThumbnailPanel.Designer.cs
generated
1
ShareX/Controls/TaskThumbnailPanel.Designer.cs
generated
|
@ -94,6 +94,7 @@ private void InitializeComponent()
|
|||
this.lblTitle.TabIndex = 1;
|
||||
this.lblTitle.Text = "Test.png";
|
||||
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lblTitle.MouseClick += new System.Windows.Forms.MouseEventHandler(this.LblTitle_MouseClick);
|
||||
//
|
||||
// TaskThumbnailPanel
|
||||
//
|
||||
|
|
|
@ -303,6 +303,20 @@ public void UpdateStatus()
|
|||
{
|
||||
pThumbnail.UpdateStatusColor(Task.Status);
|
||||
}
|
||||
|
||||
UpdateTitleCursor();
|
||||
}
|
||||
|
||||
private void UpdateTitleCursor()
|
||||
{
|
||||
if (Task.Info != null && !string.IsNullOrEmpty(Task.Info.ToString()))
|
||||
{
|
||||
lblTitle.Cursor = Cursors.Hand;
|
||||
}
|
||||
else
|
||||
{
|
||||
lblTitle.Cursor = Cursors.Default;
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearThumbnail()
|
||||
|
@ -321,6 +335,28 @@ public void ClearThumbnail()
|
|||
ThumbnailExists = false;
|
||||
}
|
||||
|
||||
private void LblTitle_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left && Task.Info != null)
|
||||
{
|
||||
if (Task.Info.Result != null)
|
||||
{
|
||||
string url = Task.Info.Result.ToString();
|
||||
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
URLHelpers.OpenURL(url);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Task.Info.FilePath))
|
||||
{
|
||||
Helpers.OpenFile(Task.Info.FilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void PbThumbnail_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
|
|
|
@ -333,12 +333,7 @@ private static void Task_TaskCompleted(WorkerTask task)
|
|||
{
|
||||
DebugHelper.WriteLine($"Task completed. Filename: {info.FileName}, Duration: {(long)info.TaskDuration.TotalMilliseconds} ms");
|
||||
|
||||
string result = info.Result.ToString();
|
||||
|
||||
if (string.IsNullOrEmpty(result) && !string.IsNullOrEmpty(info.FilePath))
|
||||
{
|
||||
result = info.FilePath;
|
||||
}
|
||||
string result = info.ToString();
|
||||
|
||||
if (lvi != null)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue