예제 #1
0
        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);
        }
예제 #2
0
        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());
        }