示例#1
0
        public void Convert(string tabName, List <IPaletteCommand> commands)
        {
            dirBlocks = IO.Path.GetLocalSettingsFile("Blocks");
            var fileRibbon = RibbonGroupData.GetRibbonFile(tabName);
            var dir        = Path.GetDirectoryName(fileRibbon);

            Directory.CreateDirectory(dir);
            imagesDir = Path.Combine(dir, "Images");
            Directory.CreateDirectory(imagesDir);

            var tab = new RibbonTabData
            {
                Name   = tabName,
                Panels = commands.GroupBy(g => g.Group).Select(s => new RibbonPanelData
                {
                    Name  = s.Key,
                    Items = s.Select(GetItem).ToList()
                }).ToList()
            };
            var ribbonGroup = new RibbonGroupData {
                Tabs = new List <RibbonTabData> {
                    tab
                }
            };

            ribbonGroup.Save(fileRibbon);
        }
示例#2
0
        private static void SaveRibbonGroup(RibbonGroupData ribbonGroup, string userGroup)
        {
            var ribbonFile = RibbonGroupData.GetRibbonFile(userGroup);

            ribbonGroup?.Save(ribbonFile);
        }