Exemplo n.º 1
0
        /// <summary>
        /// Performs the data collection of elements when next is clicked.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void nextButton_Click(object sender, EventArgs e)
        {
            // checks if we have enough elements in our collection
            if ((endIndex + 30) > newSearch.getTotalSeachElements())
            {
                // update the grid based on elements in our collection that already exist
                startIndex += 30;
                endIndex   += 30;

                // clearing our grid
                clearGrid(searchGrid);

                //enableling previous Button
                previousButton.Enabled = true;

                // add more elements to our collection
                await newSearch.collectingData();

                // updating the grid based on the new indecies
                await updateDataGrid(searchGrid, startIndex, endIndex, cancelToken.Token);
            }
            else
            {
                // update the grid based on elements in our collection that already exist
                startIndex += 30;
                endIndex   += 30;

                //enableling previous Button
                previousButton.Enabled = true;

                // clearing our grid
                clearGrid(searchGrid);

                // updating the grid based on the new indecies
                await updateDataGrid(searchGrid, startIndex, endIndex, cancelToken.Token);
            }
        }