private object RaiseGroupSummaryEvaluateEvent(GridViewSummaryItem summaryItem, object summary)
        {
            summaryItem.SuspendNotifications();
            summaryItem.Template = this.ViewTemplate;
            GroupSummaryEvaluationEventArgs args = new GroupSummaryEvaluationEventArgs(summary, this.Group, summaryItem.FormatString, summaryItem, (IHierarchicalRow)this.Group.GroupRow, (object)this);

            args.Value = summary;
            this.ViewTemplate.EventDispatcher.RaiseEvent <GroupSummaryEvaluationEventArgs>(EventDispatcher.GroupSummaryEvaluate, (object)this.ViewTemplate, args);
            summaryItem.FormatString = args.FormatString;
            summaryItem.ResumeNotifications(false);
            return(args.Value);
        }
        public virtual string GetSummary(GridViewDataColumn column)
        {
            if (column.Index < 0)
            {
                return(string.Empty);
            }
            if (this.summaryValueVersion != this.ViewInfo.summaryValueVersion)
            {
                this.ClearCache();
                this.summaryValueVersion = this.ViewInfo.summaryValueVersion;
            }
            object obj1 = this.Cache[(GridViewColumn)column];

            if (obj1 != null)
            {
                return(obj1.ToString());
            }
            if (this.summaryRowItem == null)
            {
                return(string.Empty);
            }
            StringBuilder stringBuilder = new StringBuilder(16);

            foreach (GridViewSummaryItem summaryItem in (Collection <GridViewSummaryItem>) this.summaryRowItem)
            {
                if (summaryItem.Name == column.Name)
                {
                    DataGroup        group = (DataGroup)null;
                    object           obj2  = (object)null;
                    IHierarchicalRow parent;
                    if (this.groupRow != null)
                    {
                        obj2   = summaryItem.Evaluate((IHierarchicalRow)this.groupRow);
                        parent = (IHierarchicalRow)this.groupRow;
                        group  = this.groupRow.Group;
                    }
                    else if (this.hierarchyRow != null)
                    {
                        if (this.hierarchyRow.ActiveView.ChildRows.Count > 0)
                        {
                            obj2 = summaryItem.Evaluate((IHierarchicalRow)this.hierarchyRow);
                        }
                        parent = (IHierarchicalRow)this.hierarchyRow;
                    }
                    else
                    {
                        if (this.ViewTemplate.DataView.Count > 0)
                        {
                            obj2 = summaryItem.Evaluate((IHierarchicalRow)this.ViewTemplate);
                        }
                        parent = (IHierarchicalRow)this.ViewTemplate;
                    }
                    string formatString = summaryItem.FormatString;
                    object obj3         = obj2;
                    if (!this.suspendGroupSummaryEvaluateEvent)
                    {
                        this.suspendGroupSummaryEvaluateEvent = true;
                        GroupSummaryEvaluationEventArgs args = new GroupSummaryEvaluationEventArgs(obj2, group, summaryItem.FormatString, summaryItem, parent, (object)this);
                        this.ViewTemplate.EventDispatcher.RaiseEvent <GroupSummaryEvaluationEventArgs>(EventDispatcher.GroupSummaryEvaluate, (object)this.ViewTemplate, args);
                        formatString = args.FormatString;
                        obj3         = args.Value;
                        this.suspendGroupSummaryEvaluateEvent = false;
                    }
                    if (obj2 != null)
                    {
                        stringBuilder.Append(string.Format(formatString, obj3));
                    }
                }
            }
            string str = stringBuilder.ToString();

            this.Cache[(GridViewColumn)column] = (object)str;
            return(str);
        }