コード例 #1
0
        void onDownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            if (!fileSizeInfoGet)
            {
                FileSizeInfoGet?.Invoke(e.TotalBytesToReceive);
                fileSizeInfoGet = true;
            }

            PercentageChanged?.Invoke(appName, e.ProgressPercentage);
        }
コード例 #2
0
        private void OnTick(object sender, EventArgs e)
        {
            TimeSpan diff       = DateTime.Now - StartedAt;
            var      diff2      = diff.TotalSeconds;
            var      percentage = diff2 / Length * 100;

            if (percentage >= 100)
            {
                PercentageChanged?.Invoke(this, 100d);
                Stop();
            }
            else
            {
                PercentageChanged?.Invoke(this, percentage);
            }
        }