private void ComposeDataCells() { if (Options.ShowColumnHeaders) { for (var col = 0; col < Options.Columns.Count; col++) { recomposableControls.Add(gridLayout.Add(new Label() { Text = Options.Columns[col].Header }, col, 0)); } } var dataRowStartIndex = Options.ShowColumnHeaders ? 1 : 0; var currentIndex = 0; for (var gridLayoutRow = dataRowStartIndex; gridLayoutRow < dataRowStartIndex + MaxRowsThatCanBePresented; gridLayoutRow++) { if (currentIndex >= Options.Rows.Count) { break; } var dataItem = Options.Rows[currentIndex]; var rowControls = new List <ConsoleControl>(); ControlsByRow.Add(currentIndex, rowControls); for (var gridLayoutCol = 0; gridLayoutCol < Options.Columns.Count; gridLayoutCol++) { var columnDefinition = Options.Columns[gridLayoutCol]; var cellDisplayControl = gridLayout.Add(dataItem.Cells[gridLayoutCol].Invoke(), gridLayoutCol, gridLayoutRow); recomposableControls.Add(cellDisplayControl); rowControls.Add(cellDisplayControl); } currentIndex++; } }
private void Decompose() { for (var i = 0; i < recomposableControls.Count; i++) { gridLayout.Remove(recomposableControls[i]); } recomposableControls.Clear(); ControlsByRow.Clear(); if (loadingPanel != null) { ProtectedPanel.Controls.Remove(loadingPanel); loadingPanel = null; } }
private void Decompose() { for (var i = 0; i < recomposableControls.Count; i++) { gridLayout.Remove(recomposableControls[i]); } recomposableControls.Clear(); ControlsByRow.Clear(); if (loadingPanel != null) { using (var modifyLock = Unlock()) { Controls.Remove(loadingPanel); loadingPanel = null; } } }