Exemplo n.º 1
0
        /// <summary>
        /// Helper method that updates the grid
        /// </summary>
        /// <param name="dataGrid"></param>
        /// <param name="startIndex"></param>
        /// <param name="endIndex"></param>
        /// <param name="cancel"></param>
        /// <returns></returns>
        private async Task updateDataGridHelper(DataGridView dataGrid, int startIndex, int endIndex, CancellationToken cancel)
        {
            // Holds the different data fields
            ArrayList name = new ArrayList(), login = new ArrayList(), description = new ArrayList();
            ArrayList avatarArr = new ArrayList();

            name        = newSearch.getNameArr();
            login       = newSearch.getLoginArr();
            description = newSearch.getDescriptionArr();
            avatarArr   = newSearch.getAvatarArr();

            // adding elements to the grid
            for (int i = startIndex; i < endIndex; i++)
            {
                // Checking for cancellation
                cancel.ThrowIfCancellationRequested();

                Object[] row1 = { avatarArr[i], name[i], login[i], description[i] };
                dataGrid.Rows.Add(row1[0], row1[1], row1[2], row1[3]);
                dataGrid.Refresh();
            }

            return;
        }