Пример #1
0
        public void IncreaseProgress(long amount)
        {
            // aborta caso o valor fornecido seja inválido
            if (amount <= 0)
            {
                return;
            }

            if ((currentAmount + amount) >= totalAmount)
            {
                progressListener.ProgressConcluded(); // Avisa o listener
                return;
            }

            currentAmount = currentAmount + amount;
            double ratio = (double)currentAmount / (double)totalAmount;

            progressListener.ProgressChanged((int)(ratio * 100)); // Avisa o listener
        }