private void FillGrid()

in src/IdFix/Controls/IdFixGrid.cs [178:238]


        private void FillGrid()
        {
            this.OnStatusUpdate?.Invoke("Clearing Grid");
            this.Rows.Clear();
            this.OnStatusUpdate?.Invoke("Cleared Grid");

            if (!this._filledFromResults || this._results == null || this._results.Count() < 1)
            {
                return;
            }

            try
            {
                var timer = new Stopwatch();
                timer.Start();
                this.OnStatusUpdate?.Invoke("Populating DataGrid");

                // calculate the results to show based on page size and current page
                var displaySet = this._results.Skip(this._currentPage * this.PageSize).Take(this.PageSize).ToArray();
                var len = displaySet.Length;
                // show those results
                for (var i = 0; i < len; i++)
                {
                    var item = displaySet[i];
                    var rowIndex = this.Rows.Add();
                    var row = this.Rows[rowIndex];
                    row.Cells[StringLiterals.DistinguishedName].Value = item.EntityDistinguishedName;
                    row.Cells[StringLiterals.CommonName].Value = item.EntityCommonName;
                    row.Cells[StringLiterals.ObjectClass].Value = item.ObjectType;
                    row.Cells[StringLiterals.Attribute].Value = item.AttributeName;
                    row.Cells[StringLiterals.Error].Value = item.ErrorsToString();
                    row.Cells[StringLiterals.Value].Value = item.OriginalValue;
                    row.Cells[StringLiterals.ProposedAction].Value = item.ProposedAction.ToString();
                    row.Cells[StringLiterals.Update].Value = item.ProposedValue;
                }

                if (this.RowCount > 0)
                {
                    this.CurrentCell = this.Rows[0].Cells[StringLiterals.DistinguishedName];
                }

                this.OnStatusUpdate?.Invoke("Populated DataGrid");

                timer.Stop();
                this.OnStatusUpdate?.Invoke(StringLiterals.ElapsedTimePopulateDataGridView + timer.Elapsed.TotalSeconds);

                if (this._pageCount > 1)
                {
                    this.OnStatusUpdate?.Invoke(string.Format("Total Error Count: {0} Displayed Count: {1} Page {2} of {3}", this._totalResults, this.Rows.Count, this.CurrentPage, this._pageCount));
                }
                else
                {
                    this.OnStatusUpdate?.Invoke(string.Format("Total Error Count: {0}", this._totalResults));
                }
            }
            catch (Exception err)
            {
                this.OnStatusUpdate?.Invoke(StringLiterals.Exception + StringLiterals.Threadsafe + "  " + err.Message);
                throw;
            }
        }