Example #1
0
 public void SortRows(RowSortPredicate predicate)
 {
     if (predicate.HasValidSortPriorities())
     {
         m_Rows.Sort(delegate(Row pRow1, Row pRow2) { return(predicate.CompareRows(pRow1, pRow2)); });
     }
 }
Example #2
0
        public void SortRows()
        {
            if (rnHead != rnTail)
            {
                Cursor.Current = Cursors.WaitCursor;

                RowSortPredicate pred = new RowSortPredicate(m_Parent.Columns);

                if (!pred.HasValidSortPriorities())
                {
                    return;
                }

                Row          pRow     = rnHead.InternalRow;
                RowVestibule rowsVest = new RowVestibule(this.Count);

                while (pRow != null)
                {
                    rowsVest.AddRow(pRow);
                    pRow = pRow.GetNextRow();
                }

                if (!rowsVest.HasRows())
                {
                    return;
                }

                rowsVest.SortRows(pred);
                RowNode pRowNode = rnHead;

                foreach (Row r in rowsVest.Rows)
                {
                    if (pRowNode.InternalRow != r)
                    {
                        pRowNode.InternalRow            = r;
                        pRowNode.InternalRow.ParentNode = pRowNode;
                    }

                    pRowNode = pRowNode.NextNode;
                }

                rowsVest.ClearRows();
            }
        }