diff --git a/ShareX.HelpersLib/Controls/MyListView.cs b/ShareX.HelpersLib/Controls/MyListView.cs index 3a21bf94b..ef7bc14cd 100644 --- a/ShareX.HelpersLib/Controls/MyListView.cs +++ b/ShareX.HelpersLib/Controls/MyListView.cs @@ -67,10 +67,7 @@ public int SelectedIndex } set { - foreach (ListViewItem lvi in SelectedItems) - { - lvi.Selected = false; - } + UnselectAll(); if (value > -1) { @@ -144,6 +141,24 @@ public void SelectLast() } } + public void SelectSingle(ListViewItem lvi) + { + UnselectAll(); + + if (lvi != null) + { + lvi.Selected = true; + } + } + + public void UnselectAll() + { + foreach (ListViewItem lvi in SelectedItems) + { + lvi.Selected = false; + } + } + protected override void OnKeyDown(KeyEventArgs e) { if (MultiSelect && e.Control && e.KeyCode == Keys.A) diff --git a/ShareX/ApplicationConfig.cs b/ShareX/ApplicationConfig.cs index dc6f64670..bd9f500ee 100644 --- a/ShareX/ApplicationConfig.cs +++ b/ShareX/ApplicationConfig.cs @@ -183,6 +183,9 @@ public ApplicationConfig() [Category("Application"), DefaultValue(true), Description("Save settings after task completed but only if there is no other active tasks. This setting will be handy for situations where setting save fails when Windows shutdown and not let ShareX to save in time.")] public bool SaveSettingsAfterTaskCompleted { get; set; } + [Category("Application"), DefaultValue(false), Description("In main window when task is completed automatically select it.")] + public bool AutoSelectLastCompletedTask { get; set; } + [Category("Hotkey"), DefaultValue(false), Description("Disables hotkeys.")] public bool DisableHotkeys { get; set; } diff --git a/ShareX/TaskManager.cs b/ShareX/TaskManager.cs index 734822e83..5e827109c 100644 --- a/ShareX/TaskManager.cs +++ b/ShareX/TaskManager.cs @@ -441,6 +441,11 @@ private static void task_TaskCompleted(WorkerTask task) if (lvi != null) { lvi.EnsureVisible(); + + if (Program.Settings.AutoSelectLastCompletedTask) + { + ListViewControl.SelectSingle(lvi); + } } } }