private static RibbonGroupData LoadRibbonGroup(string userGroup) { if (userGroup.IsNullOrEmpty()) { return(null); } var ribbonFile = RibbonGroupData.GetRibbonFile(userGroup); if (File.Exists(ribbonFile)) { return(RibbonGroupData.Load(ribbonFile, e => throw e)); } var ribbonGroup = new RibbonGroupData { Tabs = new List <RibbonTabData> { new RibbonTabData { Name = userGroup, Panels = new List <RibbonPanelData>() } } }; return(ribbonGroup); }
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); }
public static List <(RibbonTabData, string)> LoadRibbonTabsFromGroups() { var groupsName = new List <string> { PikSettings.UserGroup, Commands.GroupCommon, PikSettings.AdditionalUserGroup }; return(groupsName.Where(w => !w.IsNullOrEmpty()) .Select(s => RibbonGroupData.Load(RibbonGroupData.GetRibbonFile(s))?.Tabs.Select(t => (t, s))) .Where(w => w != null).SelectMany(s => s).ToList()); }
private static void SaveRibbonGroup(RibbonGroupData ribbonGroup, string userGroup) { var ribbonFile = RibbonGroupData.GetRibbonFile(userGroup); ribbonGroup?.Save(ribbonFile); }