public void AddData(int prototype, object data) { InitPrototypes(); Element ele = new Element(prototype); ele.size = SizeOfPrototype(prototype); ele.data = data; if (mFirst == null) { mFirst = ele; mResize = true; mResizeRow = mFirstRow; mLast = ele; return; } if (m_SortData) { var node = mLast; while (node != null) { if (CompareData(node, ele) < 0) { break; } node = node.previous; } if (node == null) { mFirst.AddBefore(ele); mResize = true; mResizeRow = null; mFirst = ele; } else { node.AddAfter(ele); if (node == mLast) { mLast = ele; } mResize = true; if (node.row == null) { mResizeRow = null; } else if (mResizeRow == null || mResizeRow.index > node.row.index) { mResizeRow = node.row; } } } else { mLast.AddAfter(ele); mLast = ele; mResize = true; mResizeRow = mLastRow; } }