示例#1
0
        private bool RecursiveSelection(List <QlikListbox> listboxes, int start, SelectionGroup group, List <SelectionGroup> groups)
        {
            if (start == listboxes.Count)
            {
                groups.Add(group);
                return(false);
            }

            for (int i = start; i < listboxes.Count; i++)
            {
                var flatSelection = listboxes[i].GetNextSelection();
                if (flatSelection == null)
                {
                    return(false);
                }

                group.FlatSelections.Add(flatSelection);
                if (RecursiveSelection(listboxes, i + 1, group, groups) == false)
                {
                    i--;
                    var newgroup = new SelectionGroup();
                    var lastidx  = group.FlatSelections.Count - start;
                    newgroup.FlatSelections.AddRange(group.FlatSelections.Take(group.FlatSelections.Count - lastidx));
                    group = newgroup;
                }
            }

            return(true);
        }
示例#2
0
        public List <SelectionGroup> DynamicSelections(List <string> filterTexts)
        {
            var groups    = new List <SelectionGroup>();
            var listBoxes = Dimensions.GetSelections(filterTexts);

            foreach (var listbox in listBoxes)
            {
                var newgroup = new SelectionGroup();
                RecursiveSelection(listBoxes, 0, newgroup, groups);
            }

            return(groups);
        }