Fix uploaders config form tab navigation

This commit is contained in:
Jaex 2020-02-08 19:20:27 +03:00
parent efcca39ae6
commit a3174356a3
3 changed files with 32 additions and 2 deletions

View file

@ -157,7 +157,7 @@ private void tvMain_AfterSelect(object sender, TreeViewEventArgs e)
}
}
public void SelectTab(TabPage tabPage)
private void SelectTab(TabPage tabPage)
{
if (tabPage != null)
{
@ -172,6 +172,23 @@ public void SelectTab(TabPage tabPage)
}
}
public void NavigateToTabPage(TabPage tabPage)
{
if (tabPage != null)
{
foreach (TreeNode node in tvMain.Nodes.All())
{
TabPage nodeTabPage = node.Tag as TabPage;
if (nodeTabPage == tabPage)
{
tvMain.SelectedNode = node;
return;
}
}
}
}
public void SelectChild()
{
if (tvMain.SelectedNode.Nodes.Count > 0)

View file

@ -810,5 +810,18 @@ public static Image CloneSafe(this Image img)
return null;
}
public static IEnumerable<TreeNode> All(this TreeNodeCollection nodes)
{
foreach (TreeNode node in nodes)
{
yield return node;
foreach (TreeNode child in node.Nodes.All())
{
yield return child;
}
}
}
}
}

View file

@ -144,7 +144,7 @@ public void NavigateToTabPage(TabPage tp)
{
if (tp != null)
{
tttvMain.SelectTab(tp);
tttvMain.NavigateToTabPage(tp);
}
}