Beispiel #1
0
        public void CalculatePercentage()
        {
            // Get the previous percentage
            int  previousPercent = int.Parse(percentage);
            long percentageCalculation;

            // If there are pieces still needed, calculate the percentage
            if (pieceNeedList.Count > 0)
            {
                percentageCalculation = (100 * amountOfFileAquired) / fileSize;
            }

            // Else the percentage is going to 100
            else
            {
                percentageCalculation = 100;

                completed = true;
            }
            percentage = percentageCalculation.ToString();

            // If there is a change in the percentage, update the UI
            if (percentageCalculation > previousPercent || firstTime)
            {
                uiUpdate.UpdateGridView(listViewID, percentage + "%", peersConnected, status);
                firstTime = false;
            }
        }