* UINavMenu: SelectPage增加Guid接口
This commit is contained in:
parent
8e9b4eea98
commit
ef146ceff8
Binary file not shown.
Binary file not shown.
@ -22,6 +22,7 @@ namespace Sunny.UI.Demo
|
|||||||
private void FButton_Load(object sender, EventArgs e)
|
private void FButton_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Console.WriteLine("1. FButton_Load");
|
Console.WriteLine("1. FButton_Load");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//放在 [窗体Load、重载OnLoad、重载Init] 的内容每次页面切换,进入页面都会执行。
|
//放在 [窗体Load、重载OnLoad、重载Init] 的内容每次页面切换,进入页面都会执行。
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
@ -889,27 +888,21 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
public void SelectPage(int pageIndex)
|
public void SelectPage(int pageIndex)
|
||||||
{
|
{
|
||||||
AllNodes.Clear();
|
var node = MenuHelper.GetTreeNode(pageIndex);
|
||||||
GetAllNodes(Nodes);
|
if (node != null)
|
||||||
if (AllNodes.ContainsKey(pageIndex))
|
|
||||||
{
|
{
|
||||||
SelectedNode = AllNodes[pageIndex];
|
SelectedNode = node;
|
||||||
ShowSelectedNode();
|
ShowSelectedNode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly ConcurrentDictionary<int, TreeNode> AllNodes = new ConcurrentDictionary<int, TreeNode>();
|
public void SelectPage(Guid pageGuid)
|
||||||
|
|
||||||
private void GetAllNodes(TreeNodeCollection nodes)
|
|
||||||
{
|
{
|
||||||
foreach (TreeNode node in nodes)
|
var node = MenuHelper.GetTreeNode(pageGuid);
|
||||||
|
if (node != null)
|
||||||
{
|
{
|
||||||
if (MenuHelper.GetPageIndex(node) >= 0)
|
SelectedNode = node;
|
||||||
{
|
ShowSelectedNode();
|
||||||
AllNodes.TryAddOrUpdate(MenuHelper.GetPageIndex(node), node);
|
|
||||||
}
|
|
||||||
|
|
||||||
GetAllNodes(node.Nodes);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,6 +164,19 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TreeNode GetTreeNode(Guid guid)
|
||||||
|
{
|
||||||
|
foreach (var pair in Items)
|
||||||
|
{
|
||||||
|
if (pair.Value.PageGuid == guid)
|
||||||
|
{
|
||||||
|
return pair.Key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UITabControlHelper
|
public class UITabControlHelper
|
||||||
|
Loading…
x
Reference in New Issue
Block a user