private bool IsCommandTabContainingGroups(ICommandTab cmdTab, TabCommandGroupInfo[] tabGroups) { var tabBoxes = (object[])cmdTab.CommandTabBoxes(); if (tabBoxes != null && tabBoxes.Length == tabGroups.Length) { for (int i = 0; i < tabBoxes.Length; i++) { if (!IsCommandTabBoxMatchingGroup((ICommandTabBox)tabBoxes[i], tabGroups[i])) { return(false); } } return(true); } else { return(false); } }
private CommandTabBox TryFindCommandTabBox(ICommandTab cmdTab, int[] cmdIds) { var cmdBoxesArr = cmdTab.CommandTabBoxes() as object[]; if (cmdBoxesArr != null) { var cmdBoxes = cmdBoxesArr.Cast <CommandTabBox>().ToArray(); var cmdBoxGroup = cmdBoxes.GroupBy(b => { object existingCmds; object existingTextStyles; b.GetCommands(out existingCmds, out existingTextStyles); if (existingCmds is int[]) { return(((int[])existingCmds).Intersect(cmdIds).Count()); } else { return(0); } }).OrderByDescending(g => g.Key).FirstOrDefault(); if (cmdBoxGroup != null) { if (cmdBoxGroup.Key > 0) { return(cmdBoxGroup.FirstOrDefault()); } } return(null); } return(null); }