示例#1
0
        //
        // Category Branch
        //
        void loadCategoryBranch(CategoryIndex catIndx)
        {
            try
            {
                if (selectedIndex == catIndx) return;

                //first close previous branch
                closeOpenedBranch();

                //open content
                string filename = getCategoryFile(catIndx.file);
                if (filename == null || !File.Exists(filename)) return;
                string content = File.ReadAllText(filename);

                //parse data
                selectedBranch = JsonConvert.DeserializeObject<CategoryNode>(content);
                selectedBranch.updateParent();
                treeList.SetObjects(new CategoryNode[] { selectedBranch });
                treeList.Expand(selectedBranch);
                treeList.SelectObject(selectedBranch);

                //set others
                selectedIndex = catIndx;
                splitContainer1.Enabled = true;
                catFileLabel.Text = string.Format("{0} : Version {1}", catIndx.file, catIndx.ver);
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message + "\r\n" + ex.StackTrace);
            }
        }