void add <T>(GroupingOption o, T Default)
 {
     list.Add(new GroupingOptionValue <T>(Default, o)
     {
         Owner = this
     });
 }
Example #2
0
 internal void NotifyChanged(GroupingOption o)
 {
     if(OptionChanged != null)
         OptionChanged(this,new GroupingOptionChangedEventArgs(o));
     if (PropertyChanged != null)
         PropertyChanged(this, new PropertyChangedEventArgs(o.ToString()));
 }
        booloption AddOption(string txt, GroupingOption o)
        {
            var res = new booloption(o);

            res.Text  = txt;
            res.Strip = this;
            OptionsMenuItem.DropDownItems.Add(res);
            return(res);
        }
Example #4
0
 public GroupingOptionValue this[GroupingOption option]
 {
     get
     {
         for (int i = 0; i < list.Count; i++)
         {
             if (list[i].Option == option) return list[i];
         }
         return null;
     }
 }
 public GroupingOptionValue this[GroupingOption option]
 {
     get
     {
         for (int i = 0; i < list.Count; i++)
         {
             if (list[i].Option == option)
             {
                 return(list[i]);
             }
         }
         return(null);
     }
 }
 bool ShouldSerialize(GroupingOption o)
 {
     return(!this[o].IsDefault);
 }
 void SetValue <T>(GroupingOption o, T value)
 {
     ((GroupingOptionValue <T>) this[o]).Value = value;
 }
 T GetValue <T>(GroupingOption o)
 {
     return(((GroupingOptionValue <T>) this[o]).Value);
 }
 protected GroupingOptionValue(GroupingOption o)
 {
     this.Option = o;
 }
 public GroupingOptionChangedEventArgs(GroupingOption Option)
 {
     this.Option = Option;
 }
 public booloption(GroupingOption Option)
 {
     this.Option = Option;
 }
        // ===============================================================================
        //                                                                        Grouping
        //                                                                        ========
        #region Grouping

        /**
         * Group the list.
         * @param <ROW> The type of row.
         * @param groupingRowSetupper The setupper of grouping row. (NotNull)
         * @param groupingOption The option of grouping. (NotNull and it requires the breakCount or the determiner)
         * @return The grouped list. (NotNull)
         */
        public System.Collections.Generic.IList <ROW> GroupingList <ROW>(GroupingRowSetupper <ROW, ENTITY> groupingRowSetupper, GroupingOption <ENTITY> groupingOption)
        {
            System.Collections.Generic.IList <ROW> groupingList     = new System.Collections.Generic.List <ROW>();
            GroupingRowEndDeterminer <ENTITY>      rowEndDeterminer = groupingOption.GroupingRowEndDeterminer;

            if (rowEndDeterminer == null)
            {
                rowEndDeterminer = delegate(GroupingRowResource <ENTITY> currentRowResource, ENTITY nextEntity) {
                    return(currentRowResource.IsSizeUpBreakCount);
                }; // as Default
            }
            GroupingRowResource <ENTITY> rowResource = new GroupingRowResource <ENTITY>();
            int breakCount      = groupingOption.ElementCount;
            int rowElementIndex = 0;
            int allElementIndex = 0;

            foreach (ENTITY entity in _selectedList)
            {
                // Set up row resource.
                rowResource.AddGroupingRowList(entity);
                rowResource.ElementCurrentIndex = rowElementIndex;
                rowResource.BreakCount          = breakCount;

                if (_selectedList.Count == (allElementIndex + 1))   // Last Loop!
                // Set up the object of grouping row!
                {
                    ROW groupingRowObject = groupingRowSetupper.Invoke(rowResource);

                    // Register!
                    groupingList.Add(groupingRowObject);
                    break;
                }

                // Not last loop so the nextElement must exist.
                ENTITY nextElement = _selectedList[allElementIndex + 1];

                // Do at row end.
                if (rowEndDeterminer.Invoke(rowResource, nextElement))   // Determine the row end!
                // Set up the object of grouping row!
                {
                    ROW groupingRowObject = groupingRowSetupper.Invoke(rowResource);

                    // Register!
                    groupingList.Add(groupingRowObject);

                    // Initialize!
                    rowResource     = new GroupingRowResource <ENTITY>();
                    rowElementIndex = 0;
                    ++allElementIndex;
                    continue;
                }
                ++rowElementIndex;
                ++allElementIndex;
            }
            return(groupingList);
        }