SIL.ObjectBrowser.InspectorWnd.RefreshView C# (CSharp) Method

RefreshView() public method

Refreshes the view.
public RefreshView ( ) : void
return void
		public void RefreshView()
		{
			// Get the object that's displayed in the first visible row of the grid.
			IInspectorObject firstDisplayedObj =
				m_list[gridInspector.FirstDisplayedScrollingRowIndex];

			// Get the current, selected row in the grid.
			IInspectorObject currSelectedObj = gridInspector.CurrentObject;
			if (currSelectedObj != null && WillObjDisappearOnRefresh != null)
			{
				// Check if the selected object will disappear after refreshing the grid.
				// If so, then save a reference to the selected object's parent object.
				if (WillObjDisappearOnRefresh(this, currSelectedObj))
					currSelectedObj = m_list.GetParent(gridInspector.CurrentCellAddress.Y);
			}

			int keyFirstDisplayedObj = (firstDisplayedObj != null ? firstDisplayedObj.Key : -1);
			int keyCurrSelectedObj = (currSelectedObj != null ? currSelectedObj.Key : -1);

			// Save all the expanded objects.
			List<int> expandedObjects = new List<int>();

			for (int i = 0; i < m_list.Count; i++)
			{
				if (m_list.IsExpanded(i))
					expandedObjects.Add(m_list[i].Key);
			}

			m_list.Initialize(m_list.TopLevelObject);

			// Now that the list is rebuilt, go through the list of objects that
			// were previously expanded and expand them again.
			int firstRow = 0;
			int currRow = 0;
			int irow = 0;

			while (++irow < m_list.Count)
			{
				IInspectorObject io = m_list[irow];
				int key = io.Key;
				int index = expandedObjects.IndexOf(key);
				if (index >= 0)
				{
					m_list.ExpandObject(irow);
					expandedObjects.RemoveAt(index);
				}

				if (key == keyFirstDisplayedObj)
					firstRow = irow;

				if (key == keyCurrSelectedObj)
					currRow = irow;
			}

			gridInspector.SuspendLayout();
			gridInspector.List = m_list;
			gridInspector.FirstDisplayedScrollingRowIndex = firstRow;
			gridInspector.CurrentCell = gridInspector[0, currRow];
			gridInspector.ResumeLayout();
		}
			/// ------------------------------------------------------------------------------------

Same methods

InspectorWnd::RefreshView ( string type ) : void