mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-01 04:30:49 +12:00
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:
commit
cb788fcdca
|
@ -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)
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
|
@ -441,6 +441,11 @@ private static void task_TaskCompleted(WorkerTask task)
|
|||
if (lvi != null)
|
||||
{
|
||||
lvi.EnsureVisible();
|
||||
|
||||
if (Program.Settings.AutoSelectLastCompletedTask)
|
||||
{
|
||||
ListViewControl.SelectSingle(lvi);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue