Ejemplo n.º 1
0
        private void RenderNodes(KeyCatalog catalog, NodeCollection nodes, int restoreLevel)
        {
            restoreLevel--;
            foreach (KeyCatalog sub in catalog.Subcatalogs.SortedValues)
            {
                KeyNode n = new KeyNode(sub.ToString())
                {
                    Catalog = sub
                };
                nodes.Add(n);

                if (restoreLevel < 0)
                {
                    if (SelectionNodeName == sub.Name)
                    {
                        ATree.SelectedNode = n;
                    }
                }

                if (!sub.IsLeaf)
                {
                    RenderNodes(sub, n.Nodes, restoreLevel);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 保留目前在 TreeView 上的選擇項目。
        /// </summary>
        private void ReserveTreeSelection()
        {
            SelectionNodeName = string.Empty;
            RestoreLevel      = 0;
            KeyNode kn = ATree.SelectedNode as KeyNode;

            if (kn == null)
            {
                return;             //如果選擇的不是 KeyNode 就不需要處理了。
            }
            //記錄選擇的 Node 名稱與他的層級。
            SelectionNodeName = kn.Catalog.Name;
            RestoreLevel      = kn.Level;
        }
Ejemplo n.º 3
0
        private void SetListPanel(KeyNode node)
        {
            if (node == null)
            {
                return;
            }

            try
            {
                bool selAll    = (Control.ModifierKeys & Keys.Control) == Keys.Control;
                bool addToTemp = (Control.ModifierKeys & Keys.Shift) == Keys.Shift;
                SetListPaneSource(node.Catalog.AllKey, selAll, addToTemp);
            }
            catch (Exception) { }
        }