Пример #1
0
        void GenerateTree(TreeNodeCollection nodes, ChartThemeFolder folder)
        {
            ThemeFolderNode nodeFolder = new ThemeFolderNode(folder);

            nodeFolder.Text               = Lang._(folder.Name);
            nodeFolder.ImageIndex         = 0;
            nodeFolder.SelectedImageIndex = 0;
            nodes.Add(nodeFolder);

            foreach (var subFolder in folder.Folders)
            {
                GenerateTree(nodeFolder.Nodes, subFolder);
            }

            foreach (var theme in folder.Themes)
            {
                var nodeTheme = new ThemeNode(theme);
                if (theme.IsInternal)
                {
                    nodeTheme.Text = Lang._(theme.Name);
                }
                nodeTheme.ImageIndex      = nodeTheme.SelectedImageIndex = GetImageIndex(theme.Icon);
                nodeTheme.StateImageIndex = IsDefaultTheme(theme) ? 1 : 0;
                nodeFolder.Nodes.Add(nodeTheme);
            }
        }
Пример #2
0
        ThemeFolderNode FindTreeNode(TreeNodeCollection nodes, ChartThemeFolder themeFolder)
        {
            foreach (TreeNode node in nodes)
            {
                if (node is ThemeFolderNode && ((ThemeFolderNode)node).ThemeFolder == themeFolder)
                {
                    return((ThemeFolderNode)node);
                }

                ThemeFolderNode sn = FindTreeNode(node.Nodes, themeFolder);
                if (sn != null)
                {
                    return(sn);
                }
            }

            return(null);
        }
Пример #3
0
        void AddNewTheme(ChartTheme theme)
        {
            ChartThemeManage.Default.Extensions.Themes.Add(theme);
            ThemeFolderNode node = FindTreeNode(ChartThemeManage.Default.Extensions);

            if (node != null)
            {
                node.Nodes.Add(CreateThemeNode(theme));
            }

            CurrentTheme = theme;

            if (tabControl1.SelectedIndex != 1)
            {
                tabControl1.SelectedIndex = 1;
            }

            if (TxbThemeName.CanFocus && !TxbThemeName.Focused)
            {
                TxbThemeName.Focus();
            }
        }