Merge pull request #3647 from Jaex/master

fixes #3604: Added option to automatically select last completed task in main window
This commit is contained in:
Jaex 2018-10-01 23:30:31 +03:00 committed by GitHub
commit cb788fcdca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 4 deletions

View file

@ -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)

View file

@ -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; }

View file

@ -441,6 +441,11 @@ private static void task_TaskCompleted(WorkerTask task)
if (lvi != null)
{
lvi.EnsureVisible();
if (Program.Settings.AutoSelectLastCompletedTask)
{
ListViewControl.SelectSingle(lvi);
}
}
}
}