Beispiel #1
0
        private void Commit()
        {
            var e = new ProgressEvent(ProgressEvent.TRANSFERRED)
            {
                BytesTransferred = unnotifiedByteCount
            };

            _listener.ProgressChanged(e);

            unnotifiedByteCount = 0;
        }
Beispiel #2
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
        }